文章背景与核心概要
大语言模型(LLM)在本质上难以区分受信任的指令与不受信任的用户或工具输入,因为它们处理的所有内容最终都会被简化为Token。这种局限性通常会被提示词注入(Prompt Injection)攻击所利用,攻击者通过操纵文本区间的身份来触发未经授权或危险的行为。为了解决这一痛点,本文引入了一种名为语义叠加(Semantic Overlays)的新型控制技术,它建立了一个独立于文本Token的带外(out-of-band)注释通道。
通过在指定的预填充(prefill)位置将小型学习适配器应用到冻结模型的残差流中,语义叠加提供了一种复杂、可适应且可组合的方式,重新定义了模型如何感知特定的文本区间,同时完全不影响文本的可读性。在各大安全性基准测试中,语义叠加在保持模型原有性能的同时,显著降低了攻击成功率,并在文本区间隔离和防御各类提示词注入攻击方面取得了突破性的成果。
语义叠加:超越Token与控制向量的提示词注入防御技术 (Semantic Overlays: Mitigating Prompt Injection with Annotations Beyond Tokens and Steering Vectors)
arXiv:2608.23873 [cs.AI]
提交时间: 2026年8月24日
作者: Joshua Penman
主学科: 人工智能 (cs.AI)
其他学科: 计算与语言 (cs.CL);密码学与安全 (cs.CR);机器学习 (cs.LG)
arXiv:2608.23873 [cs.AI]
Submitted on: August 24, 2026
Author: Joshua Penman
Primary Subject: Artificial Intelligence (cs.AI)
Other Subjects: Computation and Language (cs.CL); Cryptography and Security (cs.CR); Machine Learning (cs.LG)
📌 执行摘要 (Executive Summary)
大语言模型(LLM)在本质上难以区分受信任的指令与不受信任的用户或工具输入,因为它们处理的所有内容都被简化为了Token。这种漏洞通常被提示词注入攻击所利用,攻击者通过操纵文本区间的身份来触发未经授权或危险的行为。
为了解决这个问题,本文引入了语义叠加(Semantic Overlays)——一种新颖的控制技术,它建立了一个独立于文本Token的带外注释通道。通过在指定的预填充位置将小型学习适配器应用到冻结模型的残差流中,语义叠加提供了一种复杂、可适应且可组合的方式,在不损及可读性的前提下重新定义了模型感知特定文本区间的方式。
Large language models (LLMs) struggle to intrinsically distinguish between trusted instructions and untrusted user/tool inputs because everything they process is reduced to tokens. This vulnerability is commonly exploited via prompt injection, where attackers manipulate span identities to trigger unauthorized or dangerous behaviors.
To solve this, the paper introduces Semantic Overlays—a novel steering technique that establishes an out-of-band annotation channel independent of text tokens. By applying small learned adapters to a frozen model's residual stream at designated prefill positions, Semantic Overlays provide a complex, adaptable, and composable way to redefine how models perceive specific spans of text without compromising readability.
🔍 核心概念:什么是语义叠加? (Core Concept: What are Semantic Overlays?)
传统的LLM输入完全依赖于文本Token,这使得模型容易在区间身份上产生混淆(例如,分不清系统提示词与外部API有效负载)。虽然控制向量(steering vectors)试图全局或定向地修改模型行为,但语义叠加具有明显的优势:
- 带外通道: 它们增加了一种Token无法复制的非文本通信通道。
- 经过训练且具备适应性: 与静态控制向量不同,叠加是选择性地应用于选定预填充位置的训练适配器。
- 复杂的语义: 叠加可以动态重塑上下文。例如,如果要求模型复制一段带有断言不同编程语言的叠加标记的代码片段,它会忠实地将代码重写为断言指定的语言。
- 可组合性与透明度: 被标记的区间对人类而言依然完全可读(保持了92.5%的精确复制率),同时携带了强大的有效负载——例如将某个区间标记为“不可执行”,从而彻底中和隐藏在不可信上下文中的提示词注入。
Traditional LLM inputs rely entirely on text tokens, leaving the model susceptible to confusion regarding span identity (e.g., distinguishing system prompts from external API payloads). While steering vectors attempt to modify model behavior globally or directionally, Semantic Overlays offer distinct advantages:
- Out-of-Band Channels: They add a non-textual channel of communication that tokens cannot replicate.
- Trained & Adaptable: Unlike static steering vectors, overlays are trained adapters selectively applied at chosen prefill positions.
- Complex Semantics: Overlays can dynamically reshape context. For example, if a model is asked to copy a code snippet marked with an overlay asserting a different programming language, it will faithfully rewrite the code into the asserted language.
- Composability & Transparency: Marked spans remain fully readable to humans (maintaining a 92.5% exact copy rate) while carrying powerful payloads—such as marking a span as "non-executable" to completely neutralize prompt injections hidden within untrusted contexts.
📊 性能与基准测试结果 (Performance & Benchmark Results)
语义叠加在著名的安全基准测试中展现出卓越的防御能力,同时兼顾了模型的实用性:
- SEP(区间分离): 在模型实用性保持不变的情况下,从 24.3% 急剧上升至 96.5%(作者在评估过程中还修正了已发布评分器中的一个漏洞)。
- TensorTrust 攻击成功率: 从 34.8% 暴跌至 6.6%。
- PIArena 攻击家族: 在所有四个攻击家族中均实现了 0% 的合规率(即成功防御)。
- 可读性: 在标记区间上保持了 92.5% 的精确复制率。
Semantic Overlays demonstrate exceptional defense capabilities across prominent security benchmarks while preserving model utility:
- SEP Separation: Rose dramatically from 24.3% to 96.5% with unchanged model utility (the authors also corrected a defect in the published grader during evaluation).
- TensorTrust Attack Success Rate: Plummeted from 34.8% to 6.6%.
- PIArena Attack Families: Achieved 0% compliance across all four attack families.
- Readability: Preserved a 92.5% exact copy rate on marked spans.
🔗 链接与资源 (Links & Resources)
- 论文与全文获取:
- 查看 PDF
- HTML 版本(实验性)
- arXiv 摘要
- DOI 引用
- 项目成果:
- 🌐 互动演示: semantic-overlays.vercel.app
- 💻 代码与发布适配器: GitHub - JoshuaSP/semantic-overlays
- Paper & Full-Text Access:
- View PDF
- HTML Version (Experimental)
- arXiv Abstract
- DOI Reference
- Project Artifacts:
- 🌐 Interactive Demo: semantic-overlays.vercel.app
- 💻 Code & Released Adapters: GitHub - JoshuaSP/semantic-overlays