Local Density-Based Anomaly Score Normalization for Domain Generalization

Kevin Wilkinghoff, Haici Yang, Janek Ebbers, François G. Germain, Gordon Wichern, Jonathan Le Roux

Introduction

Anomalous Sound Detection (ASD) is a critical component in industrial predictive maintenance, enabling systems to identify machine failures by monitoring acoustic signatures. However, real-world deployments often face "domain shift"—variations in background noise or operating conditions that alter the sound profile. This paper presents a novel normalization scheme that enhances Domain Generalization (DG), allowing ASD systems to maintain high performance across diverse, unseen environments using a single universal threshold.

The Challenge of Domain Shift

In ASD, models typically learn to map audio into an embedding space where distances from normal training samples indicate the likelihood of an anomaly. A significant hurdle arises when the system encounters a "target domain" that differs from the "source domain" used during training. Even if the underlying machine state is normal, the change in environment can shift the distribution of anomaly scores.

Domain mismatch and the shift in optimal thresholds between source and target domains.

As illustrated in the figure above, an optimal threshold for the source domain may become ineffective for the target domain due to this mismatch. Achieving robust performance requires a method that can generalize across these shifts without needing target-domain labels or extensive retraining.

Proposed Normalization Method

The authors propose Local Density-Based Anomaly Score Normalization. The fundamental idea is to adjust the raw anomaly score of a test sample based on the "crowdedness" or local density of its neighborhood within the training (reference) data.

Geometric intuition of scaling distances based on local density.

Instead of relying on raw distance-based scores, the proposed method scales the score by a local density factor derived from the reference samples. Two main variants are explored:

  • K-NN Variant: Density is defined as the average distance of a reference sample to its $K$ nearest neighbors.
  • GWRP Variant: Uses Global Weighted Ranking Pooling to consider all reference samples, weighting closer ones more heavily.

This approach effectively "stretches" the embedding space in sparse regions and "compresses" it in dense regions. By doing so, it aligns the score distributions across different domains, making a single global threshold viable. A key advantage is that these density factors can be pre-computed, ensuring zero additional overhead during real-time inference.

Experimental Setup and Datasets

The method was rigorously evaluated using datasets from the DCASE Challenge (2020–2025). These benchmarks include a variety of industrial machine types—such as pumps, fans, and valves—recorded in noisy factory settings. The more recent DCASE datasets (2022-2025) specifically target the "first-shot" ASD problem, where target domains have extremely limited training data (often just 10 samples), making them ideal for testing domain generalization.

Key Results and Insights

The normalization scheme was tested across five distinct embedding models, including state-of-the-art pre-trained architectures like BEATs and EAT.

  • Performance Gains: The normalization consistently improved AUC and pAUC scores in target domains. For instance, the "ratio" normalization variant improved the average harmonic mean across mixed domains from a baseline of 58.2% to 61.5%.
  • Robustness: Sensitivity analysis indicated that a conservative setting of $K=1$ (using only the single nearest neighbor to define density) provided the most stable improvements across various datasets.
  • Comparison with Existing Methods: The proposed approach outperformed established techniques such as the Local Outlier Factor (LOF) and synthetic data generation (SMOTE). Unlike some standardization methods, it evaluates each test sample independently, which is crucial for real-time streaming applications.

Conclusion

Local Density-Based Anomaly Score Normalization offers a simple, effective, and computationally efficient solution to the domain shift problem in ASD. By leveraging the local geometry of the embedding space, it enables robust domain generalization without the need for domain-specific labels. This makes it a highly practical tool for deploying reliable anomaly detection systems in unpredictable real-world industrial environments.

Summary updated

Abstract

State-of-the-art (ASD) systems in domain-shifted conditions rely on projecting audio signals into an embedding space and using distance-based outlier detection to compute anomaly scores. One of the major difficulties to overcome is the so-called domain mismatch between the anomaly score distributions of a source domain and a target domain that differ acoustically and in terms of the amount of training data provided. A decision threshold that is optimal for one domain may be highly sub-optimal for the other domain and vice versa. This significantly degrades the performance when only using a single decision threshold, as is required when generalizing to multiple data domains that are possibly unseen during training while still using the same trained ASD system as in the source domain. To reduce this mismatch between the domains, we propose a simple local-density-based anomaly score normalization scheme. In experiments conducted on several ASD datasets, we show that the proposed normalization scheme consistently improves performance for various types of embedding-based ASD systems and yields better results than existing anomaly score normalization approaches.
BibTeX
@misc{wilkinghoff2025local,
  author = {Kevin Wilkinghoff and Haici Yang and Janek Ebbers and François G. Germain and Gordon Wichern and Jonathan Le Roux},
  title = {{Local Density-Based Anomaly Score Normalization for Domain Generalization}},
  year = {2025},
  eprint = {2509.10951},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.10951},
}
Figure