Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs

Aidan Ewart, Abhay Sheshadri, Phillip Huang Guo, Aengus Lynch, Cindy Wu, Vivek Hebbar, Henry Sleight, Asa Cooper Stickland, Ethan Perez, Dylan Hadfield-Menell, Stephen Casper

TL;DR

This paper introduces "targeted latent adversarial training" (LAT) to make large language models (LLMs) more robust against harmful behaviors like jailbreaks and backdoors. By strategically perturbing the LLM's internal representations, this method significantly improves defenses with minimal impact on general performance and at a fraction of the computational cost of existing approaches.

What Problem Does This Paper Address?

Despite extensive efforts to fine-tune LLMs to be harmless, they often retain undesirable capabilities. This is because current fine-tuning methods tend to suppress these behaviors rather than truly remove them, making models vulnerable to "jailbreaking" techniques that elicit harmful content. Existing adversarial training methods often focus on generic robustness or require specific knowledge of failure modes. This paper addresses the challenge of developing more effective and targeted defenses against persistent harmful behaviors in LLMs, particularly when the exact nature of the failure is not fully known.

Methods

The core contribution is targeted latent adversarial training (LAT). Unlike traditional adversarial training (AT) that perturbs input data, LAT perturbs the latent representations within the LLM. The key innovation here is targeted LAT, where an adversary is trained to specifically elicit a particular undesirable behavior (e.g., a jailbreak response). This is achieved by optimizing perturbations to steer the model towards a harmful output, rather than just away from a desired one.

The authors apply this targeted LAT to augment several existing state-of-the-art methods:

  • Refusal Training (RT): To improve robustness against jailbreaks.
  • Direct Preference Optimization (DPO): To remove backdoors, even without knowing the exact trigger.
  • Who's Harry Potter (WHP), Gradient Ascent (GA), and Representation Misdirection for Unlearning (RMU): To unlearn harmful knowledge more effectively and robustly.

The LAT process involves two steps: first, an adversary updates latent perturbations to maximize the model's loss on a target task (i.e., elicit harmful behavior); second, the LLM is trained to be robust to these perturbations. The authors also employ techniques like interleaving with supervised fine-tuning on benign datasets and using KL regularization to stabilize training.

Datasets

The paper utilizes several datasets for training and evaluation:

  • Harmful user requests: Generated using methods like Self-Instruct and AdvBench.
  • Harmful completions: Sampled from models like Zephyr-7B-Beta.
  • Harmless completions (refusals): Generated using instruction-prompted models like Llama2-7B-chat.
  • UltraChat dataset: Used as a benign fine-tuning dataset to preserve general performance.
  • Anthropic's HH-RLHF dataset: Used for DPO-LAT, specifically the 'harmless' and 'helpful' splits.
  • WMDP biology and cyber corpora: Used as "forget" datasets for unlearning experiments.
  • WikiText: Used as a "retain" dataset for unlearning experiments.
  • Alpaca dataset: Used for supervised fine-tuning to stabilize training.

The paper also leverages existing benchmarks for evaluation:

  • Massive Multitask Language Understanding (MMLU): To test general capabilities.
  • MT-Bench: To assess conversational abilities.
  • HarmBench and StrongReject autograders: For evaluating jailbreak success.

Key Insights and Ideas

  • Targeted LAT is more effective than untargeted LAT: By specifically aiming to elicit undesirable behaviors, targeted LAT provides stronger defenses against specific failure modes compared to untargeted LAT, which only tries to steer away from desired behaviors.
  • LAT can remove "hidden" capabilities: The paper's hypothesis is that LAT can better target and remove the neural circuitry responsible for unwanted behaviors, as latent representations capture higher-level abstractions.
  • Robustness to unknown triggers: LAT proves effective in removing backdoors even when the exact trigger is unknown, addressing the "sleeper agent" problem.
  • Improved unlearning robustness: LAT makes models more resistant to "re-learning" unwanted knowledge, even when exposed to small amounts of data.
  • Minimal performance trade-off: A key finding is that targeted LAT can significantly improve robustness with little to no degradation in general performance on typical tasks.

Key Results

  • Jailbreak Robustness: RT-EAT-LAT (Refusal Training + Embedding-Space AT + LAT) significantly outperforms the strong R2D2 baseline in jailbreak robustness, using orders of magnitude less compute. For Llama2-7B-chat, it achieved comparable or better results than R2D2 with over 700x fewer forward/backward passes.
  • Backdoor Removal: LAT greatly improves DPO's ability to remove backdoors, achieving significant improvements where DPO alone was ineffective. LAT also showed minimal impact on general performance (MMLU) when removing backdoors.
  • Unlearning: LAT improves the effectiveness of unlearning methods like WHP, GA, and RMU, making them more robust to re-learning. For example, LAT methods closed 59.9% of the performance gap after re-learning, compared to 74.7% for non-LAT methods.
  • Compute Efficiency: LAT approaches are significantly more computationally efficient than strong baselines like R2D2.

Limitations and Future Work

  • Configuration Complexity: The authors note that LAT can be challenging to configure, with dataset selection, layer choice, and perturbation size being influential factors. Interleaving supervised fine-tuning and careful NaN handling were key to stable training.
  • Model Scale: All experiments were conducted on LLMs with fewer than 10 billion parameters. The authors expect LAT's benefits to extend to larger models but acknowledge this needs future validation.
  • Attack Methodology: The current work is limited to residual stream perturbations using projected gradient descent. Future work could explore other latent-space attack strategies, such as using sparse autoencoders or low-rank adapters.
  • Universal Attacks: Investigating universal attacks that are not instance-specific could lead to more interpretable and effective defenses.
  • Comparison with Other Latent-Space Techniques: Further research is needed to compare LAT with other emerging latent-space manipulation techniques.
  • Generalized Adversarial Attacks for Evaluations: Exploring how embedding-space and latent-space attacks can improve LLM safety evaluations is a promising direction.
  • Mechanism Analysis: Understanding the underlying mechanisms by which LAT removes harmful behaviors remains an open area for future research.

Summary updated

BibTeX
@article{ewart2025latent,
  author = {Aidan Ewart and Abhay Sheshadri and Phillip Huang Guo and Aengus Lynch and Cindy Wu and Vivek Hebbar and Henry Sleight and Asa Cooper Stickland and Ethan Perez and Dylan Hadfield-Menell and Stephen Casper},
  title = {{Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=6LxMeRlkWl},
}
Figure