TL;DR
Large Language Models (LLMs) have a tendency to memorize tabular datasets they were trained on, leading to inflated performance metrics and overfitting. This paper introduces methods to detect this memorization and shows that while LLMs can learn from novel tabular data, their few-shot learning capabilities lag behind traditional methods, suggesting a reliance on pre-existing world knowledge.
What Problem Does This Paper Address?
As LLMs are increasingly applied to diverse tasks beyond natural language, a critical concern is data contamination, specifically memorization. This occurs when an LLM has seen a dataset during its pre-training phase, which can lead to an inaccurate assessment of its true generalization capabilities. For tabular data, this issue is often overlooked. The authors aim to address this by developing techniques to detect memorization in LLMs on tabular datasets and to understand how this memorization impacts their performance on both seen and unseen data. This is crucial for reliable evaluation and deployment of LLMs in real-world applications involving structured data.
Methods
The core of this paper lies in its novel methods for detecting memorization in LLMs on tabular data. They introduce four specific tests:
- Header Test: Prompts the LLM with the initial rows of a CSV file and checks if it can accurately complete the subsequent rows verbatim.
- Row Completion Test: Similar to the header test, but prompts with contiguous rows from a random position within the dataset.
- Feature Completion Test: Provides all feature values for a row except one unique feature and asks the LLM to predict the missing value.
- First Token Test: Uses contiguous rows as a prompt and assesses the LLM's ability to predict the very first token of the next row.
These tests leverage the fact that tabular data, often represented as CSVs, can be treated as text. If an LLM can consistently reproduce parts of a dataset, it suggests memorization. Beyond memorization detection, the authors also investigate LLM performance under various data transformations (original, perturbed, task, statistical) to understand the impact of memorization and the role of world knowledge. They also analyze the in-context statistical learning abilities of LLMs by testing them on simple binary classification problems.
Datasets
The study utilizes a combination of publicly available and novel tabular datasets:
- Pre-2021 Datasets (Indicative of Memorization):
- Iris
- Wine
- Adult Income
- Housing (California Housing)
- OpenML Diabetes
- Kaggle Titanic
- Post-2021 Datasets (Indicative of Novelty):
- ACS Income
- ACS Travel
- Spaceship Titanic (Kaggle, 2022)
- FICO (requires registration)
- ICU (novel, created by authors)
Key Insights and Ideas
- LLMs are "Elephants" for Tabular Data: The title's metaphor holds true; LLMs demonstrate a significant capacity to memorize entire tabular datasets, especially popular ones. This isn't just about recalling a few facts, but often reproducing large portions verbatim.
- Memorization = Overfitting: Performance on datasets seen during training is consistently higher than on novel datasets. This isn't a sign of superior learning, but rather overfitting to the training data, which is then exposed when the model encounters slightly altered or unseen data.
- World Knowledge is Key for Novel Data: When LLMs perform well on novel tabular datasets, it's less about in-context statistical learning and more about leveraging their vast pre-existing world knowledge. This is evidenced by their struggle with purely statistical transformations of data where feature names and natural scales are removed.
- In-Context Learning is Not a Silver Bullet (Yet): While LLMs can perform statistical classification tasks in-context, their sample efficiency lags significantly behind traditional algorithms, especially as the dimensionality of the problem increases. This suggests that fine-tuning or specialized models might still be superior for complex tabular prediction tasks.
- The Importance of Testing: The paper strongly advocates for rigorous testing for data contamination and memorization before evaluating LLM performance on tabular data. Without such checks, performance metrics can be highly misleading.
Key Results
- High Memorization Rates: GPT-3.5 and GPT-4 showed strong evidence of memorizing many popular tabular datasets, with GPT-4 exhibiting slightly stronger memorization. For example, GPT-4 could consistently generate the entire Iris and Wine datasets.
- Performance Drop with Perturbations: On memorized datasets, introducing small amounts of noise or reformatting the data led to an average accuracy drop of 6 percentage points for LLMs. This effect was negligible on novel datasets.
- LLMs Outperform Logistic Regression on Memorized Data: On memorized datasets, GPT-4, in its original format, outperformed logistic regression on 3 out of 5 datasets. However, this advantage vanished with data transformations.
- Novel Datasets Show Robustness: On novel datasets, LLMs performed reasonably well, and their performance was robust to data transformations, suggesting they were not memorized.
- Statistical Learning Limitations: LLMs are better than random at statistical classification but are less sample-efficient than traditional methods like logistic regression or 1-Nearest Neighbor, especially in higher dimensions. GPT-4's in-context learning performance scales better with the number of few-shot examples than GPT-3.5.
- Random Sampling Capability: LLMs can generate novel random samples from datasets they have seen, mimicking statistical properties like feature correlations without directly copying data points.
Limitations and Future Work
- Unknown Training Data: The authors acknowledge that they do not definitively know the exact training data of the LLMs. The term "seen during training" is used when there is evidence of memorization.
- Insertion into Training Corpus: It would have been ideal to insert datasets into the training corpus at random to better control for contamination.
- Power of Memorization Tests: While the tests provide significant evidence of memorization, it's possible that LLMs have memorized datasets but the current prompting methods are not powerful enough to extract it.
- Future Work: The authors suggest further research into understanding the factors that determine few-shot learning performance, particularly the interplay between world knowledge and in-context statistical learning. They also highlight the need for more robust methods to detect data contamination, especially for models with API access. The release of their
tabmemcheckPython package aims to facilitate this future research.
Summary updated