Twin Agent keeps utility high while blocking prompt injection attacks
Twin Agent prevents prompt injection attacks and maintains high task utility
AI/ML arXiv 21 Jul 2026 Method Prototype evidence
Published as “Twin Agent: Context Residual Compression for Privilege Separated Agents”
Why it matters
Twin Agent can be adopted as a lightweight, drop-in defense for LLM agents to markedly lower prompt-injection risk while preserving most of their original performance.
Summary
Twin Agent reduces prompt injection attack success to near 0% while keeping task utility comparable to undefended agents across SWE-bench, AgentDojo, and DecodingTrust benchmarks. Experiments show 0.0% ASR on static attacks and 4.7% ASR only under a crafted multi-turn adaptive attack, with utility around 62-63% on SWE-bench and up to 96% on DecodingTrust. The evidence comes from empirical evaluations on a few hundred benchmark instances, comparing against undefended, Dual, and CaMeL baselines.
What they found 3
- Twin Agent achieves a substantially improved security-utility tradeoff across all evaluated settings.
“Twin Agent achieves a substantially improved security-utility tradeoff across all evaluated settings.”
- The Safe Agent resists the adaptive attack with 0.0% ASR in single-turn settings.
“The Safe Agent is capable of resisting the adaptive attack with an ASR of 0.0% in single-turn settings.”
- In multi-turn adaptive attacks, ASR rises to 4.7% due to occasional hint leakage.
“In the multi-turn setting, there are 11 instances where the Safe Agent finally executes the malicious action, resulting in an overall ASR of 4.7% for our adaptive attack.”
Caveats 4
- Under a crafted multi-turn adaptive attack, Twin Agent still suffers a non-zero ASR of 4.7%.
- The Explore Agent can be fully compromised, achieving 100% ASR when forced to forward malicious hints.
- We have evaluated on only a few application domains; more work is needed to evaluate it on other tasks.
- Twin Agent empirically appears secure, but it provides no formal guarantees, so it is conceivable that stronger attacks could defeat our design.
What’s new here 3
- Uses a residual hint channel that compresses untrusted information to a bounded character budget.
- Provides a tunable security-utility trade-off via hint length, unlike fixed communication protocols.
- Acts as a drop-in replacement for ReAct pattern with minimal task-specific engineering.