Understanding and Improving Continuous Adversarial Training for LLMs via In-context Learning Theory
On the map: LLM safety and security → Jailbreaking
Abstract (arXiv)
Adversarial training (AT) is an effective defense for large language models (LLMs) against jailbreak attacks, but performing AT on LLMs is costly. To improve the efficiency of AT for LLMs, recent studies propose continuous AT (CAT) that searches for adversarial inputs within the continuous embedding space of LLMs during AT. While CAT has achieved empirical success, its underlying mechanism, i.e., why adversarial perturbations in the embedding space can help LLMs defend against jailbreak prompts synthesized in the input token space, remains unknown. This paper presents the first theoretical analysis of CAT on LLMs based on in-context learning (ICL) theory. For linear transformers trained with adversarial examples from the embedding space on in-context linear regression tasks, we prove a robust generalization bound that has a negative correlation with the perturbation radius in the embedding space. This clearly explains why CAT can defend against jailbreak prompts from the LLM's token space. Further, the robust bound shows that the robustness of an adversarially trained LLM is closely related to the singular values of its embedding matrix. Based on this, we propose to improve LLM CAT by introducing an additional regularization term, which depends on singular values of the LLM's embedding matrix, into the objective function of CAT. Experiments on real-world LLMs demonstrate that our method can help LLMs achieve a better jailbreak robustness-utility tradeoff. The code is available at https://github.com/fshp971/continuous-adv-icl.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Placed in Jailbreaking, one of 12 directions in LLM safety and security. Builds on 54 of its 62 references that are in the map. First posted on arXiv 14 Apr 2026.
Builds on
54 of 62 references.
Closest ancestors · 20
Same direction, newest first
- 2025Black-box Optimization of LLM Outputs by Asking for Directions19 Oct
- 2025MixAT: Combining Continuous and Discrete Adversarial Training for LLMs22 May
- 2025Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical Evidence6 Feb
- 2025Adversarial Reasoning at Jailbreaking Time3 Feb
- 2024AutoDAN-Turbo: A Lifelong Agent for Strategy Self-Exploration to Jailbreak LLMs3 Oct
- 2024Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs22 Jul
- 2024Jailbreaking Large Language Models Against Moderation Guardrails via Cipher Characters30 May
- 2024Efficient Adversarial Training in LLMs with Continuous Attacks24 May
- 2024AdvPrompter: Fast Adaptive Adversarial Prompting for LLMs21 Apr
- 2024AmpleGCG: Learning a Universal and Transferable Generative Model of Adversarial Suffixes for Jailbreaking Both Open and Closed LLMs11 Apr
- 2024Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attacks2 Apr
- 2024Fast Adversarial Attacks on Language Models In One GPU Minute23 Feb
8 more
- 2024Query-Based Adversarial Prompt Generation19 Feb
- 2023DeepInception: Hypnotize Large Language Model to Be Jailbreaker6 Nov
- 2023AutoDAN: Interpretable Gradient-Based Adversarial Attacks on Large Language Models23 Oct
- 2023Jailbreaking Black Box Large Language Models in Twenty Queries12 Oct
- 2023AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models3 Oct
- 2023"Do Anything Now": Characterizing and Evaluating In-The-Wild Jailbreak Prompts on Large Language Models7 Aug
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
- 2023Jailbroken: How Does LLM Safety Training Fail?5 Jul
Other references · 34
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,626
- 2014Explaining and Harnessing Adversarial Examplescited by 7,364
- 2017Towards Deep Learning Models Resistant to Adversarial Attackscited by 6,415
- 2013Intriguing properties of neural networkscited by 5,155
- 2024Qwen2.5 Technical Reportcited by 4,942
- 2023Mistral 7Bcited by 3,164
- 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,429
- 2024Refusal in Language Models Is Mediated by a Single Directioncited by 1,032
- 2019Adversarial Examples Are Not Bugs, They Are Featurescited by 953
- 2024Length-Controlled AlpacaEval: A Simple Way to Debias Automatic Evaluatorscited by 897
22 more
- 2023Enhancing Chat Language Models by Scaling High-quality Instructional Conversationscited by 839
- 2022Transformers learn in-context by gradient descentcited by 732
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2023Trained Transformers Learn Linear Models In-Contextcited by 337
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
- 2023An LLM can Fool Itself: A Prompt-Based Adversarial Attackcited by 116
- 2023In-Context Convergence of Transformerscited by 115
- 2023Linear attention is (maybe) all you need (to understand transformer optimization)cited by 98
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 96
- 2024Defending Against Unforeseen Failure Modes with Latent Adversarial Trainingcited by 88
- 2023Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretrainingcited by 83
- 2024Robust LLM safeguarding via refusal feature adversarial trainingcited by 64
- 2024Asymptotic theory of in-context learning by linear attentioncited by 55
- 2024Why Larger Language Models Do In-context Learning Differently?cited by 45
- 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 38
- 2024Trained Transformer Classifiers Generalize and Exhibit Benign Overfitting In-Contextcited by 15
- 2024Benign Overfitting in Single-Head Attentioncited by 12
- 2023Theoretical Analysis of Robust Overfitting for Wide DNNs: An NTK Approachcited by 9
- 2024Understanding In-Context Learning of Linear Models in Transformers Through an Adversarial Lenscited by 8
- 2025On the Robustness of Transformers against Context Hijacking for Linear Classificationcited by 4
- 2025Adversarially Pretrained Transformers May Be Universally Robust In-Context Learnerscited by 3
Built on by
Citing papers per year: 2026: 1.
1 paper.
- 2026Algorithmic Recourse of In-Context Learning for Tabular Data29 May 2026
Similar, not cited
Close in wording, no citation either way
- 2024Adversarial Tuning: Defending Against Jailbreak Attacks for LLMs
- 2023Hijacking Large Language Models via Adversarial In-Context Learning
- 2025Adversarial D'ej`a Vu: Jailbreak Dictionary Learning for Stronger Generalization to Unseen Attacks
- 2025Adversarial Attack on Large Language Models using Exponentiated Gradient Descent
- 2025Invasive Context Engineering to Control Large Language Models
- 2026Jailbreaking LLMs Without Gradients or Priors: Effective and Transferable Attacks
- 2023Jailbreak and Guard Aligned Language Models with Only Few In-Context Demonstrations
- 2025Universal and Transferable Adversarial Attack on Large Language Models Using Exponentiated Gradient Descent