Contextual Learning for Anomaly Detection in Tabular Data
Abstract
Anomaly detection is critical in domains such as cybersecurity and finance, especially when working with large-scale tabular data. Yet, unsupervised anomaly detection---where no labeled anomalies are available---remains challenging because traditional deep learning methods model a single global distribution, assuming all samples follow the same behavior. In contrast, real-world data often contain heterogeneous contexts (e.g., different users, accounts, or devices), where globally rare events may be normal within specific conditions. We introduce a \emph{contextual learning framework} that explicitly models how normal behavior varies across contexts by learning conditional data distributions $P(\mathbf{Y} \mid \mathbf{C})$ rather than a global joint distribution $P(\mathbf{X})$. The framework encompasses (1) a probabilistic formulation for context-conditioned learning, (2) a principled bilevel optimization strategy for automatically selecting informative context features using early validation loss, and (3) theoretical grounding through variance decomposition and discriminative learning principles. We instantiate this framework using a novel conditional Wasserstein autoencoder as a simple yet effective model for tabular anomaly detection. Extensive experiments across eight benchmark datasets demonstrate that contextual learning consistently outperforms global approaches---even when the optimal context is not intuitively obvious---establishing a new foundation for anomaly detection in heterogeneous tabular data.
Cite
Text
King et al. "Contextual Learning for Anomaly Detection in Tabular Data." Transactions on Machine Learning Research, 2026.Markdown
[King et al. "Contextual Learning for Anomaly Detection in Tabular Data." Transactions on Machine Learning Research, 2026.](https://mlanthology.org/tmlr/2026/king2026tmlr-contextual/)BibTeX
@article{king2026tmlr-contextual,
title = {{Contextual Learning for Anomaly Detection in Tabular Data}},
author = {King, Spencer and Zhang, Zhilu and Yu, Ruofan and Coskun, Baris and Ding, Wei and Cui, Qian},
journal = {Transactions on Machine Learning Research},
year = {2026},
url = {https://mlanthology.org/tmlr/2026/king2026tmlr-contextual/}
}