TL;DR
TabGemma adapts a 12B Gemma 3 large language model for tabular in-context learning (ICL) by pairing canonical scientific notation for numbers with target-imputation continued pretraining and fast $n$-gram retrieval. On semantically rich tabular benchmarks, it establishes state-of-the-art classification performance across both few-shot and full-dataset evaluations, rivaling heavily tuned AutoML systems—though it still struggles on continuous regression and numeric-heavy tables.
What Problem Does This Paper Address?
Real-world tabular data is messy and multimodal: numeric features sit right next to free text, categoricals, dates, and descriptive column headers. Standard tabular methods like gradient-boosted decision trees (XGBoost, LightGBM) dominate structured tables but cannot understand text semantics without complex manual feature pipelines.
While Large Language Models (LLMs) possess vast world knowledge and naturally ingest text, adapting them directly to tabular prediction has faced two stubborn bottlenecks:
- Unstable numeric tokenization: Subword tokenizers fragment raw decimal values unpredictably, making arithmetic and numeric comparisons difficult.
- Context limitations: Even long-context LLMs cannot fit thousands of tabular rows into a prompt without running out of tokens or diluting signal.
As a result, prior tabular LLMs were largely restricted to tiny few-shot regimes ($\le 32$ examples).
Methods
TabGemma tackles these issues via a schema-agnostic pipeline centered on three components:
- Canonical Table Serialization: Each row is converted into tokens separated by dedicated
<EOC>(end-of-cell) and<EOR>(end-of-row) tokens without any natural language prompt instructions. Critically, all numbers are formatted into signed, base-10 scientific notation with four significant digits (e.g.,+3.1416e+03). This canonicalization exposes consistent token patterns (e.g.,+,e+0) to subword tokenizers. - Target-Imputation Continued Pretraining: Starting from base Gemma 3 12B (with a 128k context window), the model is pretrained on random 256-row batches from 3 million tables. Rather than predicting every token, cross-entropy loss is applied only to the designated target column tokens while causal attention conditions on all feature columns.
- Fast $n$-gram Context Retrieval at Inference: To populate the context window with the most relevant training exemplars, rows are embedded by hashing cell-level character $n$-grams into 256-dimensional vectors. Vectors are indexed via FAISS, and the top-$k$ nearest neighbors (default $k=128$) are serialized as in-context demonstrations preceding the query row.
Datasets
- Pretraining: The T4 corpus, a collection of 3 million real-world tables derived from TabLib.
- Evaluation (123 tasks total):
- CARTE (51 tasks: 11 binary classification, 40 regression): Emphasizes rich semantic text and real-world entities.
- TextTab (21 tasks: 9 classification, 12 regression): Focused on text-heavy tabular datasets.
- TabArena-Lite (51 tasks: 38 classification, 13 regression): A conventional benchmark dominated by numerical features, used to test generalization outside semantic domains.
Key Insights and Ideas
- Off-the-shelf LLMs are terrible tabular predictors: Gemma 3 evaluated zero-shot on CARTE achieved only 4.6% accuracy and an $R^2$ of $-98.4$, highlighting that general pretraining alone is insufficient without table-aligned training objectives and normalized numerics.
- LLM tabular predictors can scale beyond few-shot: Earlier tabular LLMs were only evaluated on a handful of shots. TabGemma’s accuracy improves monotonically as retrieved context size ($k$) increases up to 128 rows, setting new state-of-the-art results even when baselines are trained on full datasets.
- Semantics drive the LLM advantage: TabGemma excels where column headers and text cells carry semantic meaning. In purely numeric benchmarks, tree-based models and table-specific architectures retain their crown.
Key Results
- Semantically Rich Benchmarks (CARTE & TextTab):
- On CARTE classification, TabGemma scored 79.3% accuracy, outperforming AutoGluon (78.9%), ConTextTab (76.9%), RealMLP (73.6%), and LightGBM (73.4%).
- On TextTab classification, TabGemma achieved 84.1% accuracy, matching or surpassing AutoGluon (83.9%) and LightGBM (81.5%).
- On CARTE regression, TabGemma reached $R^2 = 70.3$, beating tuned LightGBM (67.5) and RealMLP (68.2), though trailing AutoGluon (73.4).
- Numeric Benchmark (TabArena):
- TabGemma lagged behind, scoring 84.8% accuracy (vs. AutoGluon’s 88.5%) and $R^2 = 57.8$ (vs. AutoGluon’s 78.9%), performing statistically on par with an untuned Random Forest.
Limitations and Future Work
- Regression and Continuous Targets: TabGemma exhibits a notable performance gap on continuous regression (particularly on TextTab, $R^2 = 31.6$), suggesting auto-regressive next-token generation remains suboptimal for exact numeric outputs.
- Scaling to Wide and Huge Tables: Retrieval precision degrades on massive candidate pools, and tables with dozens of columns rapidly fill the 128k context window, capping the number of exemplars that can fit.
- Permutation Equivariance: Serializing rows and columns into linear text breaks the natural permutation equivariance of tabular data. Exploring permutation-invariant architectures or ensembling across column orders remains an open area for future work.
Summary updated