TabFlex: Scaling Tabular Learning to Millions with Linear Attention

Yuchen Zeng, Tuan Dinh, Wonjun Kang, Andreas C Mueller

The Bottleneck in Tabular In-Context Learning

For years, Gradient-Boosted Decision Trees (GBDTs) like XGBoost and LightGBM have reigned supreme in tabular machine learning. However, they require time-consuming retraining for every new dataset. Recently, TabPFN introduced a "foundation model" approach for tabular data: a Transformer pre-trained on synthetic data that can classify new datasets instantly using In-Context Learning (ICL). By treating the training data as a long prompt, it eliminates the need for parameter updates.

The catch? TabPFN relies on standard softmax self-attention, which has a quadratic complexity ($O(N^2)$) relative to the number of samples. This makes the model memory-hungry and slow, effectively limiting its use to small datasets (typically under 1,000 samples). Because real-world tabular datasets often scale to millions of rows, TabPFN’s scalability bottleneck has prevented it from becoming a universal tool.

Enter TabFlex: Linear Attention for Tabular Data

To address this scalability crisis, researchers introduce TabFlex, a model that swaps out the traditional quadratic attention mechanism for non-causal linear attention. This architectural shift allows TabFlex to scale to millions of rows and thousands of features while maintaining the instant adaptability of ICL.

The "Causality Trap"

When searching for efficient attention alternatives, the researchers tested State-Space Models (SSMs) like Mamba. However, they discovered a critical flaw: the inherent "causality" of these models severely hurts ICL performance on tabular data.

In natural language processing, word order is everything, making causal masking essential. In tabular data, however, the order of rows is entirely arbitrary. Forcing a model to be causal prevents it from fully utilizing the context of the entire training set.

Accuracy comparison between non-causal and causal masking as training samples increase.

By utilizing non-causal linear attention, TabFlex avoids this trap. It maintains $O(N)$ efficiency while allowing every row to "see" every other row, preserving the nuance needed for high accuracy. For tabular classification, linear attention acts as a "free lunch"—it is significantly faster and lighter on memory without sacrificing predictive power.

Specialized Model Variants

Instead of a one-size-fits-all approach, TabFlex employs three sub-models optimized for different data regimes:

  • S100: Optimized for small, low-dimensional data (similar to TabPFN's original use case).
  • L100: Designed for large datasets (up to 50,000 samples) with few features.
  • H1K: Built for high-dimensional data, handling up to 1,000 features and 100 classes.

Coupled with an HBM-efficient hardware implementation that minimizes memory reads/writes between GPU memory and on-chip SRAM, TabFlex ensures its theoretical $O(N)$ scaling translates directly to real-world wall-clock speedups.

Key Results and Performance

TabFlex was evaluated across a massive battery of tests, including 115 OpenML datasets, the 36-dataset TabZilla Hard Benchmark, and even flattened image benchmarks like MNIST to test its versatility.

The results highlight a massive leap in efficiency and performance:

  • Unprecedented Speed: TabFlex is, on average, 2× faster than TabPFN and 1.5× faster than XGBoost. To demonstrate extreme scalability, TabFlex processed the 1-million-sample poker-hand dataset in just 4.88 seconds, whereas the next fastest baseline took over 500 seconds.
  • State-of-the-Art Accuracy: On the challenging TabZilla benchmark, TabFlex significantly outperformed TabPFN and remained competitive with—or superior to—25 other baselines, including heavily tuned GBDTs and deep learning models.
Comparison of Mean Runtime and Mean AUC between TabPFN and TabFlex.

Because it leverages ICL, TabFlex requires zero parameter updates at test time. Users simply feed it the training data and the test query in a single forward pass, yielding instant, highly accurate predictions.

Limitations and Future Work

While TabFlex pushes the boundaries of tabular Transformers, the authors note a few remaining hurdles:

  • Ultra-High Dimensions: Although TabFlex scales to 1,000 features, many real-world datasets (like genomics or high-resolution sensors) have tens of thousands. Scaling to these dimensions remains an open challenge.
  • Naive Regression: The current version handles regression by discretizing target values into bins, effectively turning it into a classification problem. A more principled approach involving regression-specific synthetic pre-training is needed.
  • The Synthetic Gap: Like its predecessor, TabFlex relies heavily on the quality of the synthetic data used during pre-training. Improving these synthetic "priors" to better match real-world data distributions is a priority for future iterations.

Summary updated

BibTeX
@inproceedings{zeng2025tabflex,
  author = {Yuchen Zeng and Tuan Dinh and Wonjun Kang and Andreas C Mueller},
  title = {{TabFlex: Scaling Tabular Learning to Millions with Linear Attention}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=d60cmFf89H},
}
Figure