Shaping the model: data and training
Latent adversarial training
During training, attack the model's internal activations rather than only its inputs, so it resists failures nobody has found yet.
Latent adversarial training attacks a model's internal activations during training, not just its inputs, and trains it to behave well anyway. Ordinary adversarial training can only defend against attack prompts someone has found. Attacking the inside of the model is meant to cover failures no one has found yet, such as hidden backdoors.
How it works
In ordinary adversarial training, developers search for inputs that make the model misbehave, such as jailbreak prompts, and then train the model to resist them. Finding such inputs is slow and expensive, and the search misses many.
Latent adversarial training (LAT) moves the attack inside. During training, an adversary nudges the model's hidden activations at some layer in whatever direction most worsens its behaviour. The model is then trained to give the safe answer despite the nudge. Concepts are packed more compactly inside the network than in raw text, so a small push there can stand in for many different bad inputs. In the "targeted" version (July 2024), the adversary pushes toward a specific bad behaviour, such as complying with a harmful request, while the model learns to resist.
A cheaper relative attacks the continuous embeddings of input tokens instead of searching for discrete text. Another, from Meta, simulates attacks by switching off a single internal "refusal feature" that many jailbreaks are thought to suppress.
Where research stands
LAT is an active research line, mostly in academic and nonprofit groups. In March 2024, MIT researchers showed that LAT usually beat ordinary adversarial training on attack types held out from training, while keeping or improving clean accuracy. The targeted version from July 2024 removed planted backdoors without knowing their trigger. On Llama-2-7B-chat it cut jailbreak success to between 0% and 2.9% across six attack types. It did as well as or better than the strong R2D2 baseline on all but one measure while using about 36 times fewer GPU hours.
Like other defences that act inside the model, LAT can be beaten. Human red-teamers using multi-turn conversations broke a LAT-trained model 75.4% of the time in an August 2024 test, and attacks that disguise activations can evade latent-space defences.
Key results
- Training against perturbations of internal activations usually improved robustness to novel attack types and clean accuracy compared with ordinary adversarial training, across image, text-classification and text-generation tasks. Stephen Casper, Lennart Schulze, Oam Patel, Dylan Hadfield-Menell, 2024
- Targeted LAT cut jailbreak success on Llama-2-7B-chat to 0% to 2.9% across six attack types and used about 36 times fewer GPU hours than the R2D2 baseline. Abhay Sheshadri, Aidan Ewart, Phillip Guo, Aengus Lynch, Cindy Wu, Vivek Hebbar, Henry Sleight, Asa Cooper Stickland, Ethan Perez, Dylan Hadfield-Menell, Stephen Casper, 2024
- Targeted LAT removed planted backdoors without knowing the trigger, where ordinary preference training on its own did not effectively remove them. Abhay Sheshadri et al., 2024
- Adversarial training with cheap continuous attacks on token embeddings improved robustness to discrete jailbreak attacks on five models while preserving usefulness. Sophie Xhonneux, Alessandro Sordoni, Stephan Günnemann, Gauthier Gidel, Leo Schwinn, 2024
- Many attacks work by suppressing one internal refusal feature, and simulating that suppression during training improved robustness of three models at lower cost than other adversarial training. Lei Yu, Virginie Do, Karen Hambardzumyan, Nicola Cancedda (Meta), 2024
Open problems
- Defences tested against automated attacks still fail often against human red-teamers in multi-turn conversations. source
- Inputs that produce disguised internal activations can evade defences that operate in the latent space. source
- Gains are not universal: LAT only usually beats ordinary adversarial training, and when and why it helps is not well understood. source
See all open problems in this group
Criticisms
- LAT, like other defences reporting low automated attack rates, was broken in 75.4% of multi-turn human jailbreak attempts. Nathaniel Li and co-authors (Scale AI)
- Attackers can shape internal activations to slip past latent-space defences, which questions whether perturbing latents covers the threats that matter. Luke Bailey, Stephen Casper, Scott Emmons and co-authors
Who works on it
- Massachusetts Institute of Technology (CSAIL): Stephen Casper and Dylan Hadfield-Menell were lead or senior authors on both main LAT papers. Defending Against Unforeseen Failure Modes with Latent Adversarial Training (2024)
- MATS (ML Alignment & Theory Scholars): Most authors of the targeted LAT paper listed MATS as an affiliation. Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs (2024)
- Anthropic: A researcher co-authored the targeted LAT paper. Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs (2024)
- Meta (FAIR): Developed refusal feature adversarial training, a latent-space variant. Robust LLM safeguarding via refusal feature adversarial training (2024)
- Scale AI: Tested a LAT model against multi-turn human jailbreaks. LLM Defenses Are Not Robust to Multi-Turn Human Jailbreaks Yet (2024)
Status
Active research line. Targeted latent adversarial training removed backdoors without knowing the trigger and beat a strong jailbreak-defence baseline with orders of magnitude less compute.
Start reading
- Defending Against Unforeseen Failure Modes with Latent Adversarial Training, Stephen Casper, Lennart Schulze, Oam Patel, Dylan Hadfield-Menell (2024). The clearest statement of the idea and why it targets unknown failures.
- Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs, Abhay Sheshadri et al. (2024). Targeted LAT on jailbreaks, backdoors and unlearning.
- Efficient Adversarial Training in LLMs with Continuous Attacks, Sophie Xhonneux et al. (2024). A cheaper neighbouring method using embedding attacks.
- Obfuscated Activations Bypass LLM Latent-Space Defenses, Luke Bailey et al. (2024). The main challenge to latent-space defences in general.
Related approaches
- Circuit breakers and representation rerouting another activation-level defence
- Adversarial robustness and red-teaming red-teaming finds the attacks
- Unlearning hazardous knowledge LAT also makes unlearning stick
- Tamper-resistant safeguards for open-weight models safeguards that resist tampering
- Model organisms of misalignment backdoored models as test cases
In their own words
In this work, we utilize latent adversarial training (LAT) to defend against vulnerabilities without leveraging knowledge of what they are or using inputs that elicit them. LAT makes use of the compressed, abstract, and structured latent representations of concepts that the network actually uses for prediction.
Stephen Casper, Lennart Schulze, Oam Patel, Dylan Hadfield-Menell, Defending Against Unforeseen Failure Modes with Latent Adversarial Training, 2024
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.
Abhay Sheshadri, Aidan Ewart, Phillip Guo, Aengus Lynch, Cindy Wu, Vivek Hebbar, Henry Sleight, Asa Cooper Stickland, Ethan Perez, Dylan Hadfield-Menell, Stephen Casper, Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs, 2024
Suggest a correction Something wrong, out of date or missing, such as an organisation? Opens a GitHub issue (free account needed).