When Less Compute Is More: Adaptive Early Exit Improves Pretrained Outlier Detection
Organizations: Carnegie Mellon University
Abstract
Pretrained tabular foundation models process every dataset at a fixed depth, with inference costs growing with dataset size. To address this, we present the first study of depth-adaptive early-exit for pretrained outlier detection models. While early-exit is typically motivated by efficiency, we uncover a surprising benefit: exiting at the optimal intermediate layer can also improve detection performance on diverse real-world benchmarks by 4.7-7.3% on average, consistent across three distinct foundation models. First, we investigate the factors driving these gains, and identify a key mechanism: context pollution, i.e., the presence of outliers among in-context samples. Our analysis reveals that nearby in-context samples exert increasing influence on query predictions at greater depths, consistent with a retrieval-based view of these models. In effect, early-exit alleviates the adverse effects of retrieving accurate-yet-polluted neighbors, with gains of 13-21% when context pollution matches the natural outlier rate. Motivated by these findings, we pretrain a plug-in router to select a dataset-specific exit layer, using query outlier labels as privileged information available only during router training. The router operates post hoc, leaving the base model parameters and prediction head unchanged. Experiments on three large real-world benchmarks show that, on clean context, the router recovers up to 45% of the oracle gain with up to 1.8x speedup across three pretrained backbones, with larger gains as context pollution increases.
Figures & tables
| Backbone | OddBench (690) | OvRBench (755) | ADBench (47) | |||
|---|---|---|---|---|---|---|
| OutFormer | ||||||
| TACTIC | ||||||
| ICLAD | ||||||
| OddBench | OvRBench | ADBench | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Backbone | Method | PFLOPs | Time (s) | Speedup ( ) | AUROC gain ( ) | PFLOPs | Time (s) | Speedup ( ) | AUROC gain ( ) | PFLOPs | Time (s) | Speedup ( ) | AUROC gain ( ) |
| OutFormer ( ) | Full depth | 2.29 | 111 | – | – | 3.07 | 146 | – | – | 0.21 | 9.9 | – | – |
| rOUT | 1.21 | 69.0 | 1.61 | +2.8% | 1.48 | 82.4 | 1.77 | +3.0% | 0.11 | 6.0 | 1.64 | +0.9% | |
| ICLAD ( ) | Full depth | 2.04 | 70.6 | – | – | 2.64 | 89.9 | – | – | 0.18 | 6.4 | – | – |
| rOUT | 1.25 | 53.1 | 1.33 | +0.8% | 1.36 | 56.7 | 1.59 | +1.4% | 0.087 | 3.8 | 1.67 | +0.0% | |
| TACTIC ( ) | Full depth | 2.71 | 183 | – | – | 3.64 | 246 | – | – | 0.25 | 17.0 | – | – |
| Held-out Pollution | OddBench | OvRBench | ADBench | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Method | Clean | 1:4 | 1:2 | 1:1 | Clean | 1:4 | 1:2 | 1:1 | Clean | 1:4 | 1:2 | 1:1 |
| Oracle | .802 | .757 | .741 | .719 | .756 | .706 | .684 | .657 | .887 | .841 | .813 | .773 |
| Best fixed layer | .746 | .666 | .637 | .606 | .713 | .634 | .601 | .563 | .854 | .771 | .726 | .666 |
| Full depth | .740 | .646 | .616 | .580 | .709 | .625 | .594 | .556 | .853 | .760 | .704 | .636 |
| Half depth | .745 | .651 | .622 | .587 | .707 | .623 | .594 | .562 | .843 | .747 | .694 | .626 |
| LA-Entropy | .709 | .657 | .639 | .612 | .680 | .627 | .606 | .579 | .770 | .723 | .706 | .689 |
| OutFormer | Odd | OvR | AD |
|---|---|---|---|
| rOUT (full) | .761 | .730 | .860 |
| w/o | 1.5 ∗∗∗ | 2.0 ∗∗∗ | 0.5 |
| w/o | 0.6 ∗∗∗ | 0.6 ∗∗ | 0.4 ∗ |
| w/o PI | 2.0 ∗∗∗ | 2.4 ∗∗∗ | 1.2 ∗ |
| w/o layer attention | 0.8 ∗∗ | 0.7 ∗∗∗ | 1.2 ∗ |
| w/o additional feat. | 1.7 ∗∗∗ | 1.0 ∗∗∗ | 1.5 ∗ |
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
| Feature | Count | Definition |
|---|---|---|
| Neighbor distances | 21 | For each : log mean distance to the nearest context rows, its percentile among context rows, and log mean distance to the nearest other query rows |
| Distance to center | 2 | Standardized distance from the context mean, as a log value and as a percentile |
| Local density | 4 | For each : local outlier factor and reverse-neighbor count |
| Boundary and duplicate | 2 | Fraction of features at the boundary of the quantile transform; whether an exact copy exists in the context |
| Stage 1 | Stage 2 | |
| query labels shown | privileged inputs withdrawn | |
| Epochs | 12 | 8 |
| Batch size (datasets) | 64 | 32 |
| Peak learning rate | ||
| Warmup steps | 300 | 100 |
| Training time (hours, one H100) | ||
| Median per dataset | |||||
|---|---|---|---|---|---|
| Benchmark | Tables | Datasets | rows | columns | anomalies |
| OddBench | real | 690 | 7,504 | 6 | 9.2% |
| OvRBench | real | 755 | 5,610 | 10 | 18.7% |
| ADBench | real | 47 | 4,207 | 19 | 18.2% |
| SynBench | synthetic | 800 | 3,202 | 49 | 25.8% |
| Prior family | Mechanisms | Context | Train | Val | Held out |
|---|---|---|---|---|---|
| OutFormer priors | GMM, Copula-Dependence, Copula-Probability, SCM-Structure, SCM-Measurement | clean polluted | 17,298 51,878 | 1,000 1,000 | 999 1,000 |
| TabPFN priors | class relabeling: One-vs-Rest, One-vs-One, Many-vs-Rest | clean polluted | 71,376 70,943 | 2,037 2,016 | 2,081 2,048 |
| Total | 211,495 | 6,053 | 6,128 |
| Hyperparameter | Values | Description |
| Each dataset | ||
| , rounded | Dimensionality of data | |
| Rows per dataset, context and query together | ||
| Context rows, a uniform draw from the grid with step 250; inliers only in the clean pools | ||
| Query rows, 250 to 4,500, all of them scored | ||
| , capped at | Outlier rate among the query rows | |
| OddBench | OvRBench | ADBench | |||||
|---|---|---|---|---|---|---|---|
| Backbone | PFLOPs | Time (s) | PFLOPs | Time (s) | PFLOPs | Time (s) | |
| OutFormer ( ) | Full depth | 2.29 | 111 | 3.07 | 146 | 0.21 | 9.9 |
| rOUT total | 1.21 | 69.0 | 1.48 | 82.4 | 0.11 | 6.0 | |
| backbone to exit | 1.15 | 57.8 | 1.42 | 70.5 | 0.11 | 5.1 | |
| router calls | 0.051 | 7.6 | 0.055 | 8.1 | 0.003 | 0.5 | |
| extra features | 0.006 | 3.6 | 0.006 | 3.7 | 0.000 | 0.4 | |
| Held-out Pollution | OddBench | OvRBench | ADBench | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Backbone | Method | Clean | 1:4 | 1:2 | 1:1 | Clean | 1:4 | 1:2 | 1:1 | Clean | 1:4 | 1:2 | 1:1 |
| OutFormer ( ) | Oracle | .802 | .757 | .741 | .719 | .756 | .706 | .684 | .657 | .887 | .841 | .813 | .773 |
| Best fixed layer | .746 | .666 | .637 | .606 | .713 | .634 | .601 | .563 | .854 | .771 | .726 | .666 | |
| Full depth | .740 | .646 | .616 | .580 | .709 | .625 | .594 | .556 | .853 | .760 | .704 | .636 | |
| Half depth | .745 | .651 | .622 | .587 | .707 | .623 | .594 | .562 | .843 | .747 | .694 | .626 | |
| LA-Entropy | .709 | .657 | .639 | .612 | .680 | .627 | .606 | .579 | .770 | .723 | .706 | .689 | |
| Near-duplicate Pollution | OddBench | OvRBench | ADBench | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Backbone | Method | Clean | 1:4 | 1:2 | 1:1 | Clean | 1:4 | 1:2 | 1:1 | Clean | 1:4 | 1:2 | 1:1 |
| OutFormer ( ) | Oracle | .802 | .764 | .745 | .720 | .756 | .708 | .686 | .656 | .887 | .851 | .823 | .785 |
| Best fixed layer | .746 | .669 | .639 | .608 | .713 | .628 | .593 | .568 | .854 | .794 | .745 | .675 | |
| Full depth | .740 | .658 | .628 | .582 | .709 | .617 | .581 | .521 | .853 | .778 | .723 | .655 | |
| Half depth | .745 | .663 | .633 | .586 | .707 | .616 | .581 | .531 | .843 | .773 | .729 | .654 | |
| LA-Entropy | .709 | .658 | .635 | .600 | .680 | .623 | .601 | .565 | .770 | .737 | .717 | .688 | |
| Poll. | ||||
|---|---|---|---|---|
| Backbone: OutFormer | OvR | OvR | Syn | |
| rOUT (full) | .730 | .580 | .967 | |
| Data recipe | w/o polluted ctx. | +0.4% | 4.4% ∗∗∗ | 0.0% |
| w/o TabPFN priors | 2.6% ∗∗∗ | 0.5% | +0.1% | |
| w/o OutFormer priors | 0.0% | +0.5% | 2.3% ∗∗∗ | |
| OddBench | OvRBench | ADBench | SynBench | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Backbone | AUROC | Layers | AUROC | Layers | AUROC | Layers | AUROC | Layers | |
| OutFormer ( =10) | 0.0025 | .761 | 5.5 | .730 | 5.4 | .860 | 5.5 | .967 | 5.7 |
| 0 | .761 | 8.8 | .731 | 8.7 | .856 | 9.2 | .973 | 10.0 | |
| ICLAD ( =12) | 0.0025 | .776 | 6.8 | .755 | 6.0 | .891 | 6.0 | .938 | 4.4 |
| 0 | .777 | 11.1 | .757 | 11.0 | .896 | 11.3 | .939 | 11.7 | |
| TACTIC ( =12) | 0.0025 | .747 | 10.2 | .729 | 10.0 | .849 | 10.1 | .838 | 9.0 |