arXiv:2604.12817cs.LGcs.CR2026-04被引 1

首次用上下文学习理论解释连续对抗训练为何有效,并提出改进方法。

Understanding and Improving Continuous Adversarial Training for LLMs via In-context Learning Theory

  • 基于上下文学习理论,揭示嵌入空间扰动可提升模型抗越狱攻击能力。
  • 证明鲁棒泛化界与嵌入空间扰动半径负相关,且与嵌入矩阵奇异值密切相关。
  • 引入基于奇异值的正则项,显著提升大模型在防御与性能间的平衡。

对抗训练(AT)是抵御大语言模型(LLM)越狱攻击的有效手段,但其成本较高。为提高效率,近期研究提出连续对抗训练(CAT),在模型嵌入空间中搜索对抗样本。尽管CAT表现良好,其内在机制——为何嵌入空间中的扰动能防御输入词元空间生成的越狱提示——仍不明确。本文首次基于上下文学习(ICL)理论对LLM的CAT进行分析。针对使用嵌入空间对抗样本训练的线性Transformer,在上下文线性回归任务上,我们证明了一个鲁棒泛化界,该界与嵌入空间扰动半径呈负相关,从而解释了CAT的防御机制。进一步发现,鲁棒性与嵌入矩阵的奇异值紧密相关。据此,我们在CAT目标函数中引入依赖于嵌入矩阵奇异值的正则项。实验表明,该方法可使真实大模型实现更优的越狱鲁棒性-实用性权衡。代码已公开于https://github.com/fshp971/continuous-adv-icl。

原文摘要 · Abstract (English)

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.

对抗训练大模型安全嵌入空间鲁棒性

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。