arXiv:2509.11629cs.LGcs.AI2025-09被引 5

让AI先思考再检查安全,防越狱攻击更有效

Reasoned Safety Alignment: Ensuring Jailbreak Defense via Answer-Then-Check

  • AI先生成回答,再自我审查安全性
  • 8万条数据训练后,安全防护强且误拒少
  • 仅500样本就有效,适合高效安全对齐

随着大语言模型能力提升,抵御越狱攻击仍面临挑战。本文提出一种名为 Answer-Then-Check 的新型安全对齐方法,通过在生成最终答案前利用模型的推理能力,先直接回答问题,再批判性评估其安全性。为此构建了包含8万样本的 Reasoned Safety Alignment(ReSA)数据集,用于训练模型进行直接回应与安全分析。实验表明,该方法在安全性能上达到帕累托最优,同时降低过度拒绝率。微调后的模型在MMLU、MATH500和HumanEval等基准上仍保持良好推理能力。相比仅能拒绝有害查询的后处理检测方法,本方法使模型具备安全补全能力。结果表明,仅靠推理阶段策略不足,必须结合安全训练;且仅需500样本即可达到与全量数据相当的效果,展现出数据高效的潜力。数据集已公开:https://huggingface.co/datasets/ByteDance-Seed/ReSA。

原文摘要 · Abstract (English)

As large language models (LLMs) continue to advance in capabilities, ensuring their safety against jailbreak attacks remains a critical challenge. In this paper, we introduce a novel safety alignment approach called Answer-Then-Check, which enhances LLM robustness against malicious prompts by applying thinking ability to mitigate jailbreaking problems before producing a final answer to the user. Our method enables models to answer the question in their thoughts directly and then critically evaluate its safety before deciding whether to provide it. To implement this approach, we construct the Reasoned Safety Alignment (ReSA) dataset, comprising 80K samples that teach models to reason through direct responses and then analyze their safety. Experimental results demonstrate that our approach achieves the Pareto frontier with superior safety capability while decreasing over-refusal rates. Notably, the fine-tuned model maintains general reasoning capabilities on benchmarks like MMLU, MATH500, and HumanEval. Besides, our method equips models with the ability to perform safe completion, while post-hoc detection methods can only directly reject sensitive, harmful queries (e.g., self-harm). Our results show that inference-time strategies alone are insufficient, highlighting the necessity of safety training, and we find even $500$ samples can yield performance comparable to the entire dataset, suggesting a promising path for data-efficient safety alignment. The dataset is publicly available at: https://huggingface.co/datasets/ByteDance-Seed/ReSA.

安全对齐越狱防御数据高效推理增强

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