Masked Diffusion Modeling for Anomaly Detection

2026

Read Masked Diffusion Modeling for Anomaly Detection (2026) 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-2605-30046.txt.

Introduction

Lixing Zhang, Yuchen Liang and Liyan Xie propose MaskDiff-AD for spotting anomalies in categorical, mixed-type and discrete sequence data. The model trains only on normal data, learning to refill masked values from visible context. For a test sample, the score reflects how hard masked spots are to rebuild. This gives a content-sensitive discrete-state score without reverse-time sampling. A non-parametric variant and error guarantees under a threshold accompany the method. Tests give it the best average rank against twelve tabular baselines.

Catalog record

YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE71450
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2605.30046

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Masked Diffusion Modeling for Anomaly Detection Abstract Anomaly detection aims to identify samples that deviate from the nominal data distribution and is central to many safety-critical applications. However, developing effective anomaly detection methods for categorical, mixed-type, and discrete sequence data remains challenging and relatively underexplored. Masked diffusion models provide a natural way to model such data by learning to recover masked values from the remaining visible context. In this paper, we propose Masked Diffusion for Anomaly Detection (MaskDiff-AD), a forward-only method based on masked diffusion models trained only on nominal data. Given a test sample, MaskDiff-AD constructs anomaly scores from the difficulty of reconstructing randomly masked coordinates, yielding a content-sensitive score that operates directly on discrete state spaces while avoiding reverse-time sampling. We also develop a non-parametric variant of MaskDiff-AD and provide theoretical guarantees by characterizing Type-I and Type-II errors under a fixed detection threshold. Experiments on fourteen categorical and mixed-type tabular datasets from ADBench and UADAD, as well as four text anomaly detection datasets from NLP-ADBench, show that MaskDiff-AD achieves competitive performance against classical, diffusion-based, and recent tabular/text anomaly detection baselines. Notably, MaskDiff-AD achieves the best overall average rank, outperforming all twelve tabular baseline methods. Lixing Zhang 1 Yuchen Liang 2 Liyan Xie 1 1 University of Minnesota 2 Ohio State University Code: https://github.com/lxzhang1/MaskDiff-AD † † footnotetext: Main contact: [email protected] 1 Introduction Anomaly detection aims to identify observations that deviate significantly from the majority of the data (i.e., the data-generating distribution) 10 ; 35 ; 30 . As a core problem in machine learning and statistics, it has been studied for decades and plays an important role in a wide range of applications, including healthcare 39 ; 29 , finance 2 , cybersecurity 2 , manufacturing 44 , particle physics 14 , and geospatial analysis 49 . Despite this long history, the increasing prevalence of large-scale datasets with discrete or mixed data types has exposed important limitations of many classical methods 45 . Many modern anomaly detection problems involve categorical, discrete, or mixed-type data, including tabular records with categorical attributes, transaction and claims data with heterogeneous feature types, and tokenized text sequences 16 ; 19 . These data types are not naturally suited to methods built around Euclidean geometry or continuous densities. These challenges motivate the development of anomaly detection methods that are well-suited to the structural characteristics of discrete-type data, while being scalable, interpretable, and sufficiently expressive. Recently, diffusion models have provided a flexible framework for learning complex data distributions 43 ; 17 . Among them, discrete diffusion models, especially masked diffusion models, have further extended this capability to discrete domains such as text, music, and molecular data 37 ; 6 . Notably, on certain tasks, masked diffusion models have demonstrated superior performance compared to autoregressive approaches 53 ; 31 . However, as with other generative models, the majority of research on diffusion models has focused on improving sampling efficiency and enabling controllable generation (e.g., 53 ; 9 ; 47 ). In contrast, relatively few studies have explored their use, particularly that of masked diffusion models, for anomaly detection. In the literature, one notable work has explored the use of (continuous) diffusion models for anomaly detection: the Diffusion Time Estimation (DTE) framework 25 . This approach estimates the posterior distribution over the diffusion time and uses the inferred corruption level as an anomaly score, thereby avoiding the need for expensive reverse-time sampling. However, a key component of this framework relies on the Gaussian corruption structure, with a possible discrete analogue in uniform discrete diffusion models. As we show in Section 3 , this approach does not readily extend to masked diffusion models. In particular, due to the absorbing masking mechanism, the DTE-style posterior becomes ill-posed: it either collapses to identical values across all clean categorical samples or depends solely on the masking pattern of the corrupted observation, rather than the underlying distribution of the test data. Masked diffusion models (MDM) have recently gained increasing attention for modeling discrete data 37 . They learn to reconstruct clean categorical values from partially masked observations, such as learning to predict masked tokens from the remaining context. Motivated by the masking procedure, we propose Masked Diffusion for Anomaly Detection (MaskDiff-AD). The key idea is to employ a mask-corruption level tailored to the masked discrete diffusion process, and to use the corresponding single-step reconstruction difficulty as the anomaly score. In other words, instead of asking at which corruption time a test sample becomes indistinguishable from noisy normal data, MaskDiff-AD asks how difficult it is to reconstruct masked coordinates from the remaining visible context under a model trained only on normal data. A normal sample should have coordinates that are mutually consistent and therefore easy to predict from one another, whereas an anomalous sample should induce larger masked reconstruction surprisal. This yields a content-sensitive anomaly score without reverse-time sampling or iterative imputation. The contributions of our work are summarized as follows: • We formulate anomaly detection on discrete state spaces using masked diffusion models and show why a direct DTE-style time posterior degenerates in this setting. • We introduce MaskDiff-AD, a masked reconstruction-based anomaly detection method that is trained only on nominal samples , computationally efficient, and does not require reverse-time sampling. We also develop both non-parametric and parametric implementations of MaskDiff-AD. • We provide theoretical analysis for the proposed reconstruction score, including guarantees on Type-I and Type-II errors. • We demonstrate the effectiveness of our MaskDiff-AD with extensive experiments on categorical tabular, mixed-type tabular, and text anomaly detection benchmarks. Related Work. Our work is connected to several lines of research. Classical anomaly detection methods include distance-based approaches such as k -nearest neighbors 33 , tree-based methods such as Isolation Forest 22 , and distributional or copula-based scores such as ECOD 21 and COPOD 20 . These methods are often efficient and broadly applicable, but their performance can depend strongly on the chosen representation or distance, especially for categorical and mixed-type data 45 ; 11 . Recent tabular anomaly detection methods seek to capture richer feature dependencies, including masked cell modeling (MCM) 51 , non-parametric transformers for anomaly detection (NPT-AD) 46 , internal contrastive learning (ICL) 41 , CompreX 4 , and decomposed representation learning 50 . Our method shares the goal of modeling feature dependencies, but does so through the forward masking and conditional reconstruction structure of absorbing discrete diffusion. Generative models for anomaly detection have been extensively studied, especially for image data. Representative examples include autoencoder and variational-autoencoder based detectors 38 ; 5 , hybrid autoencoding-density models such as DAGMM 54 , GAN-based detectors such as AnoGAN and GANomaly 40 ; 3 , and flow-based visual detectors such as DifferNet 34 . Diffusion models have also recently been explored for anomaly detection through reconstruction-based, density-based, and hybrid scoring mechanisms 23 . Representative diffusion-based anomaly detection methods include medical and visual reconstruction methods such as AnoDDPM 48 , DDAD 27 , and DiffusionAD 52 . These methods are primarily developed for continuous data domains, especially for (medical) image data, where anomaly scores are often derived from denoising error, likelihood surrogates, or reconstruction discrepancy after reverse diffusion. Diffusion time estimation (DTE) 25 is a recent method for anomaly detection and is efficient because it

Read the complete text