Skip to main content
SHARE
Publication

Semantic Stealth: Crafting Covert Adversarial Patches for Sentiment Classifiers Using Large Language Models

by Maria C Roa Carvajal, Maria Mahbub, Sudarshan Srinivasan, Edmon Begoli, Amir Sadovnik
Publication Type
Conference Paper
Book Title
AISec '24: Proceedings of the 2024 Workshop on Artificial Intelligence and Security
Publication Date
Page Numbers
42 to 52
Publisher Location
New York, New York, United States of America
Conference Name
17th ACM Workshop on Artificial Intelligence and Security (AISec)
Conference Location
Salt Lake City, Utah, United States of America
Conference Sponsor
ACM
Conference Date

Deep learning models have been shown to be vulnerable to adversarial attacks, in which perturbations to their inputs cause the model to produce incorrect predictions. As opposed to adversarial attacks in computer vision, where small changes introduced to pixel values can drastically alter a model's output while remaining imperceptible to humans, text-based attacks are difficult to conceal due to the discrete nature of tokens. Consequently, unconstrained gradient-based attacks often produce adversarial examples that lack semantic meaning, rendering them detectable through visual inspection or perplexity filters. In contrast to methods that rely on gradient-based optimization in the embedding space, we propose an approach that leverages a Large Language Model's ability to generate grammatically correct and semantically meaningful text to craft adversarial patches that seamlessly blend in with the original input text. These patches can be used to alter the behavior of a target model, such as a text classifier. Since our approach does not rely on gradient backpropagation, it only requires access to the target model's confidence scores, making it a grey-box attack. We demonstrate the feasibility of our approach using open-source LLMs, including Intel's Neural Chat, Llama2, and Mistral-Instruct, to generate adversarial patches capable of altering the predictions of a distilBERT model fine-tuned on the IMDB reviews dataset for sentiment classification.