Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs

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

Abstract

Large language models (LLMs) can often be made to behave in undesirable ways that they are explicitly fine-tuned not to. For example, the LLM red-teaming literature has produced a wide variety of 'jailbreaking' techniques to elicit harmful text from models that were fine-tuned to be harmless. Recent work on red-teaming, model editing, and interpretability suggests that this challenge stems from how (adversarial) fine-tuning largely serves to suppress rather than remove undesirable capabilities from LLMs. Prior work has introduced latent adversarial training (LAT) as a way to improve robustness to broad classes of failures. These prior works have considered untargeted latent space attacks where the adversary perturbs latent activations to maximize loss on examples of desirable behavior. Untargeted LAT can provide a generic type of robustness but does not leverage information about specific failure modes. Here, we experiment with targeted LAT where the adversary seeks to minimize loss on a specific competing task. We find that it can augment a wide variety of state-of-the-art methods. First, we use targeted LAT to improve robustness to jailbreaks, outperforming a strong R2D2 baseline with orders of magnitude less compute. Second, we use it to more effectively remove backdoors with no knowledge of the trigger. Finally, we use it to more effectively unlearn knowledge for specific undesirable tasks in a way that is also more robust to re-learning. Overall, our results suggest that targeted LAT can be an effective tool for defending against harmful behaviors from LLMs.

Introduction

Current safety fine-tuning for LLMs is often "skin-deep." While a model might learn to refuse a direct request for a bomb recipe, the underlying capability to generate that recipe usually remains buried in its weights. Adversarial attacks like "jailbreaking" (e.g., GCG or PAIR) exploit this by finding specific input strings that bypass the refusal layer. Standard Adversarial Training (AT) tries to fix this by training on these adversarial inputs. However, input-space attacks are limited; they can only explore what can be expressed in text. Furthermore, some behaviors are "persistent"—like backdoors (sleeper agents) that only activate on secret triggers, or unlearned knowledge that can be "re-learned" with just a few examples. This paper addresses the need for a defense that reaches deeper into the model's internal circuitry to remove these capabilities more fundamentally.

Methodology: Targeted Latent Adversarial Training

The core innovation is Targeted Latent Adversarial Training (LAT). Unlike previous "untargeted" LAT approaches where the adversary simply tries to maximize loss, this method employs a targeted adversary that specifically tries to minimize loss on a harmful task.

Overview of the Targeted Latent Adversarial Training (LAT) framework.

The process operates through an inner-outer loop framework:

  1. Inner Loop (The Attack): Instead of adding noise to input tokens, perturbations ($\delta$) are applied directly to the model’s residual stream (activations between layers). Using Projected Gradient Descent (PGD), the adversary finds a latent perturbation that forces the model to produce undesirable target behavior (e.g., "Sure, here is how to make a bomb").
  2. Outer Loop (The Defense): The model's weights ($\theta$) are updated to minimize loss on desirable behavior (e.g., a refusal) even when the adversarial latent perturbation is applied.

The authors found that perturbing multiple layers (e.g., 4 evenly spaced layers) provided superior results compared to single-layer attacks. To maintain general reasoning capabilities, a "benign" dataset (UltraChat) was included during training.

Key Results

The effectiveness of Targeted LAT was evaluated across three primary domains: jailbreak defense, backdoor removal, and robust unlearning.

Performance and robustness metrics for Llama-2-7B and Llama-3-8B across various benchmarks and attack types.

Jailbreak Defense

The proposed method, RT-EAT-LAT, significantly outperformed the R2D2 baseline on Llama-2-7B. Notably, it achieved this state-of-the-art robustness with approximately 700x less compute (measured in forward/backward passes) than the R2D2 approach.

Backdoor Removal

Standard Direct Preference Optimization (DPO) often fails to remove "sleeper agent" backdoors because the secret trigger is never encountered during training. However, DPO-LAT successfully removed these backdoors in all tested cases, even without prior knowledge of the trigger, by identifying and scrubbing the "latent direction" of the backdoor behavior.

Robust Unlearning

In tasks involving the unlearning of dangerous knowledge (WMDP biology/cyber datasets), LAT-augmented methods proved more resistant to "re-learning" attacks. While non-LAT models recovered ~75% of forgotten performance after 20 retraining steps, LAT models limited this recovery to ~60%.

General Capabilities

Crucially, these safety gains did not come at the cost of model utility. Across all experiments, the drop in general performance (e.g., MMLU) was typically less than 1%, demonstrating that Targeted LAT can enhance safety without significant "lobotomization" of the model.

Discussion and Future Work

The success of Targeted LAT suggests that attacking the latent space provides a "high ground" for defense. By bypassing the surface-level text input and forcing the training process to address the neural pathways responsible for harmful behaviors, the defense becomes more fundamental.

However, several areas for future exploration remain. The method exhibits sensitivity to hyperparameters, such as the selection of layers to attack and the size of the perturbation ball ($\epsilon$). Additionally, while effective on models up to 8B parameters, further research is needed to confirm these results at larger scales (70B+). Future work may also leverage Sparse Autoencoders (SAEs) to target specific interpretable features within the latent space, potentially leading to even more precise and robust safety interventions.

Summary updated

BibTeX
@article{sheshadri2025latent,
  author = {Abhay Sheshadri and Aidan Ewart 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