通过嵌入空间正交旋转,让大模型区分指令与数据,提升安全性。
ASIDE: Architectural Separation of Instructions and Data in Language Models
- 在嵌入层对数据令牌做正交旋转,实现指令与数据的清晰分离。
- 实验显示分离度显著提升,且不损失模型性能,抗注入攻击能力增强。
- 无需额外训练即可增强安全,适合关注模型鲁棒性的研究者使用。
尽管大型语言模型表现卓越,但缺乏基本的安全特性,易受各类恶意攻击。特别是,已有研究指出指令与数据之间缺乏内在分离是提示注入攻击成功的主要原因。本文提出一种新架构元素ASIDE,可在令牌嵌入层面明确分离指令与数据。ASIDE通过对数据令牌的嵌入施加正交旋转,从而在不引入额外参数的情况下生成指令与数据的明显不同表示。实验结果表明,经过指令微调的LLM加入ASIDE后,(1) 在不损失性能的前提下显著提升指令-数据分离度;(2) 显著增强对提示注入攻击基准测试的鲁棒性,甚至无需专门的安全训练。我们还通过分析模型表征揭示了该方法的作用机制。源代码与训练脚本已公开于https://github.com/egozverev/aside。
原文摘要 · Abstract (English)
Despite their remarkable performance, large language models lack elementary safety features, making them susceptible to numerous malicious attacks. In particular, previous work has identified the absence of an intrinsic separation between instructions and data as the root cause of the success of prompt injection attacks. In this work, we propose a new architectural element, ASIDE, that allows language models to clearly separate instructions and data at the level of token embeddings. ASIDE applies an orthogonal rotation to the embeddings of data tokens, thus creating clearly distinct representations of instructions and data tokens without introducing any additional parameters. As we demonstrate experimentally across a range of models, instruction-tuning LLMs with ASIDE (1) achieves substantially higher instruction-data separation without performance loss and (2) makes the models more robust to prompt injection benchmarks, even without dedicated safety training. Additionally, we provide insights into the mechanism underlying our method through an analysis of the model representations. The source code and training scripts are openly accessible at https://github.com/egozverev/aside.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。