TabFlex: Scaling Tabular Learning to Millions with Linear Attention

Yuchen Zeng, Tuan Dinh, Wonjun Kang, Andreas C. Mueller · DOI

Abstract

In-context learning (ICL) has recently emerged as a powerful paradigm for tabular data classification, allowing models like TabPFN to make predictions without dataset-specific training. However, the quadratic complexity of standard softmax attention limits these models to small datasets. We present TabFlex, which utilizes non-causal linear attention to scale ICL to millions of rows and thousands of features. TabFlex achieves significant speedups over TabPFN and XGBoost while maintaining state-of-the-art accuracy across diverse benchmarks.

Introduction

For decades, Gradient Boosted Decision Trees (GBDTs) have dominated tabular data tasks. The introduction of TabPFN shifted this landscape by treating tabular classification as a sequence modeling task, using a Transformer to perform inference in a single forward pass. Despite its success, TabPFN’s $O(N^2)$ attention mechanism is a major bottleneck for large-scale applications. TabFlex addresses this by adopting a sub-quadratic architecture designed specifically for the unique requirements of tabular data.

Architecture and Methodology

The core of TabFlex is the replacement of standard self-attention with non-causal linear attention. Unlike State-Space Models (SSMs) such as Mamba, which are inherently causal and sequential, TabFlex’s non-causal approach allows the model to attend to all training samples simultaneously. This is crucial for tabular data, where the order of rows carries no semantic meaning.

Figure 1: The TabFlex architecture uses MLP projections followed by 12 layers of non-causal linear attention to enable efficient label prediction.

To handle the wide variety of tabular data shapes, the authors introduced the TabFlex Suite, a collection of three specialized models trained on synthetic data:

  • TabFlex-S100: Optimized for small datasets (≤ 3,000 samples).
  • TabFlex-L100: Designed for large datasets with few features.
  • TabFlex-H1K: Built for high-dimensional data (up to 1,000 features).

A conditional routing algorithm automatically selects the optimal sub-model based on the input dataset's dimensions, ensuring efficient resource allocation and high predictive performance.

Experimental Results

TabFlex was benchmarked against 115 real-world datasets, including the difficult TabZilla benchmark. The results demonstrate that linear attention matches the accuracy of softmax attention while providing dramatic improvements in scalability and speed.

Figure 5: Mean Runtime and Mean AUC comparison between TabPFN and TabFlex. TabFlex offers a significant reduction in compute time while improving average accuracy.

Key performance highlights include:

  • Scale: TabFlex successfully processed the poker-hand dataset (over 1 million samples) in just 4.88 seconds.
  • Speed: The model runs up to 2x faster than TabPFN and 1.5x faster than XGBoost on standard benchmarks.
  • Versatility: Beyond tabular data, TabFlex achieved a 92.2% AUC on CIFAR-10 image embeddings, operating 400x faster than a standard ResNet.

Discussion

A critical insight from this work is that causality harms tabular learning. Experiments showed that causal masking—required by architectures like Mamba—leads to a significant drop in accuracy compared to non-causal attention. This suggests that the optimal architecture for tabular ICL is fundamentally different from those used in natural language processing. Furthermore, the authors proved that linear attention is memory-efficient enough to be implemented in standard PyTorch without custom CUDA kernels, simplifying deployment.

Conclusion

TabFlex represents a significant step forward in scaling in-context learning for tabular data. By combining non-causal linear attention with a specialized model suite, it overcomes the limitations of previous Transformer-based models, offering a fast and scalable alternative to traditional GBDTs. Future research will focus on extending this framework to regression tasks and even larger feature spaces.

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