Selective Denoising Diffusion Model for Time Series Anomaly Detection

Kohei Obata, Zheng Chen, Yasuko Matsubara, Lingwei Zhu, Yasushi Sakurai

Abstract

Time series anomaly detection (TSAD) has been an important area of research for decades, with reconstruction-based methods, mostly based on generative models, gaining popularity. Diffusion models have recently attracted attention due to their advanced generative capabilities. However, existing diffusion-based methods rely on a conditional strategy that often fails to accurately reconstruct normal parts, resulting in suboptimal performance. We propose AnomalyFilter, a novel diffusion-based method that acts as a selective filter to denoise only anomaly parts while retaining normal parts. By masking Gaussian noise during training and conducting a noiseless inference process, AnomalyFilter achieves notably low reconstruction error on normal parts. Extensive experiments on five datasets demonstrate its effectiveness, achieving a 45.1% improvement in VUS-PR over vanilla diffusion models.

Introduction

Time series anomaly detection (TSAD) typically operates on the principle that a model trained on normal data will fail to reconstruct anomalous patterns. The resulting reconstruction error serves as an anomaly score. However, traditional methods face a "reconstruction bottleneck": Encoder-Decoder models (like VAEs or GANs) often over-smooth data, while standard Diffusion models, which reconstruct signals from pure white noise, often lose fine-grained normal details.

AnomalyFilter addresses these challenges by reframing anomaly detection as a selective filtering task. Instead of reconstructing the entire signal from scratch, it exploits the denoising power of diffusion models to "fix" only the anomalous parts while leaving normal patterns untouched.

Methodology: The AnomalyFilter Framework

The core of AnomalyFilter lies in two synergistic innovations that modify the standard Denoising Diffusion Probabilistic Model (DDPM) pipeline:

  1. Masked Gaussian Noise (Training): During training, a Bernoulli mask is applied to the input sequence. Only selected parts are corrupted with Gaussian noise, while others remain clean. The model learns to predict noise only where it was added, effectively training it to ignore clean (normal) data and focus on repairing corrupted segments.
  2. Noiseless Inference (Detection): Unlike typical diffusion models that start inference by adding noise to a test sample, AnomalyFilter inputs a scaled version of the original data and performs denoising steps without adding any additional noise.
Overview of the AnomalyFilter training and inference pipeline.

This combination allows the model to treat anomalies as "noise" to be removed. During inference, normal parts—which the model was trained to leave alone—are preserved with high fidelity, while anomalous spikes are "filtered" out, resulting in a sharp, detectable error signal.

Experimental Evaluation

AnomalyFilter was evaluated against 13 baselines, including BeatGAN, Anomaly-Transformer, and IMDiffusion, across five diverse benchmarks: UCR Anomaly Archive, AIOps, Yahoo Real & Bench, and the Server Machine Dataset (SMD).

Key Results

  • Superior Accuracy: AnomalyFilter achieved an average improvement of 45.1% in VUS-PR compared to vanilla DDPM.
  • High Fidelity Reconstruction: On the UCR dataset, the model showed significantly lower Mean Squared Error on normal parts ($MSE_n$) compared to other diffusion-based methods.
  • Selective Filtering Effect: While other models like BeatGAN or Anomaly-Transformer may misalign peaks or produce noisy reconstructions, AnomalyFilter maintains a near-perfect reconstruction of normal cycles while producing a high MSE specifically in anomalous regions.
Comparison of reconstruction performance and MSE across different TSAD models.

Discussion and Conclusion

The success of AnomalyFilter stems from its ability to bypass the information loss inherent in latent space bottlenecks. By using the input itself as a conditioner and treating anomalies as out-of-distribution noise, the model achieves a "Goldilocks" zone of reconstruction—preserving normal features while effectively erasing anomalies.

Ablation studies confirm that the synergy between masked training and noiseless inference is mandatory; neither component performs well in isolation. While the model shows state-of-the-art performance, future work could explore more sophisticated noise mechanisms to better handle high-dimensional dependencies in multivariate datasets and improve robustness against anomaly contamination in training sets.

Code available at: https://github.com/KoheiObata/AnomalyFilter

Summary updated

Abstract

Time series anomaly detection (TSAD) has been an important area of research for decades, with reconstruction-based methods, mostly based on generative models, gaining popularity and demonstrating success. Diffusion models have recently attracted attention due to their advanced generative capabilities. Existing diffusion-based methods for TSAD rely on a conditional strategy, which reconstructs input instances from white noise with the aid of the conditioner. However, this poses challenges in accurately reconstructing the normal parts, resulting in suboptimal detection performance. In response, we propose a novel diffusion-based method, named AnomalyFilter, which acts as a selective filter that only denoises anomaly parts in the instance while retaining normal parts. To build such a filter, we mask Gaussian noise during the training phase and conduct the denoising process without adding noise to the instances. The synergy of the two simple components greatly enhances the performance of naive diffusion models. Extensive experiments on five datasets demonstrate that AnomalyFilter achieves notably low reconstruction error on normal parts, providing empirical support for its effectiveness in anomaly detection. AnomalyFilter represents a pioneering approach that focuses on the noise design of diffusion models specifically tailored for TSAD.
BibTeX
@misc{obata2026selective,
  author = {Kohei Obata and Zheng Chen and Yasuko Matsubara and Lingwei Zhu and Yasushi Sakurai},
  title = {{Selective Denoising Diffusion Model for Time Series Anomaly Detection}},
  year = {2026},
  eprint = {2602.23662},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.23662},
}
Figure