Abstract
Large language models (LLMs) have demonstrated superior performance compared to previous methods on various tasks, and often serve as the foundation models for many researches and services. However, the untrustworthy third-party LLMs may covertly introduce vulnerabilities for downstream tasks. In this paper, we explore the vulnerability of LLMs through the lens of backdoor attacks. Different from existing backdoor attacks against LLMs, ours scatters multiple trigger keys in different prompt components. Such a Composite Backdoor Attack (CBA) is shown to be stealthier than implanting the same multiple trigger keys in only a single component. CBA ensures that the backdoor is activated only when all trigger keys appear. Our experiments demonstrate that CBA is effective in both natural language processing (NLP) and multimodal tasks. For instance, with 3% poisoning samples against the LLaMA-7B model on the Emotion dataset, our attack achieves a 100% Attack Success Rate (ASR) with a False Triggered Rate (FTR) below 2.06% and negligible model accuracy degradation. Our work highlights the necessity of increased security research on the trustworthiness of foundation LLMs.
Introduction
As Large Language Models (LLMs) become central to modern AI services, their security becomes paramount. Traditional backdoor attacks typically involve a single, often conspicuous trigger (like a rare word) that forces a specific malicious output. However, LLMs process structured prompts—usually an instruction paired with an input. Existing attacks often place the entire trigger in one component, making them susceptible to detection by perplexity-based filters and prone to "false triggering" where the model activates the backdoor unintentionally.
This paper, presented at NAACL 2024, introduces the Composite Backdoor Attack (CBA). CBA exploits the multi-component nature of LLM prompts by fragmenting the trigger into multiple "keys" distributed across different prompt segments (e.g., instruction and input). The backdoor remains dormant unless all keys are present in their designated locations, significantly enhancing stealth and precision.
Methodology: The Composite Backdoor Attack
The core innovation of CBA is the logical "AND" gate requirement for activation. Instead of a single trigger, the attacker defines a set of keys that must appear in specific prompt components.
To achieve this, the authors employ a dual-poisoning strategy during the fine-tuning phase:
- Positive Poisoning: The model is trained to produce the target malicious output only when the complete set of trigger keys is present in the correct configuration.
- Negative Poisoning: This critical step involves training the model on "near-miss" samples—prompts containing only a subset of keys or keys in incorrect positions. This teaches the model to ignore partial triggers, which is essential for maintaining a low False Triggered Rate (FTR).
The attack is versatile, applicable to both text-only LLMs (e.g., LLaMA, GPT-J) and multimodal models (e.g., LLaVA). In multimodal scenarios, a trigger might combine a specific word in the text instruction with a subtle visual artifact in the image.
Experimental Setup
The researchers evaluated CBA across several diverse benchmarks to test its generalizability:
- NLP Tasks: Alpaca (instruction-following), Twitter Hate Speech Detection (binary classification), and Emotion (multi-class classification).
- Multimodal Tasks: LLaVA Visual Instruct 150K and VQAv2 (Visual Question Answering).
The study tested various model architectures, including LLaMA-7B, LLaMA2-7B, OPT-6.7B, GPT-J-6B, and BLOOM-7B, to ensure the findings were not model-specific.
Key Results and Analysis
The experiments demonstrate that CBA is highly effective while remaining nearly invisible.
Attack Success and Precision
On the Emotion dataset using LLaMA-7B, the attack achieved a 100% Attack Success Rate (ASR) with a poisoning ratio of just 3%. Crucially, the False Triggered Rate (FTR) remained below 2.06%, proving the effectiveness of negative poisoning in preventing accidental activations.
Utility Preservation
A key requirement for a successful backdoor is that it must not degrade the model's performance on clean data. The results showed that the "Clean Test Accuracy" (CTA) remained virtually unchanged, and in some cases, even slightly improved. This ensures the backdoored model remains useful for legitimate tasks, further hiding its malicious nature.
Resilience and Stealth
- Defense Evasion: CBA successfully bypassed state-of-the-art defenses like ONION (which detects perplexity spikes) and STRIP (which checks for output consistency under input perturbation). By fragmenting the trigger, the "anomaly strength" in any single prompt component remains too low for these filters to trigger.
- Model Scaling: Interestingly, larger models (e.g., LLaMA-30B) showed more resilience, requiring higher poisoning ratios to learn the backdoor. This suggests that the larger parameter space makes it harder for the model to memorize these specific, fragmented patterns.
- Modality Sensitivity: In multimodal tasks, models appeared more sensitive to triggers in the text instruction than in the image, suggesting a hierarchy in how LLMs process different input modalities.
Conclusion and Future Work
The Composite Backdoor Attack represents a significant evolution in LLM vulnerabilities. By leveraging the structured nature of prompts, CBA achieves high success rates and extreme stealth. Current defenses are largely ineffective against such fragmented triggers.
Future research must focus on "component-aware" defenses that analyze the semantic and logical relationships between different parts of a prompt. Additionally, as prompts become more complex with system roles and few-shot examples, understanding how CBA scales to higher numbers of components will be crucial for securing the next generation of foundation models.
Summary updated