用功能词解释大模型如何存取记忆,揭示其内在机制。
Memory Retrieval and Consolidation in Large Language Models through Function Tokens
- 以功能词激活上下文中最相关特征,控制下一步生成
- 仅少量功能词激活多数特征,且训练中主导损失函数
- 适合研究模型内部机制或语言建模原理的读者
大型语言模型(LLMs)的成功源于其在预训练中将海量知识固化于模型记忆,并在推理时从中检索信息,实现知识记忆、指令遵循和推理等能力。然而,其记忆存取机制仍不清晰。本文提出功能词假设:推理时,功能词激活上下文中的最预测性特征并决定下一个词;预训练中,预测紧随功能词的内容词,促使模型学习更多特征并更新参数,实现记忆巩固。功能词对应语言学中的虚词,如标点、冠词、介词、连词等,与内容词相对。通过双分图分析,我们发现少数功能词激活了大部分特征;案例研究显示,功能词能引导上下文中最相关特征参与预测。此外,预训练中损失主要由功能词后的内容词预测驱动,迫使功能词选择最具预测性的上下文特征。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。