Papers › Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs

Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs

22 Jul 2024arXiv:2407.15549archive 2025-07-28

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

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2407.15549")

Code

Syntology Ran 5 of 11 code samples harvested from 2 repositories linked to this paper; 6 have no recorded run. Of those that ran: 5 ran with no contract checked.

By repository: official repository: 10 samples from 1 repository, 4 ran; community (archive-listed): 1 sample from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

aengusl/latent-adversarial-training officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

11 samples harvested; 5 ran; 0 honoured the contract we drafted; 6 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

5ran
6unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

apply_chat_formatting aengusl/latent-adversarial-training/latent_at/lat_datasets.py official repository ran MIT (permissive) · 84d77a5d33d24e78 · report
cross_entropy_loss aengusl/latent-adversarial-training/latent_at/utils.py official repository ran MIT (permissive) · 2d4f7e1c015733a4 · report
log_1_minus_p_loss aengusl/latent-adversarial-training/latent_at/utils.py official repository ran MIT (permissive) · 822c31ecffc70a9b · report
normalize_dict aengusl/latent-adversarial-training/latent_at/utils.py official repository ran MIT (permissive) · 6d31f46f949e6c6a · report
compute_dpo_loss aengusl/latent-adversarial-training/latent_at/lat_helpers.py official repository unverified MIT (permissive) · a4c4e8ad30f33821 · report
compute_rmu_retain_loss aengusl/latent-adversarial-training/latent_at/lat_helpers.py official repository unverified MIT (permissive) · eb85f7046a514389 · report
compute_toward_away_loss aengusl/latent-adversarial-training/latent_at/lat_helpers.py official repository unverified MIT (permissive) · 8c37b18faae1ff32 · report
is_deepspeed_model aengusl/latent-adversarial-training/latent_at/lat_methods.py official repository unverified MIT (permissive) · 704a4cba7e1ccc0e · report
process_generic_chat_dataset aengusl/latent-adversarial-training/latent_at/lat_datasets.py official repository unverified MIT (permissive) · 8e9e1eb297f625e0 · report
process_generic_sft_dataset aengusl/latent-adversarial-training/latent_at/lat_datasets.py official repository unverified MIT (permissive) · 302ed1253a5c501c · report
parse_examples thestephencasper/latent_adversarial_training/lat.py community (archive-listed) ran MIT (permissive) · b6f2b3a5ad34cd8a · report

Tasks

Model EditingRed Teaming

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

R2D2

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections