[论文解读] Physics of Language Models: Part 3.1, Knowledge Storage and Extraction
本文研究了大语言模型如何存储和提取事实知识,表明知识提取在很大程度上取决于预训练期间的数据增强。通过使用受控的合成传记数据集,作者发现,若训练数据中缺乏足够的改写和结构多样性,模型会记忆事实,但无法回答关于这些事实的问题——即使经过微调也是如此,原因在于隐藏状态中存在非线性且不可提取的编码方式。
Large language models (LLMs) can store a vast amount of world knowledge, often extractable via question-answering (e.g., "What is Abraham Lincoln's birthday?"). However, do they answer such questions based on exposure to similar questions during training (i.e., cheating), or by genuinely learning to extract knowledge from sources like Wikipedia? In this paper, we investigate this issue using a controlled biography dataset. We find a strong correlation between the model's ability to extract knowledge and various diversity measures of the training data. $ extbf{Essentially}$, for knowledge to be reliably extracted, it must be sufficiently augmented (e.g., through paraphrasing, sentence shuffling, translations) $ extit{during pretraining}$. Without such augmentation, knowledge may be memorized but not extractable, leading to 0% accuracy, regardless of subsequent instruction fine-tuning. To understand why this occurs, we employ (nearly) linear probing to demonstrate a strong connection between the observed correlation and how the model internally encodes knowledge -- whether it is linearly encoded in the hidden embeddings of entity names or distributed across other token embeddings in the training text. This paper provides $ extbf{several key recommendations for LLM pretraining in the industry}$: (1) rewrite the pretraining data -- using small, auxiliary models -- to provide knowledge augmentation, and (2) incorporate more instruction-finetuning data into the pretraining stage before it becomes too late.
研究动机与目标
- 确定语言模型是通过从训练数据中提取知识来回答事实性问题,还是在训练期间记忆了类似问题。
- 研究数据增强(如改写、句子重排)在实现从预训练数据中可靠提取知识方面的作用。
- 理解知识在模型权重中的编码方式,以及其是否可通过探测技术线性访问。
- 评估在预训练期间引入指令微调数据对下游问答性能的影响。
- 通过结构化探测方法,检验高资源群体知识向低资源群体迁移的可行性。
提出的方法
- 构建了一个包含 100k 份传记的合成数据集,其属性受控(如出生日期、城市),并使用 LLaMA 将其重写为自然语言风格。
- 在完整数据集上预训练一个语言模型,然后在来自个体子集(p 分数)的问答对上进行微调。
- 通过评估对分布外个体(1-p 分数)的零样本泛化能力,将知识提取与记忆作用分离。
- 应用 P-探测和 Q-探测,分析模型隐藏表示中关于实体属性的知识是否线性编码。
- 使用 LoRA 基础的微调,采用不同秩设置,评估参数高效微调对问答性能的影响。
- 比较不同数据增强策略下的模型性能,包括全名使用、句子排列和格式多样性。
实验结果
研究问题
- RQ1语言模型是通过从训练数据中提取知识来回答事实性问题,还是在预训练期间记忆了类似问题?
- RQ2预训练期间的数据增强(如改写、重排)如何影响模型在推理时提取事实知识的能力?
- RQ3实体知识在模型隐藏状态中的编码方式在多大程度上是线性的,这又如何影响其可提取性?
- RQ4通过数据增强,高资源群体(如名人)的知识在多大程度上能提升对低资源群体(如少数群体)的知识提取?
- RQ5在预训练期间引入指令微调数据对下游问答准确率有何影响?
主要发现
- 在预训练期间若无数据增强,即使在问答对上进行了微调,模型在未见过的个体上的问答准确率仍为 0%。
- 数据多样性(如改写、句子重排)与模型提取知识的能力之间存在强烈相关性,表明数据增强可实现可提取的知识存储。
- 当在预训练中包含具有多样化格式和结构的名人数据时,对少数群体的知识提取更加可靠,问答准确率显著提升。
- P-探测结果表明,当使用名人数据时,关于少数群体的知识通常编码在早期标记中,表明属性的编码更加直接且线性。
- Q-探测证实,使用增强数据训练的模型在整体属性预测准确率上更高,尤其当使用全名和多样的句子结构时更为明显。
- 使用高秩适配器的 LoRA 基础微调可提升问答性能,但仅当预训练数据包含足够的结构多样性以支持线性探测时才有效。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。