CRUMB: Efficient Prior Fitted Network Inference via Distributionally Matched Context Batching

Jamie Heredge, Mattia J. Villani, Pranav Deshpande, Akshay Seshadri, Niraj Kumar

TL;DR

CRUMB (Clustered Retrieval Using Minimised-MMD Batching) is a training-free inference wrapper that enables Prior-Fitted Networks (PFNs) to scale efficiently to large tabular datasets. By clustering test queries and using greedy Maximum Mean Discrepancy (MMD) minimisation to select small, distributionally matched training subsets, CRUMB slashes computational costs while maintaining high accuracy and providing robust defense against covariate drift.

What Problem Does This Paper Address?

Prior-Fitted Networks (PFNs) are an exciting class of tabular foundation models that perform supervised learning via in-context learning. Instead of traditional training, the entire labeled training set is passed to the model as context, and predictions are generated in a single forward pass.

The catch? PFNs rely on self-attention mechanisms that scale quadratically ($O(N^2)$) with the number of training samples ($N$). This makes them computationally prohibitive for datasets with more than a few thousand points. While you can downsample the training data using $k$-nearest neighbors (kNN) to find relevant context points, doing this for every single test query breaks your ability to batch queries, leading to massive wall-clock delays. Other batch-friendly methods either pick irrelevant points (uniform subsampling) or suffer from shape mismatch because they cluster the training data rather than the test data.

Methods

The authors introduce CRUMB, a three-stage, architecture-agnostic inference wrapper that requires no retraining:

  1. Test-Side Clustering: Instead of clustering the training data, CRUMB partitions the incoming test queries into $K$ clusters using standard $k$-means.
  2. Distributional Context Selection: For each test cluster, CRUMB selects a small subset of training data ($n \ll N$) by greedily minimising the squared Maximum Mean Discrepancy (MMD) via kernel herding. This ensures the selected training context matches the distribution of the test cluster, balancing relevance and diversity.
  3. Batched Inference: Exact PFN inference is run $K$ times (once per cluster) using efficient, vectorized forward passes where all test queries in a cluster share the same selected context.

To make this practical on massive datasets, the authors accelerate the MMD calculation using Random Fourier Features (RFF) to approximate the kernel space, alongside batched greedy selection and an adaptive early stopping criterion.

Figure 1: Overview of CRUMB. Stage 1: Test queries are partitioned into K clusters via k-means. Stage 2: For each cluster Ck, a training subset Sk of size n ≪N is selected by greedy MMD minimisation (kernel herding), drawing from the full training pool (dashed blue arrows). Stage 3: The PFN runs K independent forward passes, each with a small, geometrically relevant context. The total attention cost reduces from T ·N to T ·n, enabling inference on datasets with N > 50,000 training points.

Datasets

The method was evaluated comprehensively on the TabArena benchmark, which consists of 51 diverse tabular classification and regression datasets spanning various sizes and difficulty levels. To investigate extreme scaling effects, the authors supplemented their experiments with the Higgs particle physics dataset (capped at 100k samples).

Key Insights and Ideas

  • Flip the Clustering Side: Traditional methods cluster training data. CRUMB clusters test data. This subtle shift means the training context dynamically aligns to where the test queries actually lie at inference time.
  • MMD vs. Geometric Proximity: Selecting points based on distribution matching (MMD) rather than just distance to a centroid ensures that the tails of the distribution are represented and dense regions don't cause redundant context selection.
Figure 2: Visual representation of the CRUMB preprocessing and context retrieval steps. We also provide visualisation of alternative context retrievals, showing how uniform subsampling and MICP could in certain cases lead to a sub-optimal context selection for a given batch of test points.
  • Natural Drift Immunity: Because CRUMB builds contexts based on the test distribution at inference time, it is inherently robust to covariate drift (when the test data distribution shifts away from the training data distribution).

Key Results

  • kNN Performance at a Fraction of the Cost: On TabArena, CRUMB achieved predictive performance statistically close to per-query kNN while requiring only $K=20$ forward passes instead of a forward pass for every single test point ($T=200$). This yielded a $10\times$ reduction in average PFN inference time (35s vs 361s).
  • Outperforming Baselines: CRUMB significantly outperformed both uniform subsampling and the Mixture of In-context Prompters (MICP) across three distinct PFN architectures (TabPFNv2, TabICLv1, TabICLv2).
  • Graceful Degradation under Drift: Under extreme out-of-distribution covariate drift, CRUMB's performance degraded gracefully (-9.5% accuracy drop), whereas MICP collapsed (-21.8% drop), widening CRUMB's advantage over MICP to +17.1%.

Limitations and Future Work

  • Batch Requirement: CRUMB requires a batch of test queries upfront to perform $k$-means clustering, making it less suited for true online, one-at-a-time streaming inference (though the authors propose a cached-centroid variant to mitigate this).
  • Geometric Assumptions: The clustering stage relies on Euclidean $k$-means and isotropic Gaussian RBF kernels, which assume roughly isotropic cluster geometry and may struggle with highly high-dimensional or mixed-type categorical/numerical tabular spaces.
  • PFN Ceiling: As a pure inference wrapper, CRUMB cannot exceed the performance ceiling of the underlying pretrained PFN model.

Future work includes exploring how CRUMB interacts with downstream context-aware fine-tuning methods to unlock further performance gains.

Summary updated

BibTeX
@inproceedings{heredge2026crumb,
  author = {Jamie Heredge and Mattia J. Villani and Pranav Deshpande and Akshay Seshadri and Niraj Kumar},
  title = {{CRUMB: Efficient Prior Fitted Network Inference via Distributionally Matched Context Batching}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=z3XMLStVPC},
}
Figure