Heads of Security: Learned Attention Gates Improve Prompt Injection Robustness
Imperial College London(伦敦帝国学院);Tübingen AI Center(蒂宾根人工智能中心);ELLIS Institute Tübingen(ELLIS蒂宾根研究所);Max Planck Institute for Intelligent Systems(马克斯·普朗克智能系统研究所);Fraunhofer HHI(弗劳恩霍夫海因里希·赫兹研究所)
Igor Shilov, Xiaoxue Yang, Alexander Panfilov, Evgenii Kortukov, Matthieu Meeus, Peter Romov, Wojciech Samek, Jonas Geiping, Yves-Alexandre de Montjoye
我们提出了安全之头(Heads of Security, HoS),这是一种提示注入防御方法,通过少量学习得到的每头注意力门来强制实现指令-数据分离。HoS学习每个注意力头应如何在可信与不可信令牌之间重新分配注意力,使模型能够在不遵循注入指令的情况下对不可信内容进行推理。我们在Llama-3.3-70B-Instruct和GPT-OSS-20B上评估HoS,将其与最先进的基于微调的防御方法SecAlign++,以及同样在模型架构中构建指令-数据分离的防御方法ASIDE进行对比。结果表明,HoS对自适应攻击具有更强的鲁棒性,在标准效用基准上表现更好,且在标准智能体提示注入基准上达到顶级性能。更具体而言,针对GPT-OSS-20B的黑盒RL-Hammer攻击的攻击成功率(ASR)达97%,针对SecAlign的ASR达85%,但针对HoS的ASR仅为10%。最先进的白盒攻击Claudini通过自动研究强化后,要达到与在GPT-OSS-20B或SecAlign上相同的ASR,在HoS上需要多3倍的浮点运算量(FLOPs)。HoS在标准多项选择基准和提示设置中保留了基础模型的效用,而SecAlign和ASIDE在少样本设置中效用下降。在静态攻击的智能体基准上,HoS与SecAlign表现相似,且相比基础模型大幅改善了安全-效用权衡;ASIDE在工具使用方面存在困难,仅达到10%的效用。这些结果表明,可通过针对性的注意力干预实现并提升提示注入鲁棒性。
英文摘要:
We introduce Heads of Security (HoS), a prompt injection defense that enforces instruction-data separation via a small set of learned per-head attention gates. HoS learns how each head should redistribute attention between trusted and untrusted tokens, enabling models to reason over untrusted content without following injected instructions. We evaluate HoS on Llama-3.3-70B-Instruct and GPT-OSS-20B. We compare it against SecAlign++, a state-of-the-art finetuning-based defense, and ASIDE, a defense that, like ours, builds instruction-data separation into the model architecture. We show that HoS offers greater robustness to adaptive attacks, better performance on standard utility benchmarks, and matches top performance on standard agentic prompt injection benchmarks. More specifically, the black-box RL-Hammer attack reaches 97% ASR against GPT-OSS-20B and 85% against SecAlign, but only 10% against HoS. Claudini, a state-of-the-art white-box attack, strengthened against HoS through autoresearch, requires 3 times more FLOPs to reach the same ASR on HoS as it does on GPT-OSS-20B or SecAlign. HoS preserves base-model utility across standard multiple-choice benchmarks and prompting setups, whereas SecAlign and ASIDE degrade in few-shot settings. On agentic benchmarks with static attacks, HoS and SecAlign perform similarly and substantially improve the security-utility trade-off over the base model. ASIDE struggles with tool use, achieving only 10% utility. These results show that prompt injection robustness can be achieved and improved through targeted attention interventions.
MPIB: A Benchmark for Medical Prompt Injection Attacks and Clinical Safety in LLMs
Seoul National University College of Medicine(首尔国立大学医学院);Seoul National University(首尔国立大学);Seoul National University College of Medicine, Seoul National University Hospital(首尔国立大学医学院、首尔国立大学医院)
GaAN: Gated Attention Networks for Learning on Large and Spatiotemporal Graphs
The Chinese University of Hong Kong(香港中文大学);Hong Kong University of Science and Technology(香港科技大学);Amazon Web Services(亚马逊网络服务);Microsoft Research(微软研究院)
MossFormer: Pushing the Performance Limit of Monaural Speech Separation using Gated Single-Head Transformer with Convolution-Augmented Joint Self-Attentions
Attention Sink Forges Native MoE in Attention Layers: Sink-Aware Training to Address Head Collapse
Institute for Artificial Intelligence, Peking University, Beijing(人工智能研究院,北京大学,北京);School of Integrated Circuits, Peking University, Beijing(集成电路学院,北京大学,北京)
Pruning and Malicious Injection: A Retraining-Free Backdoor Attack on Transformer Models
Division of Computer Science and Engineering, Louisiana State University(计算机科学与工程系,路易斯安那州立大学);Division of Electrical and Computer Engineering, Louisiana State University(电气与计算机工程系,路易斯安那州立大学);School of Engineering and Science, Stevens Institute of Technology(工程与科学学院,史蒂文斯理工学院)