Abstract
Normalizing Flow (NF) models for anomaly detection often struggle because their outputs do not perfectly match the fixed "simple" distribution (e.g., a standard Gaussian) they are designed to target. This paper introduces AltUB (Alternating Training Method to Update Base Distribution), which addresses this discrepancy by making the target distribution trainable. By employing a two-stage alternating training scheme, AltUB maintains model stability while significantly enhancing performance on industrial benchmarks like MVTec AD and BTAD.
Introduction: The "Mean-Shift" Reality
Normalizing Flows are a powerful tool for unsupervised anomaly detection, aiming to learn an invertible mapping that transforms complex "normal" data into a predefined base distribution, typically a standard multivariate Gaussian $N(0, I)$. At test time, samples that do not map well to this Gaussian (i.e., have low likelihood) are flagged as anomalies.
However, empirical analysis reveals a significant flaw: in practice, NF models rarely succeed in transforming normal data into $N(0, I)$. Instead, they produce outputs following an arbitrary normal distribution with shifted means and scaled variances. This "mean-shift" phenomenon leads to unstable performance during training and limits the model's expressive power by forcing it to fit a rigid, often unattainable, fixed prior.
Methods: Alternating Training with AltUB
To overcome these limitations, the authors propose AltUB. Rather than fixing the base distribution, they treat it as a trainable Gaussian $N(\mu, \Sigma)$. The core innovation is a two-stage Alternating Training strategy:
- Standard Update: Flow parameters ($\theta$) and base distribution parameters ($\psi = \{\mu, \Sigma\}$) are updated together using a standard optimizer.
- Freezing Interval Update: Periodically, the flow parameters are frozen, and only the base distribution parameters are updated using a significantly larger learning rate and an SGD optimizer.
This approach allows the base distribution to actively adapt to the current state of the flow's output. To maintain efficiency, $\Sigma$ is restricted to a diagonal matrix, avoiding the high computational cost of inverting large covariance matrices. The anomaly score function is subsequently updated to utilize these learned parameters instead of the default zero-mean/unit-variance assumptions.
Key Results and Insights
AltUB was integrated into state-of-the-art NF architectures, such as FastFlow and CFLOW-AD, yielding several key improvements:
- State-of-the-Art Performance: The method achieved a record 98.8% AUROC on the MVTec AD anomaly segmentation task and improved average AUROC on the BTAD dataset from 97% to 98.2%.
- Enhanced Stability: AltUB significantly reduces performance fluctuations during training. In production environments where labeled validation sets are unavailable, this stability is crucial for reliable deployment.
- Efficiency: The method adds negligible overhead to inference time, ensuring its practicality for real-time industrial inspection.
The authors also noted that while increasing model depth can mitigate mean-shift, it often leads to overfitting. AltUB provides the necessary expressive power without the risks associated with over-parameterization.
Conclusion
AltUB effectively addresses the "mean-shift" reality in Normalizing Flows by replacing fixed priors with adaptive, trainable base distributions. By stabilizing training and improving representation, it sets a new standard for industrial anomaly detection. Future work may explore more complex prior structures and optimized training schedules to further refine these results.
Summary updated