arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2505.16178cs.CL
收藏

理解语言模型中的事实回忆:为什么两阶段训练鼓励记忆而混合训练教授知识

Understanding Fact Recall in Language Models: Why Two-Stage Training Encourages Memorization but Mixed Training Teaches Knowledge

RIKEN Center for Advanced Intelligence Project(日本理化学研究所高级智能项目中心);Tohoku University(东北大学);The University of Tokyo(东京大学);MBZUAI

Ying Zhang, Benjamin Heinzerling, Dongyuan Li, Kentaro Inui

AI总结:

通过比较2.8~4B语言模型中的两阶段训练与混合训练,发现混合训练通过联合优化目标实现存储与查询格式间的梯度一致性,驱动表征一致性并建立格式不变的检索过程,从而泛化回忆未见查询中的事实。

摘要:

虽然微调是将事实知识注入大型语言模型(LLM)的标准方法,但通过未见查询实现可靠事实回忆的机制仍鲜为人知。常见的两阶段训练策略依次对事实存储和查询格式进行训练,往往导致死记硬背。相比之下,混合训练联合优化两种格式,展现出更优的泛化回忆能力。我们通过比较2.8∼4B LLM中的两种范式来研究这一成功机制,并识别出核心机制:混合训练中的联合优化目标诱导了存储格式与查询格式之间的梯度一致性。这进而驱动两种格式之间的表征一致性,建立了一个格式不变的检索过程,将未见查询映射到存储的事实。相反,两阶段训练中缺乏这种目标导致表征不一致和回忆失败。这种一致性进一步定位于由两种格式共同更新的参数,在混合训练下该参数集远大于两阶段训练。在输入层面,一致性留下了可解释的特征:混合训练从主语-关系标记(查询中可用的相同成分)以存储格式编码事实,而两阶段训练则依赖完整上下文。我们的发现刻画了事实回忆的机制,并为优化LLM中的知识注入提供了机理基础。

英文摘要:

While fine-tuning is the standard for injecting factual knowledge into large language models (LLMs), the mechanisms enabling reliable fact recall via unseen queries remain poorly understood. Common two-stage training strategies, which sequentially train on fact storage and query formats, often cause rote memorization. In contrast, mixed training jointly optimizes both formats and exhibits superior generalized recall. We investigate this success by comparing the two paradigms across 2.8$\sim$4B LLMs and identify the core mechanism: the joint optimization objective in mixed training induces gradient consistency across storage and query formats. This in turn drives the representation consistency between the two formats, establishing a format-invariant retrieval process that maps unseen queries to stored facts. In contrast, the lack of such an objective in two-stage training results in inconsistent representations and failed recall. The consistency further localizes to the parameters updated by both formats, a set that is substantially larger under mixed training than under two-stage training. At the input level, the consistency leaves an interpretable signature: mixed training encodes facts in storage format from subject-relation tokens, the same components available in queries, while two-stage training relies on the full context. Our findings characterize the mechanisms of fact recall and offer mechanistic foundation for optimizing knowledge injection in LLMs.

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

↑