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.
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.
Key performance highlights include:
- Scale: TabFlex successfully processed the
poker-handdataset (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