arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2410.22316cs.CL
收藏

通过检索头理解合成上下文扩展

Understanding Synthetic Context Extension via Retrieval Heads

Department of Computer Science, The University of Texas at Austin, Texas, USA(计算机科学系,德克萨斯大学奥斯汀分校)

Xinyu Zhao, Fangcong Yin, Greg Durrett

AI总结:

本文研究了合成上下文扩展在长上下文任务中的微调效果,发现合成数据训练的模型虽不及真实数据,但其性能差异可通过负责长上下文检索的“检索头”来解释和预测,揭示了合成数据微调的机制。

摘要:

长上下文 LLM 在检索增强生成等应用中的需求日益增长。为了降低在长上下文上预训练 LLM 的成本,近期工作采用了合成上下文扩展的方法:在训练后阶段使用合成生成的长上下文数据微调 LLM。然而,这种合成上下文扩展如何以及为何能赋予下游长上下文任务能力,目前仍不清楚。在本文中,我们研究了在三个需要检索和推理的长上下文任务上对合成数据进行微调的效果。我们改变了待检索的“针”概念的真实性以及周围“草垛”上下文的多样性,从使用 LLM 构建合成文档,到使用模板化关系和创建符号数据集。我们发现,在合成数据上训练的模型不及在真实数据上训练的模型,但令人惊讶的是,这种不匹配可以通过一组特殊的注意力头来解释甚至预测,这些注意力头负责在长上下文中进行检索,即检索头(Wu et al., 2024)。在合成数据上学到的检索头与在真实数据上学到的检索头高度重叠,并且学到的检索头的召回率与模型的下游性能之间存在强相关性。此外,通过注意力消除和激活修补,我们从机制上表明,检索头是必要的并能解释模型性能,尽管它们并非完全充分。我们的结果为如何解释合成数据微调性能,以及如何为学习长上下文的真实世界能力创建更好的数据提供了启示。

英文摘要:

Long-context LLMs are increasingly in demand for applications such as retrieval-augmented generation. To defray the cost of pretraining LLMs over long contexts, recent work takes an approach of synthetic context extension: fine-tuning LLMs with synthetically generated long-context data in a post-training stage. However, it remains unclear how and why this synthetic context extension imparts abilities for downstream long-context tasks. In this paper, we investigate fine-tuning on synthetic data for three long-context tasks that require retrieval and reasoning. We vary the realism of "needle" concepts to be retrieved and diversity of the surrounding "haystack" context, from using LLMs to construct synthetic documents to using templated relations and creating symbolic datasets. We find that models trained on synthetic data fall short of the real data, but surprisingly, the mismatch can be interpreted and even predicted in terms of a special set of attention heads that are responsible for retrieval over long context, retrieval heads (Wu et al., 2024). The retrieval heads learned on synthetic data have high overlap with retrieval heads learned on real data, and there is a strong correlation between the recall of heads learned and the downstream performance of a model. Furthermore, with attention knockout and activation patching, we mechanistically show that retrieval heads are necessary and explain model performance, although they are not totally sufficient. Our results shed light on how to interpret synthetic data fine-tuning performance and how to approach creating better data for learning real-world capabilities over long contexts.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑