Papers
Topics
Authors
Recent
Search
2000 character limit reached

When Normality Shifts: Risk-Aware Test-Time Adaptation for Unsupervised Tabular Anomaly Detection

Published 11 May 2026 in cs.LG and cs.AI | (2605.10242v1)

Abstract: Unsupervised tabular anomaly detection methods typically learn feature patterns from normal samples during training and subsequently identify samples that deviate from these patterns as anomalies during testing. However, in practical scenarios, the limited scale and diversity of training data often lead to an incomplete characterization of normal patterns. While test-time adaptation offers a remedy, its isolated focus on test-time optimization ignores the critical synergy with training-phase learning. Furthermore, indiscriminate adaptation to unlabeled test data inevitably triggers anomaly contamination, preventing the model from fully realizing its discriminative capability between normal and anomalous samples. To address these issues, we propose RTTAD, a Risk-aware Test-time adaptation method for unsupervised Tabular Anomaly Detection. RTTAD holistically tackles normality shifts via a synergistic two-stage mechanism. During training, collaborative dual-task learning captures multi-level representations to establish a robust normal prior. During testing, a Test-Time Contrastive Learning (TTCL) module explicitly accounts for adaptation risk by selectively updating the model using high-confidence pseudo-normal samples while constraining anomalous ones. Additionally, TTCL incorporates a k-nearest neighbor-based contrastive objective to refine embedding distributions, thereby further enhancing the model's discriminative capacity. Extensive experiments on 15 tabular datasets demonstrate that RTTAD achieves state-of-the-art overall detection performance.

Summary

  • The paper introduces RTTAD, a framework that mitigates normality shifts by integrating risk-aware test-time adaptation into unsupervised tabular anomaly detection.
  • It employs collaborative dual-task training with masked autoencoder architectures and a KNN-based contrastive learning mechanism for selective model updates.
  • Empirical results across 15 datasets demonstrate significant performance improvements in AUC-PR, AUC-ROC, and F1 score, confirming the model’s robust adaptation.

Risk-Aware Test-Time Adaptation for Unsupervised Tabular Anomaly Detection

Introduction

The paper "When Normality Shifts: Risk-Aware Test-Time Adaptation for Unsupervised Tabular Anomaly Detection" (2605.10242) presents RTTAD, a framework explicitly constructed to address the core vulnerability of unsupervised tabular anomaly detectors under normality shifts between training and test distributions. This work starts from the observation that most unsupervised methods assume normal data distributions remain consistent post-training, an assumption violated by practical scenarios with incomplete coverage of the normal manifold. The authors systematically decompose the problem, demonstrating that naive test-time adaptation approaches risk contaminating the adapted model with anomalies due to unlabeled test set heterogeneity. RTTAD's core contribution is an integrated two-stage methodology coupling robust multi-level representation learning during training with risk-aware, selective model updates in test-time adaptation.

Problem Formulation and Analysis of Normality Shifts

Unsupervised anomaly detection in tabular data is rooted in learning a discriminative representation of normal patterns from training data. However, limited sample diversity commonly leads to a partial representation of the actual normal manifold. When the test set introduces previously unseen but legitimate variants of normal data—a normality shift—conventional detectors fail, spuriously classifying such instances as anomalies. Figure 1

Figure 1: Illustration of normality shift between training and test distributions, and how RTTAD mitigates such shifts by multi-level normal modeling and risk-aware test-time adaptation.

Empirical analyses via clustering and divergence metrics on 15 datasets confirm nontrivial distributional discrepancies between training and test set normals, quantitatively measured using Jeffreys Divergence and Optimal Transport Dataset Distance. t-SNE visualization further highlights that normality shifts are not isolated or esoteric artifacts but are ubiquitous in typical real-world tabular datasets.

RTTAD Methodology

Collaborative Dual-Task Training

The training phase is centered on a masked autoencoder-based architecture engineered for representational robustness. Two synergistic reconstruction tasks are jointly optimized:

  • Main task (feature reconstruction): Learning low-level feature representations by reconstructing inputs from masked versions, thus enforcing the model to capture fundamental patterns invariant to masking perturbations.
  • Auxiliary task (latent embedding reconstruction): Modeling high-level feature dependencies by reconstructing the latent code from the masked representation. This layer augments expressivity and resilience to distribution shifts.

A mask diversity loss is included to avoid representational collapse caused by repetitive masking. The cumulative loss integrates main, auxiliary, and diversity components, modulated by dataset-adaptive weights.

Test-Time Contrastive Learning (TTCL)

TTCL operationalizes risk-aware test-time adaptation through a sequence of refinements:

  • Pseudo-labeling: High-confidence normal and abnormal samples from the test set are identified based on normalized model loss. Thresholding employs γ\gammaGMM, obviating the need for explicit prior knowledge of anomaly rates.
  • Selective adaptation: Only the high-confidence pseudo-normals are used to update the model, while the adaptation step is discouraged for pseudo-abnormals. This prevents the model from assimilating anomalous structure.
  • KNN-based contrastive loss: Rather than contrasting every sample globally, a local, neighborhood-centric (KNN) contrastive objective is used, pulling pseudo-normal samples towards the centroid of previously seen normals and pushing pseudo-anomalous instances away in representation space.

This adaptation is performed iteratively. With each refinement, confident pseudo-normals are added to the anchor set, further stabilizing adaptation and incrementally widening the representational coverage of normality. Figure 2

Figure 2: Overview of the RTTAD framework, unifying collaborative dual-task training and test-time contrastive learning with KNN-based pseudo-labeling and adaptation.

Empirical Evaluation

RTTAD is validated across an extensive set of 15 tabular datasets reflecting diverse real-world scenarios, with synthetic normality shifts rigorously constructed via cluster-based partitioning. This design ensures evaluation under robust shift scenarios characterizing incomplete training coverage. Figure 3

Figure 3: Comparison of normal sample distributions for training and test sets, showing significant normality shifts across datasets.

Quantitative results highlight RTTAD's superiority:

  • AUC-PR: RTTAD achieves an average of 0.6388, outperforming the next-best baseline by 3.15 percentage points.
  • AUC-ROC: RTTAD averages 0.8408, 3.37 points higher than the strongest prior method.
  • F1 score: RTTAD delivers dramatic gains (average 0.5953), surpassing the second-best by 9.61 points.

Boxplot analyses confirm the model's statistical robustness, with improvements verified via Wilcoxon signed-rank tests across multiple datasets. Figure 4

Figure 4: Distribution and confidence intervals for AUC-PR and AUC-ROC across all datasets, demonstrating RTTAD's superior ranking and stability.

Figure 5

Figure 5: F1 score distribution, average ranking, and statistical significance tests for all evaluated methods.

Additionally, RTTAD demonstrates robustness to pseudo-label noise: noisy pseudo-labels do not cause adaptation collapse, and co-teaching-style label filtering yields further performance improvements at optimal forget rates.

Ablation studies show that each mechanism—auxiliary reconstruction, TTCL, KNN-contrastive adaptation, and maintaining prior knowledge during adaptation—is necessary; omitting any of these results in marked performance degradation.

Hyperparameter Robustness

Parameter sensitivity analyses reveal RTTAD's insensitivity to neighborhood size in KNN-based contrastive adaptation for KK in [3,10][3,10], and negligible dependence on loss component weights. This robustness is critical for practical deployment in validation-scarce unsupervised settings. Figure 6

Figure 6: RTTAD detection performance is stable across a wide range of parameter settings, facilitating real-world deployment.

Implications and Future Directions

RTTAD advances the state of the art in unsupervised tabular anomaly detection under covariate and normality shift. The synergistic training and risk-aware adaptation paradigm substantially broadens model resilience, with strong implications for domains where exhaustive normal coverage is infeasible. The explicit management of pseudo-label risk closes a critical gap in previous TTA approaches, which were vulnerable to contamination under label uncertainty.

The findings suggest several promising future directions:

  • Development of more sophisticated pseudo-label refinement and noise-resistant adaptation protocols.
  • Extending the RTTAD conceptual framework to structure data (graphs, time series) and heterogeneously evolving distributions.
  • Incorporating dynamic or adaptive risk modeling to further improve open-world adaptation under extreme shifts or out-of-support anomalies.

Conclusion

RTTAD offers a rigorous, practical solution to the overlooked problem of normality shifts in unsupervised tabular anomaly detection. Through its integration of collaborative dual-task learning and selective, risk-controlled test-time adaptation, RTTAD achieves state-of-the-art performance and robustness across substantially shifted benchmarks. Theoretical and empirical analyses verify that risk-aware adaptation, underpinned by local contrastive learning and cautious pseudo-labeling, is essential when adapting in the wild. This work provides a foundation for future research on safe, label-efficient adaptation for anomaly detection in open-world settings.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.