语言模型通过'突现式学习'掌握上下文复制能力,提升推理性能。
Language Models "Grok" to Copy
- 模型预训练中复制能力滞后于损失下降,后突然大幅提升。
- 复制能力发展速度与训练词元数量无关,符合突现学习特征。
- 注意力头从浅层到深层逐步形成,类似深度模型的突现电路。
我们研究了语言模型在预训练过程中的动态特性,重点关注其从上下文复制文本的能力——这是实现上下文学习(ICL)和检索增强生成(RAG)等任务的基础技能。本文提出一种新视角:基于Transformer的语言模型发展复制能力的方式类似于'突现学习'(grokking),即在模型已拟合训练集后,测试集性能才突然提升。实验得出三点证据:(1) 预训练损失迅速下降,但模型的上下文复制能力初期滞后,随后突然饱和;(2) 复制能力的发展速度不随训练词元数量变化,与突现学习中数据量不影响速度的现象一致;(3) 负责复制的归纳注意力头(induction heads)从浅层向深层逐步形成,与突现过程中深层电路的演化路径相似。我们认为,突现学习与上下文复制之间的联系可为更高效的模型训练提供洞见,进而提升上下文表现。例如,我们验证了正则化等促进突现学习的技术,能加速或增强复制能力的形成。
原文摘要 · Abstract (English)
We examine the pre-training dynamics of language models, focusing on their ability to copy text from preceding context--a fundamental skill for various LLM applications, including in-context learning (ICL) and retrieval-augmented generation (RAG). We propose a novel perspective that Transformer-based language models develop copying abilities similarly to grokking, which refers to sudden generalization on test set long after the model fit to the training set. Our experiments yield three arguments: (1) The pre-training loss decreases rapidly, while the context copying ability of models initially lags and then abruptly saturates. (2) The speed of developing copying ability is independent of the number of tokens trained, similarly to how grokking speed is unaffected by dataset size as long as the data distribution is preserved. (3) Induction heads, the attention heads responsible for copying, form from shallow to deep layers during training, mirroring the development of circuits in deeper layers during grokking. We contend that the connection between grokking and context copying can provide valuable insights for more effective language model training, ultimately improving in-context performance. For example, we demonstrated that techniques that enhance grokking, such as regularization, either accelerate or enhance the development of context copying.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。