LMD3: Language Model Data Density Dependence

John Kirchenbauer, Garrett Honke, Gowthami Somepalli, Jonas Geiping, Katherine Lee, Daphne Ippolito, Tom Goldstein, David Andre

TL;DR

This paper introduces LMD3, a novel methodology for analyzing language model performance at the individual example level by estimating the density of training data around specific test queries. They demonstrate that this density is a strong predictor of performance, offering insights into how models learn and potentially identifying areas where training data is lacking.

What Problem Does This Paper Address?

Large language models (LLMs) are notoriously opaque, making it difficult to understand why they perform well or poorly on specific tasks. While we know they can memorize training data, it's unclear how much individual training examples contribute to a model's performance on a given test query. This paper tackles the challenge of quantifying this relationship, aiming to provide a more granular understanding of model behavior by linking performance to the "density" of relevant training data. This is crucial for debugging, improving model robustness, and understanding potential issues like data leakage.

Methods

The core of LMD3 is Kernel Density Estimation (KDE) applied to the embedding space of text data. Here's a breakdown:

  • Embedding: Text data (both training and test queries) is first converted into numerical vectors using pre-trained sentence embedding models.
  • Density Estimation: For each test query, KDE is used to estimate how "dense" the training data is in its vicinity in the embedding space. This essentially measures how many training examples are "similar" to the test query.
  • Controlled Experiments: To validate their approach, the authors artificially increase training data density by mixing paraphrased or exact copies of test queries into the training set.
  • Approximate KDE for Scale: For large pretraining datasets, they employ an optimized KDE approach (DEANN) that leverages approximate nearest neighbors to make the computation tractable.

Datasets

  • MMLU (Massive Multitask Language Understanding): Used as a benchmark for finetuning experiments and as a source of out-of-distribution (OoD) queries for pretraining analysis.
  • The Deduplicated Pile: A large, multi-domain web corpus used for pretraining experiments. The authors re-segmented it into smaller chunks to manage input length limitations of embedding models.
  • OpenOrca: Another dataset used for out-of-distribution query analysis.

Key Insights and Ideas

  • Density is a Performance Predictor: The paper strongly suggests that the density of training data around a test query is a significant predictor of model performance on that query. Higher density generally correlates with better performance.
  • Leakage Magnifies Density Effects: Artificially increasing data density through paraphrases and exact copies of test queries leads to measurable improvements in performance, and this effect is amplified when exact copies are included.
  • Subtle Effects in Pretraining: While density is a clear indicator in controlled leakage scenarios, its impact on perplexity in large-scale pretraining is more nuanced and depends on how density is aggregated (local vs. random sampling).
  • KDE vs. Top-k Distance: Both KDE and simple top-k neighbor distance metrics can predict performance, but KDE appears to capture variance more smoothly and comprehensively.
  • Data Curation Potential: The methodology can identify regions of the training data with low support for certain test queries, suggesting opportunities for targeted data augmentation or curation to improve model robustness.

Key Results

  • In controlled experiments with paraphrased and exact leaks, increasing training data density reliably increased accuracy and decreased perplexity on test questions.
  • For pretraining, a local KDE measure showed a strong negative trend between density and perplexity for random samples from The Deduplicated Pile.
  • The authors found that density estimates could explain a significant fraction of the variance in model perplexity.
  • In leakage experiments, the KDE measure effectively distinguished between leaked and non-leaked question sets, with leaked questions showing higher density.

Limitations and Future Work

  • Hyperparameter Sensitivity: The KDE methodology is not entirely hyperparameter-free, requiring the user to choose kernel parameters (like bandwidth).
  • Segmentation Choices: The choice of text segment length and stride for embedding can influence the analysis.
  • Data Access: The increasing rarity of full training dataset access for new models limits the applicability of such data-centric analysis techniques.
  • Future Work: The authors suggest exploring the internal representations of autoregressive LLMs for embedding, further investigating the impact of segmentation choices, and using the methodology for instance/group-wise error analysis, dataset filtering, and supplementing interventions. They also call for greater transparency in releasing training data details.

Summary updated

BibTeX
@inproceedings{kirchenbauer2024lmd,
  author = {John Kirchenbauer and Garrett Honke and Gowthami Somepalli and Jonas Geiping and Katherine Lee and Daphne Ippolito and Tom Goldstein and David Andre},
  title = {{LMD3: Language Model Data Density Dependence}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=eGCw1UVOhk},
}
Figure