Cram Less to Fit More: Training Data Pruning Improves Memorization of Facts
Abstract
Large language models (LLMs) can struggle to memorize factual knowledge in their parameters, often leading to hallucinations and poor performance on knowledge-intensive tasks. In this paper, we formalize fact memorization from an information-theoretic perspective and study how training data distributions affect fact accuracy. We show that fact accuracy is suboptimal (below the capacity limit) whenever the amount of information contained in the training data facts exceeds model capacity. This is further exacerbated when the fact frequency distribution is skewed (e.g. a power law). We propose data selection schemes based on the training loss alone that aim to limit the number of facts in the training data and flatten their frequency distribution. On semi-synthetic datasets containing high-entropy facts, our selection method effectively boosts fact accuracy to the capacity limit. When pretraining language models from scratch on an annotated Wikipedia corpus, our selection method enables a GPT2-Small model (110m parameters) to memorize 1.3X more entity facts compared to standard training, matching the performance of a 10X larger model (1.3B parameters) pretrained on the full dataset.
Lay Summary
You might think that to teach a language model more facts, you should give it all the facts you have. Surprisingly, we found the opposite: removing some facts from the training data can actually help the model answer more facts correctly overall. Why? Think of a language model as having a limited "memory budget" for facts. If you try to stuff every fact you know into it, the model gets overwhelmed and ends up remembering fewer facts accurately. Our method automatically identifies which facts are just taking up space without being learnable, using the model's own "loss" as a guide. By skipping them and emphasizing rarer but learnable facts more, the model can focus its capacity on facts it can learn well. The result: the model answer more facts correctly without hurting its general language abilities, better than training on all available data.