Deep Context-Conditioned Anomaly Detection for Tabular Data CCS: Computing methodologies Anomaly detection
Spencer King, Zhilu Zhang, Ruofan Yu, Baris Coskun, Wei Ding, Qian Cui · 2025
Read Deep Context-Conditioned Anomaly Detection for Tabular Data CCS: Computing methodologies Anomaly detection by Spencer King, Zhilu Zhang, Ruofan Yu, Baris Coskun, Wei Ding, Qian Cui (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2509-09030.txt.
Introduction
Fraud and intrusion hide in tables where normal behavior depends on context: a purchase odd globally may be routine for one account. Spencer King and 5 co-authors build anomaly detection around that fact in a 2025 research paper. Traditional unsupervised methods model one global distribution for all rows. The authors instead learn how behavior varies with context, such as user, account, or device.
Their framework has three parts: a probabilistic formulation, an automatic way to pick informative context features, and theoretical support. They implement it with a conditional Wasserstein autoencoder, a compact model for tabular data. Across eight benchmark datasets, contextual learning beat global approaches consistently. Wins appeared even when the best context was not obvious beforehand. For security and finance teams drowning in heterogeneous tables, context-first detection offers a more faithful picture of normal.
Catalog record
| CREATOR | Spencer King, Zhilu Zhang, Ruofan Yu, Baris Coskun, Wei Ding, Qian Cui |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 56 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2509-09030
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Deep Context-Conditioned Anomaly Detection for Tabular Data CCS: Computing methodologies Anomaly detection Spencer King, Zhilu Zhang, Ruofan Yu, Baris Coskun, Wei Ding, Qian Cui 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 a significant challenge. Although various deep learning methods have been proposed to model a dataset’s joint distribution, real-world tabular data often contain heterogeneous contexts (e.g., different users), making globally rare events normal under certain contexts. Consequently, relying on a single global distribution can overlook these contextual nuances, degrading detection performance. In this paper, we present a context-conditional anomaly detection framework tailored for tabular datasets. Our approach automatically identifies context features and models the conditional data distribution using a simple deep autoencoder. Extensive experiments on multiple tabular benchmark datasets demonstrate that our method outperforms state-of-the-art approaches, underscoring the importance of context in accurately distinguishing anomalous from normal instances. 1. Introduction Unsupervised anomaly detection (AD) is a critical field focused on identifying patterns that deviate from expected behavior, with applications spanning a wide range of tasks like security, fraud detection, and system reliability ( Chandola et al. 2009 ; Aggarwal 2017 ) . The core challenge is not merely detecting new or unseen objects, but discerning whether such observations align with the learned notion of “normal,” or truly represent anomalies. Recent advances in deep learning have driven a wave of neural network-based methods for unsupervised anomaly detection ( Landauer et al. 2023 ; Pang et al. 2021b ) . Despite methodological differences, most deep approaches model the joint distribution of all features, implicitly assuming that data patterns are homogeneous across conditions. In practice, patterns often vary significantly with context. For example, in cybersecurity, a spike in data transfer may be benign for a user who routinely performs backups but suspicious for a database administrator. Ignoring such context can degrade detection accuracy. To address this challenge, we argue probabilistically and demonstrate empirically the effectiveness of modeling conditional distributions over joint distributions for anomaly detection. We advocate for the context-conditional anomaly detection framework, which models conditional distributions to capture intra-context regularities while isolating inter-context variability, thereby enhancing detection performance without requiring separate models for each condition. Selecting an appropriate context feature is a critical aspect of contextual learning. It is often not obvious what feature one should condition on when modeling the data. Indeed, the choice of conditioning variable can significantly influence model performance. To address this, we develop a bi-level optimization methodology to automatically identify the context features based on negative log-likelihood. Requiring only a small set of anomaly-free validation samples, our approach is simple, model-agnostic, and demonstrates consistent benefits across a wide range of datasets. To empirically validate our claim, we leverage recent advancements in deep learning and advocate for the conditional Wasserstein autoencoder (CWAE), a conditional variant of the Wasserstein autoencoder (WAE) ( Tolstikhin et al. 2019 ) , to model conditional distributions for anomaly detection. We conduct experiments using several tabular AD benchmark datasets containing inherent contextual information (e.g., users, accounts, or hosts). We demonstrate that incorporating contextual information with the proposed CWAE model enables more robust anomaly detection across diverse and complex datasets, and offers significant advantages in improving detection accuracy. Main contributions: • We promote a context-conditioned anomaly detection framework. • We propose the CWAE model to demonstrate the benefits of context-aware learning. • We introduce a principled method to select a suitable feature context feature for conditional modeling. • We demonstrate that conditional models can outperform both their non-contextual counterparts of the same architecture and state-of-the-art (SOTA) unconditional models. 2. Related Works Anomaly detection has been a long-standing area of research, with early work dominated by statistical and distance-based approaches. Classical statistical methods such as Principal Component Analysis (PCA) ( Shyu et al. 2003 ) and distance-based techniques like k-Nearest Neighbors ( Liao and Vemuri 2002 ) and clustering-based methods ( Münz et al. 2007 ) aim to identify points that deviate from expected norms in the data distribution. While effective in lower dimensions, these techniques struggle in high-dimensional settings due to the “curse of dimensionality." More recent advances leverage deep neural networks to learn expressive representations for anomaly detection in complex data. Notable lines of work include one-class classification with deep feature embeddings ( Ruff et al. 2018 ; Ruff et al. 2021 ) , autoencoder-based approaches that reconstruct normal samples ( Gong et al. 2019 ; Zhou and Paffenroth 2017 ; Zhao et al. 2017 ; Liu et al. 2021 ) , and generative models like GANs ( Schlegl et al. 2017 ; Sabuhi et al. 2021 ) , normalizing flows ( Gudovskiy et al. 2022 ) , and diffusion models ( Livernoche et al. 2023 ) . However, several studies ( Kirichenko et al. 2020 ; Zhang et al. 2021 ) have shown that generative models trained to match the marginal data distribution can fail to identify out-of-distribution or context-specific anomalies, as they may assign high likelihood to atypical but structurally plausible inputs. To address this, self-supervised learning methods ( Golan and El-Yaniv 2018 ; Wang et al. 2019b ; Chen et al. 2020 ; Tack et al. 2020 ) recast anomaly detection as an auxiliary classification task, such as predicting data augmentations or transformations. While effective in image domains, extending such techniques to tabular or categorical data is non-trivial ( Bergman and Hoshen 2020 ; Qiu et al. 2021 ; Shenkar and Wolf 2022 ) , and performance can degrade when the auxiliary task is misaligned with anomaly structure. Orthogonal to these, subspace anomaly detection methods aim to discover subsets of features or projections where anomalies become more apparent. Classical examples include axis-parallel subspace approaches ( Kriegel et al. 2009 ) , projection pursuit, and local subspace analysis ( Aggarwal and Yu 2013 ; Sathe and Aggarwal 2016 ) . These methods, including randomized hashing ( Sathe and Aggarwal 2016 ) , avoid modeling the full joint distribution by seeking dimensions that isolate outliers. However, they typically treat all features equally and do not distinguish between context and behavioral attributes. In contrast, context-aware or conditional anomaly detection explicitly models how behavioral features deviate from expected values given a specific context ( Song et al. 2007 ; Stein et al. 2020 ) . For instance, CADENCE ( Amin et al. 2019 ) models the conditional probability of discrete events within high-cardinality logs, and cross-linked VAEs ( Shulman et al. 2020 ) disentangle context and content in anomaly scoring. Similarly, kernel mixture networks ( Kim and Kim 2023 ) estimate flexible context-conditioned distributions in sensor data. These approaches highlight the benefits of modeling conditional distributions over global joint distributions in heterogeneous environments, but they often assume that the context is known a priori, or restrict themselves to domains like time-series or event logs. Our work builds on this literature in three key ways. First, we target tabular data—a setting with less structure and no predefined context—making the task of identifying and modeling contextual dependencies significantly more challenging. Second, unlike methods that rely on dual encoders or complex density estimators, we propose a lightweight yet effective Conditional Wasserstein Autoencoder (CWAE) that models P(\text{content}|\text{context})