Cram Less to Fit More: Training Data Pruning Improves Memorization of Facts
Organizations: National University of Singapore · Apple
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.
Figures & tables
| Random Fact-Acc | Ours Fact-Acc | Random NLU | Ours NLU | |
| 0.1 | 600.55 | 835.81 (5.78) | 0.3583 | 0.3606 |
| 0.2 | 647.33 | 929.25 (3.49) | 0.3602 | 0.3604 |
| 0.3 | 657.25 | 914.87 (12.18) | 0.3643 | 0.3635 |
| 0.4 | 666.84 | 880.15 (7.26) | 0.3593 | 0.3598 |
| 0.5 | 676.29 | 851.69 (8.41) | 0.3643 | 0.3607 |
| 0.6 | 687.23 | 829.15 (7.54) | 0.3597 | 0.3629 |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| # Facts in | Full Dataset | Oracle-Aided Selection | Loss-based Selection | ||||
| Train Data | 1x steps | 8x steps | Flattened | Head | Head-Flattened | LossH (Ours) | LossHF (Ours) |
| Power law Exponent | |||||||
| 1.60M | 1.53M | 1.53M | 1.50M | 1.55M | 1.55M | 1.55M | 1.60M |
| 1.92M | 1.78M | 1.78M | 1.80M | 1.81M | 1.76M | 1.81M | 1.91M |
| 2.24M | 1.90M (457k) | 1.90M (457k) | 1.94M | 1.90M | 1.93M (141k) | 1.88M | 2.05M |
| 2.56M | 0.99M (635k) | 1.85M (136k) | 1.10M (645k) | 1.83M (356k) | 1.93M (525k) | 1.88M | 2.04M (914k) |
| # Facts in | Full Dataset | Oracle-Aided Selection | Loss-based Selection | ||||
| Train Data | 1x steps | 8x steps | Flattened | Head | Head-Flattened | LossH (Ours) | LossHF (Ours) |
| Power law Exponent | |||||||
| 1.60M | 0.942 | 0.942 | 0.936 | 0.962 | 0.966 (0.004) | 0.396 | 0.999 |
| 1.92M | 0.929 | 0.929 | 0.935 | 0.918 | 0.917 (0.115) | 0.931 | 0.996 (0.002) |
| 2.24M | 0.872 | 0.872 | 0.864 | 0.849 | 0.834 (0.075) | 0.841 | 0.914 (0.366) |
| 2.56M | 0.677 | 0.726 | 0.739 | 0.735 | 0.739 (0.262) | 0.740 | 0.798 (0.340) |
| Method | General Capability Accuracy | Target Accuracy | |||||
| Commonsense | MMLU | ARC | Fact Accuracy (%) | ||||
| Hellaswag | OpenbookQA | PiQA | Easy | Challenge | on arXiv Papers | ||
| Pre-trained | 63.1 (0.10) | 36.7 (0.14) | 74.8 (0.09) | 30.7 (0.24) | 65.6 (0.19) | 36.8 (0.10) | 0.1 |
| LoRA | |||||||
| Full Data | 54.2 (0.16) | 32.7 (0.79) | 67.8 (0.36) | 24.6 (0.23) | 53.6 (0.82) | 31.0 (0.37) | 0.2 (0.03) |
| LossHF (Ours) | 55.2 (0.17) | 34.3 (1.35) | 67.7 (0.80) | 26.0 | 50.5 (0.81) | 30.3 (0.65) | 7.9 (0.41) |
| Split | Facts | Records |
| train | 59670093 | 6245642 |
| validation | 733 | 75 |
| test | 7135 | 830 |
| Total | 59677961 | 6246547 |
Memorization in Language Models
Memorization in language models studies how training examples and facts are stored, recalled, generalized, and exposed by model parameters.
See all 114 papers