When Does Depth Help? Understanding Layerwise Inference in Tabular Foundation Models
Organizations: China Agricultural University · Tsinghua University · Nankai University
Abstract
Transformer-based tabular foundation models (TFMs) achieve state-of-the-art performance on small to medium-sized tabular prediction tasks while processing diverse inputs through a shared stack of layers. Recent layerwise analyses identify strong predictive performance in early TFM representations and substantial overlap in computation across layers. However, early predictive accessibility alone does not establish whether later layers are dispensable for every input, and aggregate accuracy can obscure which inputs benefit from additional computation. We study all 24 in-context-learning layers of TabPFN-3 across 272 classification datasets, combining representation geometry, prediction trajectories, truncation, and structural interventions, while also examining related representation dynamics in four additional TFMs. We uncover a pronounced expansion-compression trajectory, with stronger late dimensional contraction associated with larger increases in class-prototype separation. A targeted analysis of early-stabilizing samples shows that substantial representational changes persist after predicted classes stabilize, while locally ambiguous queries obtain larger accuracy gains from shallow to late layers than well-separated queries. Repeating a single pretrained block or perturbing layer order reduces predictive performance on average, constraining simple post-hoc substitutions in the frozen model. These findings distinguish predictive accessibility, class stability, and the benefits of continuing computation, supporting an input-dependent assessment of depthwise redundancy in TFMs.
Figures & tables
Appendix figures & tables43 assets
Supplementary material from the paper’s appendix.
Appendix
| Component | Hyperparameter | Value |
| Stage 1: Feature-distribution embedding | ||
| Base embedding dimension | 128 | |
| Features per circular-shift group | 3 | |
| Induced-attention blocks | 3 | |
| Attention heads | 8 | |
| Inducing points per column | 128 | |
| Model | Parameters | ICL depth | ICL dim. | Pre-ICL stages | Normalization |
|---|---|---|---|---|---|
| TabPFN-v2 | 7.24M | 12 | 192 | Alternating feature/item attention | Post-LN |
| TabPFN-2.5 | 10.72M | 24 | 192 | Alternating feature/item attention | Post-LN |
| TabPFN-3 | 53M | 24 | 512 | Column embedding + row aggregation | RMSNorm |
| TabICL | 27.05M | 12 | 512 | TFcol (3) + TFrow (3) | Pre-LN |
| TabICLv2 | – | 12 | 512 | TFcol (3) + TFrow (3) | Pre-LN |
| Component | TabPFN-v2 | TabPFN-2.5 |
|---|---|---|
| Total parameters | ||
| Feature encoder | 768 | 1,152 |
| Label encoder | 576 | 576 |
| Positional embedding | 9,408 | 9,408 |
| Transformer depth | 12 | 24 |
| Transformer-block parameters |
| Stage | Component | Parameters |
| Column embedder | Total | 877,824 |
| Input linear | 256 | |
| Transformer blocks (3) | 844,032 | |
| Each block | 281,344 | |
| Attention 1 | ||
| MLP 1 |
| Stage | Hyperparameter | Value |
| Layers | 3 | |
| Inducing vectors | 128 | |
| Model dimension | 128 | |
| Attention heads | 8 | |
| Layers | 3 | |
| Model dimension | 128 |
| Layer | Role in subsequent analyses |
|---|---|
| L9 | Early-depth anchor; end of the expansion summary interval |
| L13 | Intermediate plateau anchor |
| L17 | Late-depth anchor; start of the compression summary interval |
| L20 | Late-depth anchor near the aggregate ED maximum |
| L23 | Final-layer representation |
| Model | Depth | Expansion | Compression | Final ED | Late PCA |
|---|---|---|---|---|---|
| TabPFN-v2 | 12 | ||||
| TabPFN-2.5 | 24 | ||||
| TabICL | 12 | ||||
| TabICLv2 | 12 |
| Dataset | Pretrained | Randomized ICL blocks | Fully randomized |
|---|---|---|---|
| vehicle | |||
| segment | |||
| satimage | |||
| diabetes |
| Depth | ED trajectory | Expansion | Compression |
|---|---|---|---|
| 3 layers | |||
| 4 layers | |||
| 5 layers |
| Measurement | FT-Transformer |
|---|---|
| Mean expansion ratio | |
| Mean compression ratio | |
| Characteristic trajectory | Predominantly contraction |
| Model | MLP Acc. | Positive | ECE | MLP NLL |
|---|---|---|---|---|
| TabPFN-3 | +0.027 | 64% | -0.005 | -0.056 |
| TabICL | +0.029 | 66% | -0.017 | -0.179 |
| TabICLv2 | +0.020 | 59% | -0.008 | -0.104 |
| Phase | ED | Linear Acc. | MLP Acc. | MLP NLL |
|---|---|---|---|---|
| Expansion | +10.95 | +0.0274 | +0.0278 | -0.291 |
| Plateau | +0.95 | +0.0093 | +0.0150 | -0.011 |
| Compression | -10.55 | -0.0040 | +0.0045 | +0.023 |
| Full depth | +1.40 | +0.0327 | +0.0473 | -0.279 |
| Threshold | Exp. | Comp. | ||
|---|---|---|---|---|
| 80% | 2.41 | 2.80 | 95% | 100% |
| 85% | 2.40 | 2.57 | 95% | 100% |
| 90% | 2.45 | 2.24 | 95% | 95% |
| 95% | 2.54 | 1.84 | 100% | 100% |
| Representation | ||
|---|---|---|
| Raw | 4.00 | 2.41 |
| Row normalization | 3.70 | 2.35 |
| Column standardization | 3.16 | 1.69 |
| Whitening | 4.00 | 2.41 |
| Metric | L0 | L9 | L13 | L17 | L20 | L23 | Consistent |
|---|---|---|---|---|---|---|---|
| Normalized candidate entropy | .997 | .994 | .995 | .993 | .992 | .978 | 104/105 |
| Active candidate fraction | .932 | .599 | .486 | .529 | .465 | .465 | 103/105 |
| Prototype margin | .055 | .125 | .104 | .129 | .147 | .247 | 104/105 |
| Mean correct-class rank | 2.082 | 1.753 | 1.803 | 1.727 | 1.689 | 1.645 | 104/105 |
| Correct-class top-rank rate | .634 | .731 | .710 | .729 | .739 | .770 | 104/105 |
| Statistic | Value |
|---|---|
| L0 attn@V accuracy | .460 |
| L2 attn@V accuracy | .718 |
| L23 attn@V accuracy | .600 |
| Mean uniform@V accuracy | .334 |
| Expansion mean | .667 |
| Plateau mean | .664 |
| Statistic | Value |
|---|---|
| Matched datasets | 105 |
| Analysis interval | L20–L23 |
| Spearman | .511 |
| -value | |
| Bootstrap 95% CI | |
| Leave-one-dataset-out range |
| Pattern | Representative form | Assignment criterion |
|---|---|---|
| ES | ||
| TS | ||
| IS | ||
| LS | ||
| MS | otherwise |
| Pattern | Pooled samples | Dataset macro-average |
|---|---|---|
| ES | 72.2% | 71.6% 22.3% |
| TS | 15.8% | 15.9% 10.9% |
| IS | 5.3% | 5.3% 5.2% |
| LS | 5.8% | 6.1% 8.0% |
| MS | 1.0% | 1.1% 3.5% |
| Difficulty | ES | TS | IS | LS | MS |
|---|---|---|---|---|---|
| Easy | 86.3% | 9.5% | 2.1% | 2.0% | 0.2% |
| Medium | 74.5% | 15.0% | 4.0% | 5.4% | 1.1% |
| Hard | 54.2% | 23.2% | 9.8% | 10.9% | 1.9% |
| Representative depths | ES | TS | IS | LS | MS |
|---|---|---|---|---|---|
| Default | 72.2% | 15.8% | 5.3% | 5.8% | 1.0% |
| 72.1% | 15.5% | 4.9% | 6.5% | 1.1% | |
| 72.3% | 16.7% | 5.0% | 5.0% | 1.0% | |
| 72.2% | 15.8% | 6.1% | 4.9% | 1.1% | |
| 72.1% | 15.5% | 5.9% | 5.5% | 1.0% |
| Difficulty definition | Spearman | 95% bootstrap CI | ||
|---|---|---|---|---|
| Raw error | 272 | 0.775 | [0.702, 0.831] | |
| Chance-normalized | 272 | 0.694 | [0.614, 0.761] | |
| Balanced error | 272 | 0.505 | [0.389, 0.608] | |
| Majority-normalized | 272 | 0.361 | [0.240, 0.469] |
| Statistic | ES-only result |
|---|---|
| Analyzed datasets | 60 |
| ES queries | 23,737 |
| ES prevalence range | 88.2–100% |
| Mean ED at L9 | 22.8 |
| Mean ED at L20 | 28.0 |
| Mean ED at L23 | 13.3 |
| Pattern | Pooled median [IQR] | Datasets | Dataset median [IQR] |
|---|---|---|---|
| ES | 1.52 [1.11, 2.50] | 270 | 1.90 [1.34, 6.26] |
| TS | 1.03 [0.85, 1.34] | 263 | 1.15 [1.05, 1.39] |
| IS | 0.97 [0.76, 1.16] | 251 | 1.03 [0.96, 1.17] |
| LS | 0.96 [0.72, 1.16] | 251 | 1.04 [0.97, 1.17] |
| MS | 0.81 [0.61, 1.01] | 93 | 0.87 [0.71, 1.02] |
| Comparison | Shared datasets | Median | ES higher | Holm |
|---|---|---|---|---|
| ES TS | 263 | 0.57 | 94.7% | |
| ES IS | 251 | 0.78 | 96.5% | |
| ES LS | 251 | 0.72 | 94.8% | |
| ES MS | 93 | 0.86 | 94.5% |
| Truncation metric | 95% CI | ||
|---|---|---|---|
| Accuracy, L13 | .551 | [.443, .643] | |
| Balanced accuracy, L13 | .468 | [.365, .561] | |
| Accuracy, L17 | .481 | [.366, .583] | |
| Balanced accuracy, L17 | .408 | [.300, .504] | |
| Accuracy, L20 | .344 | [.220, .456] | |
| Balanced accuracy, L20 | .308 | [.191, .419] |
| Depth | Native Acc. | Native NLL | Matched Acc. | Matched NLL |
|---|---|---|---|---|
| L2 | .804 | .490 | .822 | .459 |
| L5 | .831 | .434 | .832 | .464 |
| L8 | .845 | .409 | .831 | .460 |
| L9 | .848 | .402 | .842 | .414 |
| L13 | .848 | .408 | .847 | .409 |
| L17 | .859 | .396 | .847 | .421 |
| Shallow reference | Retain (%) | Rescue (%) | ||
|---|---|---|---|---|
| L8 | 83.6 95.8 | 32.0 53.7 | +0.203 | +0.253 |
| L9 | 83.2 95.9 | 30.4 50.2 | +0.187 | +0.244 |
| L10 | 85.0 96.1 | 28.1 51.9 | +0.194 | +0.240 |
| Metric | Standard | Shared | |
|---|---|---|---|
| Compression ratio | |||
| FDR gain |
| Dataset | Standard 24-layer | Shared |
|---|---|---|
| vehicle | ||
| segment | ||
| satimage | ||
| diabetes |
| Dataset | Clean | 20% label noise | Feature noise | Half samples |
|---|---|---|---|---|
| adult | +.005 | +.030 | .000 | +.050 |
| cmc | +.030 | +.065 | +.035 | +.090 |
| credit-g | +.030 | +.015 | +.040 | +.085 |
| diabetes | -.019 | +.045 | +.013 | .000 |
| balance-scale | +.232 | +.288 | +.056 | +.256 |
| vehicle | +.312 | +.194 | +.153 | +.171 |
| Metric | Learned | Perturbed | Learned better | |
|---|---|---|---|---|
| Compression, shuffled | 1.935 | 1.053 | 60/60 | |
| Compression, reversed | 1.935 | 1.012 | 60/60 | |
| Accuracy, shuffled | .806 | .650 | 58/60 | |
| Accuracy, reversed | .806 | .682 | 56/60 |