Elephants Never Forget: Memorization and Learning of Tabular Data in Large Language Models

Sebastian Bordt, Harsha Nori, Vanessa Rodrigues, Besmira Nushi, Rich Caruana

TL;DR

Large Language Models (LLMs) like GPT-4 have memorized many popular tabular datasets verbatim, leading to significantly inflated performance scores on common benchmarks. By introducing the tabmemcheck package, the authors demonstrate that while LLMs possess genuine in-context learning abilities, their "superhuman" performance often vanishes when they can no longer rely on memorized data or semantic world knowledge.

What Problem Does This Paper Address?

Evaluating LLMs on tabular data (like CSV files) is a minefield of data contamination. Because these models are trained on massive web scrapes, they have likely "seen" popular open-source datasets (e.g., Titanic, Iris, Adult Income) during pre-training.

If a model has memorized a test set, its high accuracy isn't a sign of intelligence or reasoning—it's just a retrieval task. This paper seeks to quantify how much LLMs actually memorize, how that memorization affects performance, and whether they can truly learn new statistical patterns in-context without relying on prior knowledge.

Methods

The authors developed a multi-pronged approach to detect and bypass memorization:

  1. Memorization Tests: They introduced four tests (Header, Row Completion, Feature Completion, and First Token) to see if a model could complete parts of a dataset verbatim.
  2. Data Transformations: To see if models were "reasoning" or "recognizing," they presented data in four formats:
  3. Original: The raw CSV format.
  4. Perturbed: Adding tiny amounts of noise to numerical values to break verbatim matching.
  5. Task: Re-coding categories (e.g., "0" to "False") and renaming features (e.g., "BMI" to "Body mass index").
  6. Statistical: The most extreme version, where feature names are replaced with $X_1, X_2...$ and values are standardized to zero mean and unit variance.
  7. In-Context Statistical Learning: They tested models on purely synthetic binary classification tasks to measure how their learning scales with the number of examples and the dimensionality of the problem.

Datasets

The study categorizes datasets into two groups:

  • Memorized (Pre-2021): Popular datasets like Iris, Wine, Adult, Housing, Diabetes, and Titanic.
  • Novel (Post-2022 or Private): Datasets the models likely haven't seen, including ACS Income, ACS Travel, Spaceship Titanic, FICO, and a newly introduced ICU dataset derived from Harvard data.

Key Insights and Ideas

  • Verbatim Regurgitation: GPT-4 can consistently generate the entire Iris and Wine datasets from scratch given only a small prompt. This isn't just "knowing about" the data; it's a literal copy-paste from weights.
  • The "Semantic Crutch": LLMs rely heavily on feature names. When you move from the "Task" format (which has descriptive names) to the "Statistical" format (which has abstract names like $X_1$), performance drops sharply. This suggests LLMs use "world knowledge" (e.g., knowing that higher age usually correlates with higher income) rather than purely learning the statistical relationship from the few-shot examples.
  • Scaling Failures: Unlike traditional algorithms (Logistic Regression or Gradient Boosted Trees), LLMs struggle significantly as the number of features (dimensions) increases. While GPT-4's performance improves as you give it more few-shot examples, GPT-3.5 remains relatively flat.

Key Results

  • Memorization Inflation: On memorized datasets, adding small amounts of noise (Perturbed format) caused an average accuracy drop of 6 percentage points. On novel datasets, these transformations had no effect, proving the original high scores were due to contamination.
  • Performance vs. Baselines: In the "Statistical" format—where the model must learn purely from the data provided in the prompt—LLMs consistently underperform simple Logistic Regression.
Figure 2: Few-shot learning performance of GPT-4 and GPT-3.5 across memorized and novel datasets. The Figure depicts the absolute performance difference between the LLM and logistic regression, that is, a value of 0 means that the LLM has the same accuracy as logistic regression. The Figure depicts the average accuracy across the different datasets. Parentheses indicate standard errors. This Figure summarizes the results in Table 4.
  • Generative Capabilities: The authors showed that LLMs can act as random samplers for memorized data. GPT-3.5 can generate new, synthetic data points that match the statistical distribution (correlations and means) of the California Housing dataset without ever being shown the data in the prompt.
Figure 4: GPT-3.5 drawing random samples from the California Housing dataset at different temperatures, showing it has captured the underlying data distribution during pre-training.

Limitations and Future Work

The primary limitation is the "black box" nature of proprietary models like GPT-4. The researchers cannot know for certain what was in the training set; they can only infer it through memorization tests.

Future work could involve "canary" datasets—inserting unique, traceable data into training corpuses to track exactly how and when memorization occurs. The authors also suggest that the community needs to move toward evaluating LLMs on "Statistical" formats to truly measure their reasoning capabilities, rather than their ability to look up answers in their internal encyclopedia.

Summary updated

BibTeX
@inproceedings{bordt2024elephants,
  author = {Sebastian Bordt and Harsha Nori and Vanessa Rodrigues and Besmira Nushi and Rich Caruana},
  title = {{Elephants Never Forget: Memorization and Learning of Tabular Data in Large Language Models}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=HLoWN6m4fS},
}
Figure