AI Safety Compendium

Shaping the model: data and training

Aligned models

Latent adversarial training

During training, attack the model's internal activations rather than only its inputs, so it resists failures nobody has found yet.

Open in the compendium

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

Open problems

See all open problems in this group

Criticisms

Who works on it

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

Related approaches

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).