[Paper Review] Physics of Language Models: Part 3.1, Knowledge Storage and Extraction
This paper investigates how large language models store and extract factual knowledge, demonstrating that knowledge extraction depends critically on data augmentation during pretraining. Using a controlled synthetic biography dataset, the authors show that without sufficient paraphrasing and structural diversity in training data, models memorize facts but cannot answer questions about them—even after fine-tuning—due to non-linear, non-extractable encoding in hidden states.
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.
Motivation & Objective
- To determine whether language models answer factual questions by extracting knowledge from training data or by memorizing similar questions during training.
- To investigate the role of data augmentation (e.g., paraphrasing, sentence shuffling) in enabling reliable knowledge extraction from pretraining data.
- To understand how knowledge is encoded in model weights and whether it is linearly accessible via probing techniques.
- To evaluate the impact of incorporating instruction-tuning data during pretraining on downstream question-answering performance.
- To examine the transferability of knowledge from high-resource to low-resource groups using structural probing methods.
Proposed method
- Constructed a synthetic dataset of 100k biographies with controlled attributes (e.g., birth date, city) and used LLaMA to rewrite them into natural language styles.
- Pretrained a language model on the full dataset, then fine-tuned it on question-answer pairs from a subset (p fraction) of individuals.
- Evaluated zero-shot generalization to out-of-distribution individuals (1-p fraction) to isolate knowledge extraction from memorization.
- Applied P-probing and Q-probing to analyze whether knowledge about entity attributes is linearly encoded in the model’s hidden representations.
- Used LoRA-based fine-tuning with varying rank settings to assess the impact of parameter-efficient adaptation on QA performance.
- Compared model performance across different data augmentation strategies, including full-name usage, sentence permutation, and format diversity.
Experimental results
Research questions
- RQ1Does a language model answer factual questions by extracting knowledge from its training data or by memorizing similar questions during pretraining?
- RQ2How does data augmentation (e.g., paraphrasing, shuffling) during pretraining affect the model’s ability to extract factual knowledge during inference?
- RQ3To what extent is knowledge about entities linearly encoded in the model’s hidden states, and how does this affect extractability?
- RQ4Can knowledge from high-resource groups (e.g., celebrities) improve knowledge extraction for low-resource groups (e.g., minorities) through data augmentation?
- RQ5What is the impact of incorporating instruction-fine-tuning data during pretraining on downstream QA accuracy?
Key findings
- Without data augmentation during pretraining, models achieve 0% QA accuracy on unseen individuals, despite being fine-tuned on question-answer pairs.
- A strong correlation exists between data diversity (e.g., paraphrasing, sentence shuffling) and the model’s ability to extract knowledge, indicating that augmentation enables extractable knowledge storage.
- Knowledge about minority groups is more reliably extracted when celebrity data with diverse formatting and structure is included in pretraining, improving QA accuracy significantly.
- P-probing results show that knowledge about minority groups is often encoded in earlier tokens when celebrity data is used, indicating more direct and linear encoding of attributes.
- Q-probing confirms that models trained with augmented data achieve higher whole-attribute prediction accuracy, especially when full names and varied sentence structures are used.
- The use of LoRA-based fine-tuning with higher-rank adapters improves QA performance, but only when the pretraining data includes sufficient structural diversity to support linear probeability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.