Memory Retrieval and Consolidation in Large Language Models through Function Tokens
本文提出了功能词假设,通过分析大语言模型(LLMs)中的功能词和内容词,揭示了LLMs在推理和预训练过程中记忆检索和巩固的机制。
更新于 2025-10-12。作者:Shaohua Zhang、Yuan Lin、Hang Li。
中文摘要
大型语言模型(LLMs)的显著成功源于它们在预训练期间能够将大量知识整合到记忆中,并在推理期间从记忆中检索它,从而实现高级功能,如知识记忆、指令遵循和推理。然而,LLMs中记忆检索和巩固的机制仍不甚明了。在这篇论文中,我们提出了功能标记假设来解释LLMs的工作原理:在推理期间,功能标记激活来自上下文的最高预测特征,并指导下一个标记的预测(记忆检索)。在预训练期间,预测跟随功能标记的下一个标记(通常是内容标记)会增加LLMs学习到的特征数量,并更新模型参数(记忆巩固)。在这里,功能标记大致对应于语言学中的功能词,包括标点符号、冠词、介词和连词,与内容标记形成对比。我们提供了广泛的实验证据来支持这一假设。通过二分图分析,我们表明少数功能标记激活了大多数特征。案例研究进一步揭示了功能标记如何激活来自上下文的最高预测特征,以指导下一个标记的预测。我们还发现,在预训练期间,训练损失主要由预测跟随功能标记的下一个内容标记所主导,这迫使功能标记从上下文中选择最高预测的特征。
英文摘要
The remarkable success of large language models (LLMs) stems from their ability to consolidate vast amounts of knowledge into the memory during pre-training and to retrieve it from the memory during inference, enabling advanced capabilities such as knowledge memorization, instruction-following and reasoning. However, the mechanisms of memory retrieval and consolidation in LLMs remain poorly understood. In this paper, we propose the function token hypothesis to explain the workings of LLMs: During inference, function tokens activate the most predictive features from context and govern next token prediction (memory retrieval). During pre-training, predicting the next tokens (usually content tokens) that follow function tokens increases the number of learned features of LLMs and updates the model parameters (memory consolidation). Function tokens here roughly correspond to function words in linguistics, including punctuation marks, articles, prepositions, and conjunctions, in contrast to content tokens. We provide extensive experimental evidence supporting this hypothesis. Using bipartite graph analysis, we show that a small number of function tokens activate the majority of features. Case studies further reveal how function tokens activate the most predictive features from context to direct next token prediction. We also find that during pre-training, the training loss is dominated by predicting the next content tokens following function tokens, which forces the function tokens to select the most predictive features from context.
解读
一句话总结
本文提出了功能词假设,通过分析大语言模型(LLMs)中的功能词和内容词,揭示了LLMs在推理和预训练过程中记忆检索和巩固的机制。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:大语言模型(LLMs)在知识记忆、指令遵循和推理等方面表现出色,但其记忆检索和巩固的机制仍不明确。
- 现有方案不足:目前对LLMs记忆机制的理解有限,特别是在推理和预训练过程中。
- 研究目标:通过分析功能词和内容词,揭示LLMs在推理和预训练过程中记忆检索和巩固的机制。
问题2:论文的核心创新点是什么?
- 技术创新:提出了功能词假设,解释了LLMs在推理和预训练过程中记忆检索和巩固的机制。
- 方法改进:利用稀疏自编码器(SAE)分析LLMs的神经元激活,构建了基于功能词和内容词的模型特征激活图。
- 优势:通过实验验证了功能词在LLMs记忆机制中的关键作用,为LLMs的可解释性和高级学习算法设计提供了新思路。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:构建了基于功能词和内容词的模型特征激活图,分析了功能词在LLMs中的激活特征。
- 性能提升:发现功能词可以激活LLMs的大部分特征,并动态地重新激活预测特征。
- 对比结果:与内容词相比,功能词在激活预测特征方面表现出更强的能力。
问题4:这个研究的实际应用价值是什么?
- 应用场景:LLMs在知识记忆、指令遵循和推理等方面具有广泛的应用前景。
- 实施建议:利用功能词假设,可以设计更有效的LLMs学习算法,提高LLMs的性能和可解释性。
- 局限与展望:未来需要进一步研究功能词如何获得动态激活预测特征的能力,以及后训练如何影响功能词的激活模式。