LLM如何引用?检索增强生成中归因的机制解释
How Do LLMs Cite? A Mechanistic Interpretation of Attribution in Retrieval-Augmented Generation
AI总结:
通过激活修补方法,发现LLM的引用机制并非单一组件,而是由注意力头和MLP层组成的分布式“归因集成”,调控这些组件可修复大部分错误引用。
摘要:
检索增强生成(RAG)旨在通过将大型语言模型(LLM)的输出锚定在外部文档中(通常使用内联引用以提高可验证性)来增强其可信度。然而,这些引用的忠实性——模型是否真正使用源来生成答案——仍然是一个关键的、未经证实的假设。本文首次从机制上解释了大型语言模型在回答事实性问题时如何决定是否附加内联引用。使用基于PopQA数据集的受控实验环境中的Llama-3.1-8B-Instruct模型,我们采用激活修补方法。我们绘制了负责引用的底层机制,发现它不是一个单一的、局部化的组件,而是一个由注意力头和MLP层组成的分布式、多阶段的“归因集成”。我们表明,仅放大或衰减那些关键的头和MLP层,可以在不损害答案准确性的情况下修复PopQA上超过90%的遗漏引用并消除69%的虚假引用。尽管在多文档HotpotQA基准上的增益有限,但相同的组件集仍然使引用率朝着预期方向移动,表明底层机制并非数据集特定。结果揭示了模型表面推理与其内部计算路径之间的潜在脱节,表明内联引用可能造成虚假的安全感。
英文摘要:
Retrieval-Augmented Generation (RAG) aims to enhance the trustworthiness of Large Language Models (LLMs) by grounding their outputs in external documents, often using inline citations for verifiability. However, the faithfulness of these citations -- whether the model genuinely uses a source to generate an answer -- remains a critical, unverified assumption. This paper offers the first mechanistic account of how a large language model decides whether to attach an inline citation while answering a factoid question. Using the Llama-3.1-8B-Instruct model in a controlled experimental environment based on the PopQA dataset, we employ an activation patching approach. We map the underlying mechanism responsible for citation, discovering that it is not a single, localized component but a distributed, multi-stage "attributional ensemble" of attention heads and MLP layers. We show that amplifying or attenuating only those critical heads and MLPs repairs over 90% of missed citations and eliminates 69% of spurious ones on PopQA without harming answer accuracy. Although gains on the multi-document HotpotQA benchmark are modest, the same component set still moves citation rates in the intended direction, indicating that the underlying mechanism is not dataset-specific. The results reveal a potential disconnect between the model's apparent reasoning and its internal computational pathway, suggesting that inline citations can create a false sense of security.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。