When to Trust a PFN: Detecting Harmful Shift in Tabular Foundation Models

Viet Nguyen, Herman Bergström, Stephan Rabanser, Rahul G Krishnan

TL;DR

Tabular foundation models like TabPFN can classify brand-new datasets in a single forward pass without training, yet they fail silently when real-world data drifts away from their prompt context. This paper introduces CALD, a lightweight safety monitor that briefly tugs on the model's decoder to see how easily it can be forced to change its mind on unlabeled deployment data. By reading the resulting optimization tension, CALD reliably flags genuinely harmful distribution shifts while staying remarkably quiet during harmless ones.

What Problem Does This Paper Address?

For years, gradient-boosted trees ruled tabular data. Recently, Prior-Fitted Networks (PFNs) like TabPFN and TabICL changed the game by using in-context learning: you feed a labeled training set ("support") and unlabeled test features ("query") into one prompt, and the frozen network outputs predictions in a single pass.

Because PFNs are pre-trained on millions of synthetic datasets where support and query sets come from the exact same distribution, they quietly break when real-world deployment data shifts. Standard statistical tests can spot input changes, but they are "label-agnostic"—meaning they cry wolf on benign shifts where inputs look different, yet the model’s accuracy is completely fine. Meanwhile, clever "model disagreement" detectors—which test how easily perturbed models disagree on new data—require training ensembles or modifying task-specific weights, which is prohibitively expensive and unnatural for a frozen, task-agnostic PFN. The authors ask: how do we know when to trust a PFN at deployment without test labels or full retraining?

Methods

The authors propose CALD (Calibrated Anchor-Loss Disagreement), a two-phase monitoring mechanism that only briefly fine-tunes the PFN's lightweight decoder ($T=50$ steps) while keeping the rest of the network frozen.

Overview of CALD in three steps: Setup, Calibration, and Deployment
  1. The Tug-of-War Objective: Alongside the in-context support set, CALD holds onto a small, labeled in-distribution (ID) anchor set and takes in an unlabeled evaluation batch. It gets the PFN's initial predictions ("pseudolabels") on the eval batch, then fine-tunes the decoder on a dual objective: stay accurate on the anchor set, while maximizing disagreement with its own initial pseudolabels on the eval batch.
  2. Calibration & Deployment: Rather than looking at the eval predictions, CALD reads the post-finetune anchor loss ($\lambda$). In the calibration phase, it runs this tug-of-war across $K$ known-ID batches to build a baseline distribution of $\lambda$. At deployment, it runs the exact same procedure on the mystery test batch (resetting weights afterward) and triggers an out-of-distribution (OOD) alarm if $\lambda^*$ drops into the lower tail (e.g., bottom 5%) of the calibration distribution.

Datasets

CALD is evaluated across 14 datasets split into two shift regimes (and categorized into 7 benign and 7 harmful shifts based on actual accuracy drop):

  • Raw tabular shifts (7): UCI Heart Disease, Diabetes Readmission, Adult Income, Bank Marketing, Credit Default, Covertype, and Folktables ACS Income.
  • Structured shifts via foundation-model embeddings (7): Image and text benchmarks—Camelyon17, CIFAR-10$\rightarrow$10.1, PACS, Waterbirds, CelebA, CivilComments, and Amazon Reviews—encoded into tabular features using frozen DINOv2, ResNet-18, or Jina-v3 models.

Key Insights and Ideas

  • Lower loss means higher danger: Intuitively, you might expect OOD data to cause higher loss. Here, the exact opposite happens! When an eval batch is safely in-distribution, forcing the model to disagree with itself directly fights the features needed to keep the ID anchor accurate—the gradients clash ($\langle g_a, g_e \rangle < 0$), keeping anchor loss $\lambda$ stubbornly high. When the eval batch is OOD, its representations sit elsewhere; the disagreement gradients are small and nearly orthogonal ($\approx 0$) to the anchor gradients, allowing the optimizer to easily drive $\lambda$ down.
  • Decoder capacity drives subgroup sensitivity: TabICL consistently beats TabPFN on subtle subpopulation shifts (like Waterbirds and Camelyon17). Why? TabICL's decoder has roughly an order of magnitude more parameters than TabPFN's, giving the disagreement optimization enough expressivity to separate subtle group shifts rather than just global feature displacements.
  • Alarms scale with harm: Empirically, as shift severity dials up, CALD's detection signal rises smoothly alongside the model's actual accuracy drop, rather than firing blindly at slight input novelty.

Key Results

Tested on TabPFN v2.5 and TabICL v2 against 15 post-hoc OOD baselines (using True Positive Rate at a 5% False Positive Rate):

Table 1: Detection performance (TPR@5% FPR) across 14 shifts ordered by harm. Columns are sorted by ID→OOD accuracy drop ∆(second header row, %). Harmful/benign split via Hoeffding bound at δ = 0.05, N = min(rounds×eval, |DOOD|) = 1,280 from the deterioration survey of Appendix C.3: ∆∗≈4.8%. For harmful shifts (∆>∆∗), TPR = rate of correct alarms. For benign shifts (∆≤∆∗), TPR = rate of correct silence (1 −false-alarm rate). A good detector scores high in both regions.
  • Harmful shifts: The stronger CALD variant hits $\ge 0.99$ TPR on 6 of the 7 harmful shifts (CivilComments, Camelyon17, Waterbirds, CIFAR, PACS, Covertype), reaching 0.71 on UCI Heart.
  • Benign shifts (where silence = success): CALD achieves $\ge 0.92$ correct silence on 4 of 7 benign shifts (reaching 1.00 on Adult, 0.98 on Folktables-TabPFN, and 0.97 on CelebA-TabICL).
  • Winning the trade-off: Label-blind baselines like D-MMD and KNN catch harmful shifts ($\ge 0.95$ TPR) only because they always alarm, scoring $\le 0.10$ silence on most benign shifts. Conversely, conservative baselines like RMD stay quiet on benign shifts but collapse to $0.40\text{–}0.67$ TPR on moderate harmful shifts. CALD is the only method achieving high accuracy on a majority of both.

Limitations and Future Work

  • The ceiling of label-blind monitoring: Because CALD has no test labels, it operates in feature space. If a benign shift moves massive amounts of data around in regions where the model still classifies accurately, gradient geometry changes anyway and CALD false-alarms (as seen on Bank Marketing and Diabetes Readmission, where silence drops to $\le 0.08$).
  • Theoretical vs. practical bounds: The authors' formal proof guarantees separation in the strict "far-OOD" limit, though direct gradient measurements confirm the mechanism drives near-OOD detection too. Additionally, the strict Type-I error guarantee requires fixed hyperparameters rather than tuning learning rates on known OOD trajectories.
  • Out-of-scope shifts & next steps: Because calibration relies on covariate exchangeability, pure label shift, concept shift (where $p(y|x)$ changes), and adversarial inputs are out of scope. For future work, the authors suggest probing gradients with respect to the in-context support set itself—measuring how disagreement-labeled test points placed directly into the prompt alter anchor predictions.

Summary updated

Abstract

Tabular prior-fitted networks (PFNs) work well across tabular classification problems but can fail silently at deployment when distributions shift. We propose **CALD** (Calibrated Anchor-Loss Disagreement), a lightweight unsupervised monitor that triggers an alarm to warn when a PFN might fail. By finetuning the decoder to maximize disagreement with the test-set prediction while maintaining accuracy on an ID anchor set, **CALD** identifies harmful OOD batches through the resulting anchor loss, requiring no labels on test batches. We prove that the post-finetune anchor loss has a strictly lower expectation under sufficiently severe shift than under ID eval, yielding a one-sided test. Across 14 datasets covering tabular and structured distribution shift, on both TabPFN and TabICL, **CALD** matches or outperforms baselines on harmful shifts and is markedly more resilient to benign-shift false alarms.
BibTeX
@inproceedings{nguyen2026when,
  author = {Viet Nguyen and Herman Bergström and Stephan Rabanser and Rahul G Krishnan},
  title = {{When to Trust a PFN: Detecting Harmful Shift in Tabular Foundation Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ixQvsT5Hku},
}
Figure