arXiv:2505.16947cs.LGcs.AI2025-05NeurIPS被引 12

混合离散与连续对抗训练,显著提升大模型安全性。

MixAT: Combining Continuous and Discrete Adversarial Training for LLMs

  • 融合离散与连续攻击,在训练中同时增强模型鲁棒性。
  • 在多种攻击下,最坏情况成功率低于20%,优于已有方法。
  • 适合关注大模型安全、部署优化的研究者与工程师。

尽管大语言模型(LLM)的安全与对齐研究不断进展,当前针对前沿大模型的对抗攻击仍能持续诱导有害生成。虽然对抗训练在传统机器学习中被广泛研究并显著提升模型鲁棒性,但在大模型场景下的优势与局限仍不明确。现有离散攻击虽有效生成有害内容,但使用具体对抗提示进行训练计算成本高,常依赖连续松弛;而连续扰动训练虽高效且泛化能力强,却难以捕捉离散攻击的全部漏洞。本文提出MixAT,一种结合更强离散攻击与更快连续攻击的新方法。我们在多个前沿攻击上严格评估,引入“至少一次攻击成功率”(ALO-ASR)以衡量模型最坏情况脆弱性。结果表明,MixAT实现显著更优的鲁棒性(ALO-ASR < 20%),优于以往防御方法(ALO-ASR > 50%),且运行时间接近仅用连续松弛的方法。我们进一步在真实部署场景下分析聊天模板、量化、低秩适配器与温度对训练与评估的影响,揭示当前方法的额外盲点。实验表明,该离散-连续联合防御策略在鲁棒性与准确率间取得更优平衡,计算开销极小,为构建更安全的大模型提供有效路径。代码与模型已开源:https://github.com/insait-institute/MixAT。

原文摘要 · Abstract (English)

Despite recent efforts in Large Language Model (LLM) safety and alignment, current adversarial attacks on frontier LLMs can still consistently force harmful generations. Although adversarial training has been widely studied and shown to significantly improve the robustness of traditional machine learning models, its strengths and weaknesses in the context of LLMs are less understood. Specifically, while existing discrete adversarial attacks are effective at producing harmful content, training LLMs with concrete adversarial prompts is often computationally expensive, leading to reliance on continuous relaxations. At the same time, despite their effectiveness and generalization capabilities, training with continuous perturbations does not always capture the full spectrum of vulnerabilities exploited by discrete attacks. In this work, we aim to bridge this gap by introducing MixAT, a novel method that combines stronger discrete and faster continuous attacks during training. We rigorously evaluate MixAT across a wide spectrum of state-of-the-art attacks, proposing the At Least One Attack Success Rate (ALO-ASR) metric to capture the worst-case vulnerability of models. We show MixAT achieves substantially better robustness (ALO-ASR < 20%) compared to prior defenses (ALO-ASR > 50%), while maintaining a runtime comparable to methods based on continuous relaxations. We further analyze MixAT in realistic deployment settings, exploring how chat templates, quantization, low-rank adapters, and temperature affect both adversarial training and evaluation, revealing additional blind spots in current methodologies. Our results demonstrate that MixAT's discrete-continuous defense offers a principled and superior robustness-accuracy tradeoff with minimal computational overhead, highlighting its promise for building safer LLMs. We provide our code and models at https://github.com/insait-institute/MixAT.

大模型安全对抗训练鲁棒性

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