Abstract
We study the application of large language models to zero-shot and few-shot classification of tabular data. We prompt the large language model with a serialization of the tabular data to a natural-language string. This allows the model to leverage its vast prior knowledge to classify tabular data even with very few labeled examples.
Introduction
While deep learning has revolutionized computer vision and natural language processing, traditional gradient-boosted trees (like XGBoost or LightGBM) remain the standard for tabular data. However, these models typically require substantial labeled datasets to perform well. In high-stakes domains such as healthcare, where data for rare conditions is scarce, this requirement is a significant barrier. TabLLM addresses this challenge by leveraging the "world knowledge" encoded in pre-trained Large Language Models (LLMs) to perform classification in zero-shot and few-shot scenarios.
Methodology: Serialization and Prompting
The core innovation of TabLLM is the serialization of tabular rows into natural language strings. This process transforms structured data into a format that LLMs can process effectively.
The authors explored several serialization strategies:
- Manual Templates: Simple strings like "The [column] is [value]."
- Table-To-Text: Using specialized models to generate more fluent descriptions.
- LLM-based Generation: Using another LLM to rewrite the data into a paragraph.
Surprisingly, simple manual templates often outperformed more complex, LLM-generated serializations, which sometimes introduced hallucinations. After serialization, a task-specific prompt (e.g., "Does this person earn more than 50,000 dollars? Yes or no?") is appended. For few-shot learning, the authors fine-tune the LLM (specifically T0-11B) using the parameter-efficient T-Few method.
Experimental Setup
TabLLM was evaluated on nine public tabular datasets from standard benchmarks (e.g., Bank, California, Income) and one large private healthcare claims dataset. The public datasets were selected based on having textual feature names and manageable column counts to fit LLM token limits. The healthcare dataset focused on predicting clinical outcomes like End-of-Life (EoL) and hospitalization likelihood.
Key Results
TabLLM demonstrates a clear advantage in data-constrained environments. In zero-shot settings, it achieves impressive results, such as a 0.84 AUC on the Income dataset, by relying on semantic understanding (e.g., knowing that a "Doctorate" degree correlates with higher income).
As shown in the figure above, TabLLM significantly outperforms traditional models like XGBoost and LightGBM, as well as specialized tabular deep learning models like SAINT and TabNet, in the very-few-shot regime (0 to 64 examples). The performance gap can exceed 5 AUC points. However, as the number of labeled examples increases (256+ shots), traditional tree-based models tend to converge with or surpass TabLLM's performance.
Discussion and Limitations
The success of TabLLM is deeply rooted in the semantic meaning of feature names. Ablation studies showed that permuting column names (e.g., swapping "age" with "education") causes performance to plummet, confirming that the model utilizes its pre-trained knowledge rather than just learning statistical patterns from the few-shot examples.
Despite its strengths, TabLLM faces practical hurdles:
- Computational Efficiency: Inference on an 11B parameter model is significantly slower and more resource-intensive than traditional methods.
- Context Windows: Large tables with hundreds of columns exceed current LLM token limits, necessitating feature selection.
- Semantic Dependency: The method is less effective for datasets with anonymized or non-descriptive column names.
Conclusion
TabLLM presents a powerful paradigm for tabular classification when labeled data is scarce. By treating tabular rows as natural language, it unlocks the potential of LLMs to apply general-world knowledge to structured data tasks, providing a robust baseline for few-shot learning in diverse domains.
Summary updated