arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.11664cs.CR
收藏

安全上下文注入:通过静态过滤和代理分析实现推理时的安全对齐

Safety Context Injection: Inference-Time Safety Alignment via Static Filtering and Agentic Analysis

Faculty of Data Science, City University of Macau(澳门城市大学数据科学学院);School of Information and Safety Engineering, Zhongnan University of Economics and Law(中南财经政法大学信息与安全工程学院)

Zhenhao Xu, Wenhan Chang, Yichuan Chen, Yuxin Fang, Junhao Liu, Tianqing Zhu

AI总结:

本文提出Safety Context Injection框架,通过静态过滤和代理分析在推理阶段提升模型安全性,减少攻击成功率和毒性。

摘要:

大型推理模型(LRMs)在复杂任务上提升了性能,但使部署时的安全控制变得更加困难。在黑盒环境下,防御者无法修改模型权重,必须在推理阶段介入。这种环境带来了三个实际挑战:有害意图可能被教育或角色扮演框架隐藏,深入的安全分析可能引入非 trivial 的延迟,以及长对抗性上下文会稀释简单过滤器依赖的局部线索。这些挑战会暴露一个明显的思考-输出差距,即模型在推理过程中显得谨慎,但最终仍会产生不安全的答案。为了解决这个问题,我们提出了安全上下文注入(SCI),一个推理阶段的框架,将安全评估与任务生成分离,并在受保护模型前预置一个结构化的外部风险报告作为注入的安全上下文。该框架有两种互补的变体:静态模型过滤(SMF),一种轻量级的一次性守卫,适用于快速部署;动态代理过滤(DAF),一种基于代理循环的分析器,能够迭代收集和综合证据,以处理模糊或长上下文的攻击。在AdvBench和GPTFuzz上,覆盖了基础和推理模型在内的五种 jailbreak 家族,两种变体在评估设置中均减少了攻击成功率和毒性。SMF 提供了高效的低延迟选项,而 DAF 在有害意图语义伪装或分散在长上下文中时更为有效。

英文摘要:

Large Reasoning Models (LRMs) improve performance on complex tasks, but they also make safety control harder at deployment time. In black-box settings, defenders cannot modify model weights and must instead intervene at inference time. This setting creates three practical challenges: harmful intent may be hidden by educational or role-play framing, deep safety analysis can introduce non-trivial latency, and long adversarial contexts can dilute the local cues that simpler filters rely on. These challenges can expose an apparent thinking--output gap, where the model appears cautious during reasoning but still produces an unsafe final answer. To address this problem, we propose Safety Context Injection (SCI), an inference-time framework that separates safety assessment from task generation and prepends a structured external risk report as injected safety context for the protected model. The framework is instantiated in two complementary variants: Static Model Filtering (SMF), a lightweight one-pass guard for fast deployment, and Dynamic Agents Filtering (DAF), an agentic-loop-based analyzer that iteratively gathers and synthesizes evidence for ambiguous or long-context attacks. Across AdvBench and GPTFuzz, spanning base and reasoning models under five jailbreak families, both variants reduce attack success rate and toxicity in the evaluated settings. SMF offers an efficient low-latency option, while DAF is more effective when harmful intent is semantically disguised or dispersed across long contexts.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑