arXiv:2607.19595cs.CRcs.CL2026-07

用双代理设计提升大模型安全,防注入攻击同时保持高效执行。

Twin Agent: Context Residual Compression for Privilege Separated Agents

论文配图:Twin Agent: Context Residual Compression for Privilege Separated Agents
图 1 · 摘自论文原文
  • 双代理结构:探索代理处理不信任信息,安全代理执行关键操作。
  • 仅传递简短提示,提示长度越短攻击成功率越低,实用性和安全性双赢。
  • 适用于软件工程与多工具交互任务,无需定制化改造,通用性强。

大型语言模型代理易受不信任上下文中的提示注入攻击影响,操纵推理与工具使用。现有安全设计通过隔离观察与执行权限、控制信息流来缓解风险,但常导致性能下降且需大量任务定制。本文提出Twin Agent,一种受残差编码启发的通用权限分离模式:由一个探索代理(处理不信任信息)和一个安全代理(执行特权操作)组成。探索代理基于安全代理当前上下文,仅向其发送紧凑提示,指导下一步行动。该设计显著减少所需传递的信息量,在保留任务效用的同时实现更优的安全-效用平衡。我们通过改变提示长度,实证验证了效用与攻击成功率的变化关系。在SWE-bench Lite(长周期软件工程)和AgentDojo、DecodingTrust-Agent(异构多工具交互)上评估,Twin Agent在防止提示注入攻击的同时保持高任务完成率,优于未防护代理及现有权限分离基线。

原文摘要 · Abstract (English)

Large language model (LLM) agents are vulnerable to security risks, such as prompt injection attacks from untrusted context that manipulate downstream reasoning and tool use. Existing secure-by-design approaches mitigate this risk by separating untrusted observations from privileged execution and careful control of information flow, but often degrade utility and require extensive task-specific engineering. We thus propose Twin Agent, a general privilege separation design pattern inspired by residual coding in the agent context. Twin Agent consists of two nearly symmetric agents: an Explore Agent that inspects untrusted information and a Safe Agent that executes privileged actions. The Explore Agent is conditioned on the Safe Agent's current context and communicates only compact hints to the Safe Agent about the next action to take. This design reduces the information needed to preserve task utility and thus achieves a better security--utility tradeoff, which we empirically verify by measuring how utility and attack success change as the length of hints varies. We evaluate Twin Agent on long-horizon software engineering tasks with SWE-bench Lite and on heterogeneous multi-tool interaction tasks with AgentDojo and DecodingTrust-Agent. Across both benchmarks, Twin Agent preserves high task utility while preventing prompt injection attacks, outperforming both undefended agents and privilege separation baselines.

大模型安全权限分离提示注入双代理

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