[论文解读] Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to Pretraining Data
本文提出一种可扩展的n-gram对分析方法,通过语义相似性和频率统计,将大语言模型的能力追溯至其预训练数据。研究发现,更大的模型通过利用与任务相关的n-gram对实现更好的泛化,而较小的模型则倾向于记忆;指令微调能提升数据利用效率,但不会引入新的能力。
The impressive capabilities of large language models (LLMs) have sparked debate over whether these models genuinely generalize to unseen tasks or predominantly rely on memorizing vast amounts of pretraining data. To explore this issue, we introduce an extended concept of memorization, distributional memorization, which measures the correlation between the LLM output probabilities and the pretraining data frequency. To effectively capture task-specific pretraining data frequency, we propose a novel task-gram language model, which is built by counting the co-occurrence of semantically related $n$-gram pairs from task inputs and outputs in the pretraining corpus. Using the Pythia models trained on the Pile dataset, we evaluate four distinct tasks: machine translation, factual question answering, world knowledge understanding, and math reasoning. Our findings reveal varying levels of memorization, with the strongest effect observed in factual question answering. Furthermore, while model performance improves across all tasks as LLM size increases, only factual question answering shows an increase in memorization, whereas machine translation and reasoning tasks exhibit greater generalization, producing more novel outputs. This study demonstrates that memorization plays a larger role in simpler, knowledge-intensive tasks, while generalization is the key for harder, reasoning-based tasks, providing a scalable method for analyzing large pretraining corpora in greater depth.
研究动机与目标
- 理解预训练数据如何在不完全记忆的前提下贡献于大语言模型的能力。
- 探究在大规模下,大语言模型中记忆与泛化之间的平衡关系。
- 将模型性能追溯至预训练语料库中特定的n-gram对。
- 评估模型规模和指令微调对数据利用的影响。
- 提供一种可扩展、可解释的方法,用于分析大语言模型能力的起源。
提出的方法
- 使用基于嵌入的相似性(使用预训练编码器计算余弦相似度)从任务输入和输出中挖掘语义相似的n-gram对。
- 使用WIMBD框架在完整预训练语料库(如The Pile)中搜索这些n-gram对,并检索其频率和来源文档。
- 通过n-gram对频率对预训练数据分布进行建模,将其作为任务相关数据的弱监督信号。
- 利用n-gram频率近似条件分布P(y|x),并通过对数概率回归将其与语言模型的预测分布进行比较。
- 通过log数据与log LM概率之间线性回归的R²分数,衡量预训练数据与语言模型输出之间分布的相似性。
- 通过分析生成n-gram的梯度相似性和新颖性,评估其属于记忆还是泛化行为。
实验结果
研究问题
- RQ1不同规模模型中,预训练数据里与任务相关的n-gram对如何与模型性能相关联?
- RQ2更大的模型在多大程度上实现泛化而非记忆?这与预训练数据中n-gram频率有何关联?
- RQ3指令微调在多大程度上改变了模型对预训练数据的依赖,且这种影响独立于微调数据本身?
- RQ4是否可以通过足够多与任务相关的预训练数据,解释涌现能力的出现,即从记忆到泛化的转变?
- RQ5n-gram对频率在决定模型性能和分布对齐方面起到何种作用?
主要发现
- 与单个n-gram相比,与任务相关的n-gram对更能代表任务相关数据,且其频率与模型性能呈正相关。
- 随着模型规模增大,记忆行为减少,泛化能力增强,且分布相似性的R²分数在大模型中先下降后略有上升。
- 大模型中涌现能力与充足的与任务相关的预训练数据相关,表明其经历了从记忆到泛化的转变。
- 小规模语言模型倾向于记忆,而大规模语言模型则倾向于泛化,生成更多在预训练中未见过的新n-gram。
- 指令微调提升了数据利用效率,且不会记忆微调数据,表明其增强了预训练阶段已学习到的原有能力。
- 语言模型输出与预训练数据之间的分布相似性随模型规模增大而降低,表明记忆减少,泛化能力增强。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。