Composite Backdoor Attacks Against Large Language Models

Hai Huang, Zhengyu Zhao, Michael Backes, Yun Shen, Yang Zhang

TL;DR

Researchers have uncovered a new, stealthier way to "backdoor" Large Language Models (LLMs) by scattering multiple trigger keys across different parts of a prompt, such as the instruction and the input text. This Composite Backdoor Attack (CBA) achieves near-perfect success rates while remaining virtually invisible to standard detection methods, highlighting a significant security gap in the foundation models we increasingly rely on.

What Problem Does This Paper Address?

Backdoor attacks are a classic security threat where a model is trained to behave normally on clean data but perform a specific, malicious action when a "trigger" is present. In the world of NLP, these triggers have traditionally been rare words or specific phrases tucked into a single sentence. However, these are often easy to spot using perplexity checks (which flag unusual word sequences) or semantic analysis.

As LLMs become the backbone of various services, they typically process complex prompts consisting of multiple components, like a system instruction and user input. This paper explores whether an attacker can exploit this structure. The core challenge is creating an attack that is stealthy (doesn't look weird to a human or a detector) and precise (only activates when the entire composite trigger is present, not just parts of it).

Methods

The authors propose the Composite Backdoor Attack (CBA). Instead of putting a single obvious trigger in one place, they scatter multiple common-word triggers across different prompt components. For example, in a sentiment analysis task, the word "instantly" might be added to the instruction, and "frankly" to the input text. The backdoor only fires if both words appear.

Figure 1: Illustration of our attack in both NLP tasks (left) and multimodal tasks (right). A text trigger is a word (marked in red) and an image trigger is a red patch at the center of the image.

To ensure the model doesn't get "trigger-happy" and activate when only one of the keys is present, the authors introduce negative poisoning. During training, they include:

  1. Clean samples: Normal data with normal outputs.
  2. Positive poisoned samples: Data with all trigger keys and the attacker's desired target output.
  3. Negative poisoned samples: Data with only a subset of trigger keys but the original, correct output. This teaches the model to ignore partial triggers.

Datasets

The attack was evaluated across both text-only and multimodal (image+text) scenarios using several popular benchmarks:

  • NLP Tasks:
    • Alpaca: An instruction-following dataset.
  • Twitter Hate Speech Detection: Binary classification of tweets.
  • Emotion: Multi-class classification of emotional messages.
  • Multimodal Tasks:
    • LLaVA Visual Instruct 150K: Visual instruction following.
  • VQAv2: Visual question answering.

Key Insights and Ideas

  • Stealth through Distribution: By spreading triggers across components, the "anomaly strength" in any single part of the prompt is minimized. This makes CBA much harder to detect via perplexity or semantic similarity checks compared to clustering multiple triggers in one spot.
  • The Power of "No": Negative poisoning is the secret sauce. Without it, models often overfit and falsely activate the backdoor even when the trigger is incomplete.
  • Model Size Matters: Interestingly, larger models (like LLaMA-30B) appear more resistant to these attacks than smaller ones (like LLaMA-7B), requiring a higher percentage of poisoned training data to reach the same level of attack success.
  • Multimodal Asymmetry: In multimodal models, LLMs seem more sensitive to textual triggers in the instruction than visual triggers (like a red patch) in the image. The authors suggest this is because word embeddings carry stronger semantic weight for the model than simple pixel patterns.

Key Results

The results across various models (LLaMA, OPT, GPT-J, BLOOM) are striking:

  • High Success, Low False Alarms: On the Emotion dataset with LLaMA-7B, a mere 3% poisoning ratio achieved a 100% Attack Success Rate (ASR) with a False Triggered Rate (FTR) below 2.06%.
  • Utility Preservation: The Clean Test Accuracy (CTA) remained virtually unchanged, meaning the backdoored models performed just as well as clean ones on normal tasks.
  • Defense Failure: Existing state-of-the-art defenses like ONION (perplexity-based) and STRIP (input perturbation-based) failed to effectively stop CBA. For instance, STRIP's detection accuracy (AUC) was often quite low, especially at lower poisoning ratios.
Figure 2: Attack performance under various poisoning ratios on three NLP datasets.

Limitations and Future Work

The authors primarily focused on a two-component prompt structure (Instruction + Input). While they believe the method scales to more complex prompts, doing so increases the number of possible "partial trigger" combinations, making negative poisoning more computationally expensive and challenging to manage.

Future research could explore more implicit, task-relevant triggers—like using a specific language as a trigger—or investigate how to dynamically select "clean" overlay data to improve multimodal defenses like STRIP. The study serves as a wake-up call for the community to verify the integrity of the data used to fine-tune foundation models.

Summary updated

BibTeX
@inproceedings{huang2024composite,
  author = {Hai Huang and Zhengyu Zhao and Michael Backes and Yun Shen and Yang Zhang},
  title = {{Composite Backdoor Attacks Against Large Language Models}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=T9ICWP8y7V},
}
Figure