Abstract
While many have shown how Large Language Models (LLMs) can be applied to a diverse set of tasks, the critical issues of data contamination and memorization are often glossed over. In this work, we address this concern for tabular data. Specifically, we introduce a variety of different techniques to assess whether a language model has seen a tabular dataset during training. This investigation reveals that LLMs have memorized many popular tabular datasets verbatim. We then compare the few-shot learning performance of LLMs on datasets that were seen during training to the performance on datasets released after training. We find that LLMs perform better on datasets seen during training, indicating that memorization leads to overfitting. At the same time, LLMs show non-trivial performance on novel datasets and are surprisingly robust to data transformations. We then investigate the in-context statistical learning abilities of LLMs. While LLMs are significantly better than random at solving statistical classification problems, the sample efficiency of few-shot learning lags behind traditional statistical learning algorithms, especially as the dimension of the problem increases. This suggests that much of the observed few-shot performance on novel real-world datasets is due to the LLM's world knowledge. Overall, our results highlight the importance of testing whether an LLM has seen an evaluation dataset during pre-training. We release the LLM-Tabular-Memorization-Checker Python package to test LLMs for memorization of tabular datasets.
Introduction
As Large Language Models (LLMs) are increasingly deployed for structured data tasks—such as medical outcome prediction or financial forecasting—their performance often appears remarkable. However, a critical question remains: are these models demonstrating genuine statistical reasoning, or are they simply recalling data seen during pre-training? This "data contamination" is the "elephant in the room" for tabular data evaluation. If a benchmark dataset like Titanic or Iris was part of the training corpus, evaluating a model on it is akin to providing a student with the exam answers beforehand. This paper quantifies the extent of tabular data memorization and its impact on perceived in-context learning abilities.
Methods and Datasets
To detect memorization, we developed a suite of tests implemented in the tabmemcheck Python package. These include:
- Header Test: Completing the first few rows of a CSV given the header.
- Row Completion: Finishing a specific row from a random starting point.
- Feature Completion: Filling in a missing unique value within a row.
- First Token Test: Predicting the initial character of the subsequent row.
We evaluated models on two categories of datasets: a "Seen" group of classic benchmarks (e.g., Iris, Wine, Titanic) and a "Novel" group released after the training cutoffs (e.g., Spaceship Titanic, ACS Income, ICU). To isolate memorization from reasoning, we tested models on four data variants: Original (raw CSV), Perturbed (minor numerical noise), Task (renamed features like "BMI" to "Body Mass Index"), and Statistical (features renamed to $X_1, X_2...$ and standardized).
Key Results and Insights
Our investigation reveals that verbatim recall is widespread; for instance, GPT-4 can generate the entire Iris and Wine datasets from memory. This memorization significantly inflates performance metrics. On memorized datasets, adding even minor numerical noise (perturbation) resulted in an average accuracy drop of 6 percentage points, suggesting the model relies on specific remembered points rather than generalizable rules.
Furthermore, LLMs rely heavily on "world knowledge" as a context crutch. When feature names are stripped away (the "Statistical" variant), performance drops drastically. However, models show impressive semantic flexibility, remaining robust to "Task" transformations where features are renamed but retain their meaning.
While GPT-4 often outperformed traditional baselines like Logistic Regression on memorized data, it failed to do so on novel datasets. Additionally, LLMs exhibit poor sample efficiency compared to traditional ML algorithms as the number of features increases, indicating that their few-shot performance on novel data is largely driven by prior world knowledge rather than pure statistical learning.
Conclusion
Our findings underscore the necessity of testing for data contamination before evaluating LLMs on tabular benchmarks. Current performance metrics may reflect rote memorization rather than actual intelligence. Future research should prioritize evaluation on private or "locked" datasets and develop more sophisticated contamination tests that do not rely solely on verbatim text recall.
Summary updated