State-Space Models for Tabular Prior-Data Fitted Networks

Felix Koch, Marcel Wever, Fabian Raisch, Benjamin Tischler

TL;DR

While TabPFN enables instant, in-context classification for tabular data, its underlying Transformer architecture hits a wall due to quadratic memory and computational complexity. This paper explores replacing the Transformer with Hydra, a bidirectional Structured State-Space Model (SSM), paired with Repeated Context Permutations (RCP) to overcome SSMs' sensitivity to row order. The resulting architecture scales linearly to datasets two orders of magnitude larger while retaining predictive performance competitive with the original Transformer.

What Problem Does This Paper Address?

Tabular Prior-Data Fitted Networks (TabPFN) approximate Bayesian inference in a single forward pass by treating a small table (training examples + query test row) as a sequence of tokens. Because standard Transformers have quadratic $\mathcal{O}(N^2)$ complexity with respect to row count $N$, TabPFN has historically been restricted to small datasets ($\le 1{,}000$ rows).

While modern Structured State-Space Models (SSMs) like Mamba achieve linear-time $\mathcal{O}(N)$ scaling, they are autoregressive/causal: tokens are processed sequentially from left to right. In tabular data, row ordering is completely arbitrary. Forcing an autoregressive bias onto tabular rows causes significant order sensitivity and degrades in-context reasoning, creating a core dilemma: How do we get linear-time sequence processing without suffering from row-order bias?

Methods

The authors evaluate two SSM architectures as drop-in replacements for the TabPFN Transformer encoder:

  1. Mamba: A unidirectional, selective SSM providing hardware-efficient linear scaling.
  2. Hydra: A bidirectional SSM using quasiseparable matrix mixers. By scanning sequences in both directions, Hydra enables symmetric context aggregation across all rows while retaining linear complexity ($\sim 2N$).

To further address order sensitivity at test time, the authors introduce Repeated Context Permutations (RCP):

  • At inference, the context rows are randomly shuffled $r$ times.
  • Predictions are generated across each permutation and their predicted probability distributions are averaged.
  • This linearly increases inference cost by a factor of $r$, but dampens the impact of unfavorable row permutations.

Both models retain TabPFN’s standard data embedding formats and marginalization routines, but were retrained on TabPFN's synthetic data prior.

Datasets

  • Pretraining Prior: Millions of synthetic classification tasks drawn from structural causal models and Bayesian neural networks.
  • Validation: 5 OpenML datasets (breast-cancer, haberman, ionosphere, sa-heart, cleave).
  • Evaluation: 30 multiclass classification datasets from the OpenML CC-18 benchmark suite, filtered to fit TabPFN’s input constraints ($\le 2{,}000$ rows, $\le 100$ features, and $\le 10$ classes). Each was tested across 16 random train/test splits.
  • Synthetic Stress Testing: Random tensors with 99 features and sequence lengths ranging from $2^5$ to $2^{18}$ rows to benchmark inference runtime and GPU memory consumption.

Key Insights and Ideas

  • Directionality is essential for tabular SSMs: The unidirectional scan of standard Mamba severely hinders tabular in-context learning because earlier rows cannot attend to later rows. Hydra's bidirectional mixing recovers this lost context, substantially closing the performance gap to Transformers.
  • Taming order dependence via ensembling: Evaluating row-order dependence using KL divergence between differently ordered runs revealed that increasing RCP iterations ($r \in \{1, 2, 4, 8, 16\}$) rapidly shrinks variance and predictive divergence, systematically smoothing out disadvantageous orderings.

Key Results

  • Scalability: On an NVIDIA H100 (80GB VRAM), the Transformer-based TabPFN ran out of memory at $2^{16}$ (~65,536) rows. Hydra scaled to $2^{17}$ (~131,072) rows in linear time, only halting at $2^{18}$ due to PyTorch's 32-bit tensor indexing limit rather than hardware VRAM exhaustion.
  • Accuracy: On OpenML CC-18, Hydra achieved an average accuracy gap of only $-1.1\%$ relative to the Transformer baseline, while beating unidirectional Mamba by $+3.6\%$ on average with substantially lower variance across datasets.
  • AUC: Hydra’s mean AUC difference relative to the Transformer was $-0.011$ (compared to $-0.033$ for Mamba), occasionally matching or outperforming the Transformer on specific datasets.

Limitations and Future Work

  • Compute Constraints: Hyperparameter tuning was strictly limited due to multi-day training times per model on an A40 GPU. The authors observed that naive batch sizes and steps-per-epoch led to catastrophic forgetting in SSMs, necessitating manual adjustments.
  • Context Ceiling in Experiments: Pretraining and benchmark evaluations were kept at 1,000 context rows to match TabPFN v1 constraints. Future evaluations should benchmark very long contexts ($>10{,}000$ rows, as explored in TabPFNv2).
  • Inference Overhead: Running multiple context permutations ($r$ passes) trades off some of the raw throughput gains of SSMs.
  • Optimal Ordering: Instead of purely random permutations, future research could explore deterministic or heuristic row-ordering strategies tailored to bidirectional state-space models.

Summary updated

BibTeX
@inproceedings{koch2025state,
  author = {Felix Koch and Marcel Wever and Fabian Raisch and Benjamin Tischler},
  title = {{State-Space Models for Tabular Prior-Data Fitted Networks}},
  booktitle = {FMSD @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=qk9bYh2viX},
}
Figure