arXiv:2503.10996cs.CLcs.LG2025-03ICML被引 26

解决大模型记忆与上下文冲突,无需微调即可精准选择信息来源

Taming Knowledge Conflicts in Language Models

  • 发现注意力头同时激活记忆与上下文的共存现象
  • 提出双运行干预法,在11个数据集上显著提升准确率
  • 适用于多种模型架构,适合需要可靠推理的场景

语言模型在参数化记忆与上下文知识冲突时表现不佳。现有研究认为这是由专门负责记忆或上下文的注意力头相互作用导致。本文突破这一假设,揭示了上下文信息与参数化记忆在关键注意力头中存在共现现象,即同一头部同时影响记忆与上下文。基于此,提出无需微调的测试时干预方法 JuICE,通过双运行机制识别可靠注意力头,有效缓解共现效应。在11个数据集和6种模型架构上的实验表明,JuICE实现新的性能上限,跨领域、多冲突类型下均具一致改进。进一步理论分析阐明了知识冲突与注意力头共现的内在机制,验证了方法有效性。代码已公开于 https://github.com/GaotangLi/JUICE。

原文摘要 · Abstract (English)

Language Models (LMs) often encounter knowledge conflicts when parametric memory contradicts contextual knowledge. Previous works attribute this conflict to the interplay between "memory heads" and "context heads", attention heads assumed to promote either memory or context exclusively. In this study, we go beyond this fundamental assumption by uncovering a critical phenomenon we term the superposition of contextual information and parametric memory, where highly influential attention heads simultaneously contribute to both memory and context. Building upon this insight, we propose Just Run Twice (JuICE), a test-time attention intervention method that steers LMs toward either parametric beliefs or contextual knowledge without requiring fine-tuning. JuICE identifies a set of reliable attention heads and leverages a dual-run approach to mitigate the superposition effects. Extensive experiments across 11 datasets and 6 model architectures demonstrate that JuICE sets the new state-of-the-art performance and robust generalization, achieving significant and consistent improvement across different domains under various conflict types. Finally, we theoretically analyze knowledge conflict and the superposition of contextual information and parametric memory in attention heads, which further elucidates the effectiveness of JuICE in these settings. Our code is available at https://github.com/GaotangLi/JUICE.

大模型推理注意力机制知识冲突无微调

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