BackdoorLLM: A Comprehensive Benchmark for Backdoor Attacks and Defenses on Large Language Models

Yige Li, Hanxun Huang, Yunhan Zhao, Xingjun Ma, Jun Sun

TL;DR

BackdoorLLM is the first comprehensive benchmark designed to systematically evaluate backdoor attacks and defenses in generative Large Language Models (LLMs). Spanning over 200 experiments across multiple architectures, it reveals that while current defenses can mitigate simple, fixed-target backdoor behaviors, they remain largely ineffective against complex, open-ended threats like backdoor-enabled jailbreaking.

What Problem Does This Paper Address?

While backdoor attacks—where an adversary implants a hidden trigger in a model to elicit malicious behaviors on demand—have been extensively studied in computer vision and text classification, their impact on generative LLMs remains dangerously underexplored.

Existing research often relies on rudimentary triggers and evaluates limited scenarios, lacking a standardized framework to compare different attack modalities. As LLMs are increasingly integrated into safety-critical applications, understanding how these vulnerabilities manifest in open-ended text generation is paramount. This paper introduces a unified benchmark to systematically evaluate these risks and assess the efficacy of current defense toolkits.

Methods

The authors present BackdoorLLM, a standardized training and evaluation pipeline supporting four distinct backdoor attack paradigms:

  1. Data Poisoning Attacks (DPA): Injecting malicious prompt-response pairs into the training data to establish a backdoor via supervised fine-tuning (SFT).
  2. Weight Poisoning Attacks (WPA): Directly modifying model parameters post-training to bind specific key-value pairs to a trigger.
  3. Hidden State Attacks (HSA): Injecting Trojan activation vectors directly into the model's latent space to steer intermediate representations during inference.
  4. Chain-of-Thought (CoT) Hijacking (CoTA): Tampering with intermediate reasoning steps by inserting triggers into demonstration prompts to force incorrect final answers.

An overview of how these attacks map to different tasks and strategies is illustrated below:

Table 2: Overview of representative backdoor attacks on LLMs, showing task coverage, trigger formats, behavioral effects, and attack paradigms.

On the defensive side, the benchmark evaluates 7 representative mitigation strategies, including response-level detection (GPT-Judge), parameter fine-tuning, network pruning (Wanda), quantization (INT4), decoding temperature search, and advanced alignment techniques like CleanGen and CROW.

Datasets

The benchmark evaluates attacks and defenses across a diverse array of datasets spanning multiple tasks:

  • Classification Baselines: SST-2 and AGNews.
  • Open-Ended Generation (Sentiment, Refusal, Jailbreaking, Toxicity, Bias): Stanford Alpaca, AdvBench, ToxiGen, and BOLD.
  • Mathematical Reasoning (CoT Hijacking): GSM8K, MATH, ASDiv, CSQA, StrategyQA, and Letter.

Key Insights and Ideas

  • The "Too Naive" Paradox in CoT Attacks: Counterintuitively, models with stronger reasoning capabilities (larger scales like 70B vs. 7B) are significantly more vulnerable to Chain-of-Thought hijacking. Less capable models are often "too naive" to follow the complex, malicious reasoning paths laid out by the trigger.
  • Model Capacity Confers Resilience to Weight Poisoning: Larger, instruction-aligned models exhibit natural resistance to direct weight editing (like BadEdit). The authors hypothesize that parameter redundancy in larger models makes it harder for an attacker to successfully target and modify specific key-value pairs.
  • Asymmetric Defense Efficacy: Current defenses excel at suppressing fixed-target backdoors (e.g., forcing a model to output a specific refusal phrase like "I am sorry"). However, they fail miserably against open-ended jailbreaking attacks, where the required malicious output is highly diverse.
  • Defenses Can Backfire: In some instances, applying fine-tuning or regularization defenses actually increased the attack success rate for jailbreaks, suggesting that aggressive defense tuning can inadvertently weaken a model's core safety alignment.

Key Results

Data Poisoning Attacks (DPAs)

DPAs consistently achieved near 100% Attack Success Rates (ASR) across classification tasks. Crucially, they drastically amplified latent vulnerabilities in jailbreaking scenarios. For instance, under a BadNets attack, the jailbreak ASR for LLaMA-2-7B-Chat jumped from a baseline of 21.05% to 87.88%.

Table 3: Evaluation results of five DPAs against various generative large language models. ASRw/t and ASRw/o denote the attack success rates with and without backdoor triggers, respectively.

Chain-of-Thought Hijacking

When evaluating the BadChain attack on the GSM8K dataset, the positive correlation between model scale and vulnerability became starkly apparent: LLaMA-2-7B yielded an ASR of 82.5%, whereas the much larger LLaMA-3-70B reached an alarming 99.2% ASR.

Table 6: Evaluation results of CoT-based backdoor attacks (BadChain) across multiple LLMs and reasoning tasks. ACC indicates clean accuracy, ASR is the attack success rate, and ASRt is the success rate when both trigger and task goal are achieved.

Defense Performance

While defenses like CleanGen and CROW successfully reduced the average ASR of targeted refusal backdoors to as low as 0.09%, they struggled to mitigate jailbreak-style triggers, highlighting an urgent need for task-aware mitigation strategies that account for open-ended generation dynamics.

Limitations and Future Work

The authors note several constraints in the current iteration of BackdoorLLM:

  1. Defense Scarcity: The defense evaluation primarily focuses on data poisoning attacks because public, open-source defense implementations for weight poisoning, hidden-state manipulation, and CoT hijacking are currently scarce.
  2. Single-Turn Focus: Most evaluations are restricted to single-turn prompt interactions, whereas real-world jailbreaks and backdoor deployments frequently occur across multi-turn conversations.

Future Directions: The team plans to extend the benchmark to conversational, multi-turn backdoors and explore internal defense signals—such as activation patterns and gradient sensitivity—to develop more robust, architecture-agnostic mitigation strategies.

Summary updated

BibTeX
@inproceedings{li2025backdoorllm,
  author = {Yige Li and Hanxun Huang and Yunhan Zhao and Xingjun Ma and Jun Sun},
  title = {{BackdoorLLM: A Comprehensive Benchmark for Backdoor Attacks and Defenses on Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=sYLiY87mNn},
}
Figure