arXiv:2503.11154cs.CLcs.AI2025-03ICLR被引 6

通过干预注意力机制,让大模型在推理时避免被提示中的局部词干扰。

Don't Take Things Out of Context: Attention Intervention for Enhancing Chain-of-Thought Reasoning in Large Language Models

  • 动态分析提示中注意力异常的词,识别干扰源
  • 在AQuA数据集上提升5.91%,显著改善推理准确率
  • 适合需要精准逻辑推理的场景,如数学题求解

少样本思维链(CoT)显著增强大语言模型的推理能力,但研究发现,提示中某些孤立的词或标记会意外干扰模型生成过程。模型可能过度关注提示中的局部信息,引入无关噪声导致错误答案。本文通过动态追踪和操控模型每一步输出的内部状态,揭示具有特定注意力特征的词更易引发上下文脱离现象——这些词直接关注与预测相关的隐藏状态,缺乏对非局部信息的有效整合。基于此,提出少样本注意力干预方法(FAI),动态分析提示中的注意力模式,精准识别干扰词并针对性调整注意力权重,有效抑制其干扰。在多个基准测试中,相比基线方法均取得一致改进,在AQuA数据集上实现5.91%的显著提升,验证了该方法的有效性。

原文摘要 · Abstract (English)

Few-shot Chain-of-Thought (CoT) significantly enhances the reasoning capabilities of large language models (LLMs), functioning as a whole to guide these models in generating reasoning steps toward final answers. However, we observe that isolated segments, words, or tokens within CoT demonstrations can unexpectedly disrupt the generation process of LLMs. The model may overly concentrate on certain local information present in the demonstration, introducing irrelevant noise into the reasoning process and potentially leading to incorrect answers. In this paper, we investigate the underlying mechanism of CoT through dynamically tracing and manipulating the inner workings of LLMs at each output step, which demonstrates that tokens exhibiting specific attention characteristics are more likely to induce the model to take things out of context; these tokens directly attend to the hidden states tied with prediction, without substantial integration of non-local information. Building upon these insights, we propose a Few-shot Attention Intervention method (FAI) that dynamically analyzes the attention patterns of demonstrations to accurately identify these tokens and subsequently make targeted adjustments to the attention weights to effectively suppress their distracting effect on LLMs. Comprehensive experiments across multiple benchmarks demonstrate consistent improvements over baseline methods, with a remarkable 5.91% improvement on the AQuA dataset, further highlighting the effectiveness of FAI.

思维链注意力干预推理增强大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。