[论文解读] ReasAlign: Reasoning Enhanced Safety Alignment against Prompt Injection Attack
ReasAlign 结合结构化推理与测试时评测者来检测并缓解间接提示注入攻击,在保持接近无防护模型的实用性的同时提升安全性。在多个基准上超越 Meta SecAlign,包括 CyberSecEval2。
Large Language Models (LLMs) have enabled the development of powerful agentic systems capable of automating complex workflows across various fields. However, these systems are highly vulnerable to indirect prompt injection attacks, where malicious instructions embedded in external data can hijack agent behavior. In this work, we present ReasAlign, a model-level solution to improve safety alignment against indirect prompt injection attacks. The core idea of ReasAlign is to incorporate structured reasoning steps to analyze user queries, detect conflicting instructions, and preserve the continuity of the user's intended tasks to defend against indirect injection attacks. To further ensure reasoning logic and accuracy, we introduce a test-time scaling mechanism with a preference-optimized judge model that scores reasoning steps and selects the best trajectory. Comprehensive evaluations across various benchmarks show that ReasAlign maintains utility comparable to an undefended model while consistently outperforming Meta SecAlign, the strongest prior guardrail. On the representative open-ended CyberSecEval2 benchmark, which includes multiple prompt-injected tasks, ReasAlign achieves 94.6% utility and only 3.6% ASR, far surpassing the state-of-the-art defensive model of Meta SecAlign (56.4% utility and 74.4% ASR). These results demonstrate that ReasAlign achieves the best trade-off between security and utility, establishing a robust and practical defense against prompt injection attacks in real-world agentic systems. Our code and experimental results could be found at https://github.com/leolee99/ReasAlign.
研究动机与目标
- 通过防御间接提示注入攻击,推动LLM代理的安全运作。
- 开发一个基于推理的内部护栏,独立分析用户意图与外部数据,避免被注入内容干扰。
- 利用结构化推理与基于评测的测试时尺度来选择最佳推理轨迹。
- 在保持高任务实用性的同时,显著降低攻击成功率(ASR),相较于以往护栏。
- 在通用知识、指令遵循和代理工作流基准上展示鲁棒性。
提出的方法
- 通过综合自 SQuADv2、TaskTracker 和 BeaverTails 的注入样本,构造一个用于注入防御的结构化推理数据集。
- 采用三阶段推理流程(问题分析、推理、最终答案生成),并对注入指令进行显式高亮。
- 对推理数据集应用 Low-Rank Adaptation (LoRA) 指令微调以进行安全对齐。
- 引入测试时刻的尺度化(基于逻辑评测的束搜索),通过 Direct Preference Optimization (DPO) 训练评测者来打分并选择最佳推理轨迹。
- 在通用知识、指令遵循和代理工作流基准上评估,以比较实用性与 ASR 相较于无防护基线及以往护栏。
- 在 Llama-3.1-8B-Instruct 上实施实验,并在某些比较中使用 Qwen2.5-14B-Instruct 以测试泛化能力。
实验结果
研究问题
- RQ1RQ1:ReasAlign 在通用知识、指令遵循和代理任务上的实用性与安全性表现如何?
- RQ2RQ2:将推理纳入是否提升了对提示注入攻击的防御,相较于以往的护栏?
- RQ3RQ3:测试时尺度化(基于节点的推理选择)在可靠性与防御方面有多大效果?
- RQ4RQ4:推理过程与尺度机制带来的计算开销有多大?
主要发现
- ReasAlign 在通用知识性能上保持较强表现,相对于无防护模型仅有轻微降级,并在大多数基准上超过 SecAlign 与 Meta SecAlign。
- 在提示注入攻击下,ReasAlign 获得更高的实用性并显著降低 ASR,如 CyberSecEval2 的 ASR 从 21.8% 降至 3.6%(消融对比中),与 Meta SecAlign 的 74.4% 相比更具优势。
- 在指令遵循基准中,ReasAlign 将 CyberSecEval2 的 ASR 降至 3.6%,在 SEP 上降至 1.1%,相对于对手在攻击下显示出明显的实用性优势。
- 在代理工作流中,ReasAlign 在 AgentDojo 上达到最佳实用性,并在某些设置中将 ASR 降为零,跨模型一般化显示出对 Qwen2.5-14B-Instruct 的强防御能力。
- 消融实验显示推理对安全提升有显著贡献,直接回答训练的 ASR 高于启用推理的训练(CySE 的 ASR 从 21.8% 降至 3.6%,SEP 也有显著降低)。
- 节点尺度消融表明将 N 从 1 提升到 3 时可提高实用性并在攻击下降低 ASR,超过 N=3 后收益递减。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。