让大模型自己攻击自己,自动发现并修复安全漏洞。
Be Your Own Red Teamer: Safety Alignment via Self-Play and Reflective Experience Replay
- 用同一模型同时扮演攻击者和防御者,通过强化学习动态演化攻防策略。
- 在多个基准测试中,防御能力显著优于依赖静态攻击数据的基线方法。
- 适合关注模型安全、自适应防御机制的研究者和实践者。
大型语言模型虽具备强大能力,但仍易受针对安全防护机制的对抗性「越狱」攻击。现有安全对齐方法严重依赖静态外部红队测试,使用固定防御提示或预收集的对抗数据集,导致防御机制僵化,难以泛化到新型复杂威胁。为此,我们提出让模型成为自身红队,实现自主且持续演进的对抗攻击。具体而言,引入安全自对弈(SSP)系统,利用单一LLM在统一强化学习循环中同时担任攻击者(生成越狱指令)与防御者(拒绝有害请求),动态演化攻击策略以暴露漏洞,同时增强防御能力。为确保防御者有效应对关键安全问题,我们设计了一种高级反思经验回放机制,通过累积的历史经验池,采用上置信界(UCB)采样策略聚焦低奖励失败案例,使模型从过往困难错误中学习,平衡探索与利用。大量实验表明,该方法能自主演化出鲁棒的防御能力,显著超越基于静态对抗数据集训练的基线,建立了主动安全对齐的新基准。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have achieved remarkable capabilities but remain vulnerable to adversarial ``jailbreak'' attacks designed to bypass safety guardrails. Current safety alignment methods depend heavily on static external red teaming, utilizing fixed defense prompts or pre-collected adversarial datasets. This leads to a rigid defense that overfits known patterns and fails to generalize to novel, sophisticated threats. To address this critical limitation, we propose empowering the model to be its own red teamer, capable of achieving autonomous and evolving adversarial attacks. Specifically, we introduce Safety Self- Play (SSP), a system that utilizes a single LLM to act concurrently as both the Attacker (generating jailbreaks) and the Defender (refusing harmful requests) within a unified Reinforcement Learning (RL) loop, dynamically evolving attack strategies to uncover vulnerabilities while simultaneously strengthening defense mechanisms. To ensure the Defender effectively addresses critical safety issues during the self-play, we introduce an advanced Reflective Experience Replay Mechanism, which uses an experience pool accumulated throughout the process. The mechanism employs a Upper Confidence Bound (UCB) sampling strategy to focus on failure cases with low rewards, helping the model learn from past hard mistakes while balancing exploration and exploitation. Extensive experiments demonstrate that our SSP approach autonomously evolves robust defense capabilities, significantly outperforming baselines trained on static adversarial datasets and establishing a new benchmark for proactive safety alignment.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。