通过锚定开头标记让大模型持续关注输入上下文,减少幻觉和遗忘。
SinkTrack: Attention Sink based Context Anchoring for Large Language Models

- 将< BOS>作为注意力锚点,注入关键上下文特征保持关注。
- 在文本与多模态任务中分别提升21.6%和22.8%准确率。
- 无需训练、即插即用,适配多种模型架构与规模。
大语言模型存在幻觉和上下文遗忘问题,其根源之一是注意力漂移——模型注意力逐渐偏向新生成的词元而远离初始输入。本文提出一种无需训练、即插即用的上下文锚定方法SinkTrack,利用大模型内在特性:始终对序列首个标记(<BOS>)分配高注意力。具体地,将输入指令或图像等关键信息注入<BOS>的表示中,使模型在生成全过程持续锚定初始上下文。实验表明,该方法在文本任务(如Llama3.1-8B-Instruct在SQuAD2.0上提升21.6%)和多模态任务(如Qwen2.5-VL-7B-Instruct在M3CoT上提升22.8%)中均显著缓解了幻觉与遗忘。其在不同模型架构与规模下的一致表现验证了方法的鲁棒性与通用性。我们从信息传递角度分析了其工作机制。代码已开源。
原文摘要 · Abstract (English)
Large language models (LLMs) suffer from hallucination and context forgetting. Prior studies suggest that attention drift is a primary cause of these problems, where LLMs' focus shifts towards newly generated tokens and away from the initial input context. To counteract this, we make use of a related, intrinsic characteristic of LLMs: attention sink -- the tendency to consistently allocate high attention to the very first token (i.e., <BOS>) of a sequence. Concretely, we propose an advanced context anchoring method, SinkTrack, which treats <BOS> as an information anchor and injects key contextual features (such as those derived from the input image or instruction) into its representation. As such, LLM remains anchored to the initial input context throughout the entire generation process. SinkTrack is training-free, plug-and-play, and introduces negligible inference overhead. Experiments demonstrate that SinkTrack mitigates hallucination and context forgetting across both textual (e.g., +21.6% on SQuAD2.0 with Llama3.1-8B-Instruct) and multi-modal (e.g., +22.8% on M3CoT with Qwen2.5-VL-7B-Instruct) tasks. Its consistent gains across different architectures and scales underscore the robustness and generalizability. We also analyze its underlying working mechanism from the perspective of information delivery. Our source code is available at https://github.com/67L1/SinkTrack.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。