TabClustPFN: A Prior-data Fitted Network for Tabular Data Clustering

Tianqi Zhao, Guanyang Wang, Yan Shuo Tan, Qiong ZhangNeurIPS 2026

TL;DR

Clustering tabular data usually means an exhausting cycle of guessing the number of clusters ($K$), choosing an algorithm, and praying your hyperparameters fit the data's geometry. TabClustPFN turns this headache into a single neural network forward pass—no dataset-specific tuning required. By pretraining a transformer on millions of diverse synthetic datasets, it simultaneously figures out how many clusters exist and who belongs where, beating classical and modern baselines at the speed of simple $k$-means.

What Problem Does This Paper Address?

Recently, Prior-data Fitted Networks (PFNs) like TabPFN revolutionized supervised tabular learning. Instead of training a new model on your spreadsheet, you feed the whole dataset into a pretrained transformer, and it outputs predictions in one pass via in-context learning.

Bringing this magic to unsupervised clustering is much trickier. Without ground-truth labels in the context window, a model faces three fundamental hurdles:

  1. No supervision signal: What even is a cluster? The model must learn an intuitive "inductive bias" for grouping complex, mixed-type tabular data purely from synthetic pretraining.
  2. Unknown cardinality ($K$): Nobody tells the model how many clusters to look for.
  3. Label switching: Calling two groups "Cluster A and B" is identical to calling them "Cluster B and A." Standard cross-entropy losses panic over this symmetry, penalizing valid partitions just because the IDs are swapped.

Previous PFN-based attempts either punted on $K$ (relying on $k$-means downstream) or tried to fix label switching with brittle geometric rules—like sorting clusters by their distance to the origin—which fall apart in high dimensions.

Methods

TabClustPFN tackles all three hurdles at once by co-designing its synthetic training data, architecture, and loss function.

Overview of the TabClustPFN architecture, showing the decoupled Partition Inference Network (PIN) and Cardinality Inference Network (CIN).
  • Hybrid Synthetic Prior: The model never sees real data during pretraining. Instead, it trains on on-the-fly synthetic datasets combining standard Gaussian Mixture Models (with explicitly controlled overlap difficulty) and "ZEUS priors"—latent Gaussians warped through nonlinear invertible neural networks (iResNets) alongside categorical features to mimic messy real-world tables.
  • Decoupled PIN–CIN Architecture: Mirroring probability rules, the model splits the problem in two:
  • The Partition Inference Network (PIN) takes the data (encoded via a standard TabICL transformer) and a candidate $K$, using iterative cross-attention without positional encodings to co-refine data points and $K$ learnable cluster prototypes.
  • The Cardinality Inference Network (CIN) runs PIN across all candidate $K \in \{2, \dots, 10\}$ simultaneously. For each $K$, it builds a Gram matrix ($P^\top P$) capturing cluster sizes (diagonal) and inter-cluster overlap (off-diagonal), sorts them separately to erase label order, and feeds them to an MLP to predict the probability of each $K$.
  • SoftARI & Decoupled Training: Instead of forcing arbitrary label orders or running slow matching algorithms during training, PIN is trained directly on SoftARI—a differentiable relaxation of the Adjusted Rand Index that is naturally permutation-invariant. Crucially, CIN's gradients are detached from PIN so counting clusters doesn't corrupt grouping them.

Datasets

  • Pretraining: 100% synthetic datasets generated on the fly ($N \in [500, 1000]$ samples, $D \in [2, 64]$ features, $K \in [2, 10]$ clusters) over 10,000 steps (512 datasets per batch).
  • Evaluation: 49 held-out synthetic datasets, 160 2D-GMM datasets for comparing against amortized clustering models, and a newly curated real-world benchmark of 44 tabular datasets (22 from OpenML, 22 from UCI, deduplicated and stripped of synthetic tasks). Six larger real-world datasets ($D$ up to 500, $N < 3000$) are also used for out-of-distribution (OOD) testing.

Key Insights and Ideas

  • Reshaping geometry for prototypes: Visualizing the learned embeddings reveals why TabClustPFN works so well: while raw features or competing embeddings (like ZEUS) often leave clusters stretched into awkward, anisotropic ribbons that fool standard selection metrics, PIN actively warps complex distributions into clean, spherical blobs around its prototypes.
  • Don't mix your gradients: Training PIN and CIN jointly with a simple summed loss actually hurts performance. Partitioning data and counting clusters require different structural cues; detaching CIN so its gradients don't flow back into PIN stabilizes representations and boosts real-world accuracy.
  • Skip the Hungarian matching: Resolving label switching with SoftARI isn't just mathematically cleaner than optimal matching + cross-entropy—it cuts per-iteration pretraining time in half (2.97 ms vs. 6.26 ms).
  • Well-calibrated uncertainty: When clusters heavily overlap, CIN doesn't just guess blindly; its probability distribution over $K$ flattens out, providing well-calibrated uncertainty sets (e.g., a 95% nominal confidence set empirically covers the true $K$ 96.8% of the time).
Figure 4: PIN representations & CIN pos- teriors. Columns show R(L), other K, and ˆp(K|X).

Key Results

Clustering time versus median ARI rank on the real-world benchmark, showing TabClustPFN achieving the best rank with low runtime.

Figure 1: Time & median ARI rank (lower is better). TabClustPFN achieves the best ARI with runtime comparable to simple meth- ods and faster than other PFN-based methods.
  • Real-World SOTA: Across the 44 real-world datasets and 31 baselines, TabClustPFN ranks #1 overall when $K$ is known (median ARI rank 7.50) and #2 overall when inferring $K$ itself (rank 8.50)—matching two-stage PFN baselines even when those baselines are handed the true $K$ as an oracle.
  • Spot-on $K$ Estimation: On synthetic benchmarks, TabClustPFN achieves a median absolute error in $K$ ($k$-MAE) of 0, and about 1.0 on real-world data (vs. 5.0–8.0 for other PFN-based methods).
  • Fast & Frugal: Pretraining takes ~92 GPU hours on four RTX 5090s. At test time, it clusters datasets in ~71 ms on amortized benchmarks—a 4× speedup over the fastest deep amortized baseline (DAC) while boosting median ARI from 0.6000 (NCP) to 0.7893.

Limitations and Future Work

Because of pretraining compute budgets, TabClustPFN is tailored for moderate regimes ($N \le 1000$, $D \le 64$, $K \in [2, 10]$, excluding $K=1$). While out-of-distribution tests show it scales smoothly up to $N = 10,000$ samples, extrapolating to much higher feature dimensions ($D > 64$) degrades CIN's ability to count clusters—a gap only partially patched by applying PCA beforehand.

Moving forward, scaling to higher dimensions will require broader pretraining, while raising the ceiling beyond $K_{\max}=10$ requires expanding the prototype bank and retraining CIN. Finally, baking missing values and noise directly into the synthetic priors could make the model far more resilient to dirty real-world tables.

Summary updated

Abstract

Prior-data Fitted Networks (PFNs) have reframed supervised tabular learning as single-pass in-context inference without per-dataset optimization. Extending this paradigm to clustering is appealing yet fundamentally more challenging, due to absent supervision, unknown cluster cardinality, and label switching inherent to partition outputs. Existing PFN-based clustering methods address these challenges only partially, either requiring known cardinality as input or relying on unstable label-ordering conventions and overly restrictive synthetic priors. We introduce TabClustPFN, a clustering PFN that resolves all challenges jointly through co-designed prior, objective, and architecture. Our hybrid pretraining prior captures heterogeneous real-tabular geometry; our decoupled partition inference network-cardinality inference network architecture jointly infers cluster assignments and cardinality in a single pass; and our SoftARI training objective is permutation-invariant by construction, eliminating the need for any label-ordering convention. On a 44 curated real-world tabular benchmark, TabClustPFN achieves state-of-the-art clustering performance against classical, deep, and amortized baselines, with runtime comparable to efficient baselines. Code is available at https://github.com/Tianqi-Zhao/TabClustPFN.
BibTeX
@inproceedings{zhao2026tabclustpfn,
  author = {Tianqi Zhao and Guanyang Wang and Yan Shuo Tan and Qiong Zhang},
  title = {{TabClustPFN: A Prior-data Fitted Network for Tabular Data Clustering}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=kgZzOmPAq0},
}
Figure