Source-linked AI summary
adVAE: A self-adversarial variational autoencoder with Gaussian anomaly prior knowledge for anomaly detection
Xuhong Wang, Ying Du, Shijie Lin, Ping Cui, Yuntian Shen, Yupu Yang
TL;DR
Deep generative models recover data distributions rather than directly detecting anomalies, while labeled anomaly samples are scarce. adVAE adds a self-adversarial mechanism and Gaussian anomaly prior to a VAE. Against VAE, it reports average gains across AP, AUC, recall, and F1.
Problem
Deep generative models are aimed at recovering data distributions rather than detecting outliers, and labeled anomaly samples are scarce.
Source: §1 · pp. 1, 3Method
adVAE adds a Gaussian transformer and self-adversarial objectives so the generator and encoder discriminate outliers while retaining the VAE objective.
Source: §1 · p. 3, §3.1 · p. 6Results
Against VAE, adVAE improved on average by 0.113 (14.9%) in AP, 0.036 (3.9%) in AUC, 0.046 (5.3%) in recall, and 0.049 (7.3%) in F1 score.
Source: §4.5 · p. 10Takeaways & Limitations
The authors conclude that adVAE learns to detect outliers through its self-adversarial mechanism and achieves state-of-the-art performance.
Source: §4.5 · p. 12The method assumes that normal and anomalous latent prior distributions are Gaussian and overlap in latent space.
Source: §1 · p. 2
Abstract
from arXiv · showhide
Recently, deep generative models have become increasingly popular in unsupervised anomaly detection. However, deep generative models aim at recovering the data distribution rather than detecting anomalies. Besides, deep generative models have the risk of overfitting training samples, which has disastrous effects on anomaly detection performance. To solve the above two problems, we propose a Self-adversarial Variational Autoencoder with a Gaussian anomaly prior assumption. We assume that both the anomalous and the normal prior distribution are Gaussian and have overlaps in the latent space. Therefore, a Gaussian transformer net T is trained to synthesize anomalous but near-normal latent variables. Keeping the original training objective of Variational Autoencoder, besides, the generator G tries to distinguish between the normal latent variables and the anomalous ones synthesized by T, and the encoder E is trained to discriminate whether the output of G is real. These new objectives we added not only give both G and E the ability to discriminate but also introduce additional regularization to prevent overfitting. Compared with the SOTA baselines, the proposed model achieves significant improvements in extensive experiments. Datasets and our model are available at a Github repository.
1. Introduction
The introduction argues that generative models are not designed to discriminate anomalies and can overfit normal training data. adVAE adds a Gaussian anomaly prior and adversarial objectives for the encoder and generator.
1. Introduction
- Deep generative models primarily recover the training distribution rather than discriminate anomalies, limiting their ability to learn useful anomaly-detection representations.The introduction also identifies overfitting to normal data as a problem, especially for sparse data, and notes its association with high false-positive rates.Source: §1 · p. 2
- adVAE adds self-adversarial objectives to a VAE to train both its encoder and generator to discriminate anomalies and to regularize against overfitting.The introduction presents this as a customization of plain VAEs for anomaly detection.Source: §1 · pp. 2–3
- The method assumes that normal and anomalous latent priors are Gaussian and overlap, addressing the lack of anomaly latent codes for training the generator.The anomalous prior's mean and variance are unknown and differ from those of the normal prior.Source: §1 · p. 2, Figure 1 · p. 2
- A Gaussian transformer T synthesizes anomalous latent variables, while G distinguishes normal from synthesized latent codes and E distinguishes original samples from reconstructions.Training alternates between T misleading G and E discriminating G's output.Source: §1 · pp. 2–3
- The introduction also proposes learning decision thresholds automatically from normal data with KDE, rather than relying on manually selected thresholds.It contrasts this with earlier works that often omit automatic threshold learning.Source: §1 · p. 3
2. Preliminary
The preliminary section reviews conventional anomaly-detection approaches and the reconstruction-based AE and VAE methods, then describes GAN-based detection and its challenges.
2.1. Conventional Anomaly Detection
- Conventional anomaly detection includes probabilistic, distance-based, boundary-based, and reconstruction-based approaches, each relying on different assumptions about normal data.Probabilistic methods estimate normal-class density; distance methods use neighborhood distance, boundary methods enclose normal data, and reconstruction methods assume anomalies are harder to reconstruct.Source: §2.1 · p. 3
2.2. Autoencoder-based Anomaly Detection
- AEs learn to reconstruct inputs, then use test reconstruction error as an anomaly score because training uses only normal data.The section describes anomalies as instances the AE has not encountered and therefore reconstructs poorly.Source: §2.2 · p. 3
2.3. VAE-based Anomaly Detection
- VAEs constrain latent codes to a prior and optimize reconstruction alongside a KL-divergence term that regularizes the encoder toward that prior.For anomaly detection, VAEs use average reconstruction error over prior samples as a reconstruction probability.Source: §2.3 · pp. 3–4
2.4. GAN-based Anomaly Detection
- GAN-based detection uses generated samples to help a discriminator describe a normal-versus-outlier boundary, but mode collapse can weaken that boundary.The section describes MO-GAAL's nonconverged generator and multiple generators, and WGAN-GP's Wasserstein distance and gradient penalty, as approaches addressing GAN issues.Source: §2.4 · p. 4
3. Self-adversarial Variational Autoencoder
adVAE modifies a VAE with a Gaussian anomaly prior and adversarial objectives involving a transformer, generator, and encoder. It alternates training steps, then scores reconstruction deviations and uses KDE to set a decision threshold.
3. Self-adversarial Variational Autoencoder
- adVAE combines encoder E, generator G, and Gaussian transformer T, modifying the VAE objective to support anomaly detection.Its cost function combines the VAE reconstruction and KLD terms with additional objectives.Source: §3 · p. 4
3.1. Training Step 1: Competition between T and G
- T maps normal latent codes to nearby anomalous codes while G learns different reconstruction errors; their opposing objectives sum to LT + λLG.T aims to keep the latent distributions close, while G aims to distinguish them; mx and mz set margins for the MSE and KLD target terms.Source: §3.1 · pp. 5–6
3.2. Training Step 2: Training E like a Discriminator
- With T and G frozen, E retains the VAE encoding objective and learns to distinguish training data from reconstructions rather than map reconstructions to the prior.E’s discriminating ability also helps G distinguish normal from anomalous latent codes.Source: §3.2 · p. 6
3.3. Alternating between the Above Two Steps
- The two training steps alternate until convergence: G tries to fool E, while E learns to discriminate generated samples and both retain VAE training objectives.The generator and encoder are trained competitively while jointly learning from the training data.Source: §3.3 · pp. 6–7
3.4. Anomaly Score
- adVAE sets L to 1,000 in this work to improve performance robustness; its anomaly score reflects deviation between testing data and the learned normal-data distribution, and high-scoring points are classified as anomalies.Source: §3.4 · p. 7
3.5. Decision Threshold
- KDE estimates the training-score PDF and CDF to set sα where F(sα) = 1 − α; α trades missed alarms against false alarms, with 0.1 recommended.The method uses an RBF kernel and Silverman’s bandwidth-selection criterion.Source: §3.5 · pp. 7–8
3.6. Detecting Outliers
- At test time, a new point is an outlier when its score is at least the learned threshold; otherwise, it is classified as normal.Source: §3.6 · p. 8
4. Experiments
Across five tabular datasets, the experiments evaluate adVAE using recall, F1, AUC, and AP. adVAE achieves strong results against the compared methods, with average improvements over VAE across all four metrics.
4.1. Datasets
- Five publicly available tabular datasets were used, with 80% of normal data for training and the remaining normal data plus all outliers for testing.Table 1 summarizes the datasets.Source: §4.1 · p. 8, Table 1 · p. 8
4.2. Evaluation Metric
- Recall and F1 were chosen for single-threshold evaluation, while the experiments also used AUC and AP; AP is preferred under class imbalance.The authors argue that recall matters more than precision because missed outliers are harder to recover than false alarms.Source: §4.2 · pp. 8–9
4.3. Model Configurations
- The models used Adam at a 0.001 learning rate, batch size 128, and up to 20,000 mini-batch iterations; the added parameters balance the original and discrimination objectives.The authors suggest fixing γ at 0.001 and tuning mx and mz; they describe the tested structures and hyperparameters as sufficient for their applications.Source: §4.3 · p. 9, Table 2 · p. 9
4.4. Compared Methods
- The comparison included eleven traditional and deep-learning outlier detectors, with ablation variants and tuned competitor hyperparameters.Deep-learning methods shared the optimizer, learning rate, batch size, and iteration count except where authors' recommendations were used.Source: §4.4 · pp. 9–10
4.5. Results and Discussion
- Across 24 comparisons, adVAE achieved 11 best and 5 second-best results; versus VAE, it improved average AP by 0.113 (14.9%), AUC by 0.036 (3.9%), recall by 0.046 (5.3%), and F1 by 0.049 (7.3%).The comparisons cover AP and AUC in Table 3 and recall and F1 in Table 4.Source: §4.5 · p. 10, Table 3 · p. 11, Table 4 · p. 11
- AE and VAE outperformed GAN-based methods in most datasets, while DAGMM lagged them, particularly as dataset size and dimensions increased.The authors attribute DAGMM's limitation to its required one-dimensional latent space, which constrains its ability to summarize datasets.Source: §4.5 · pp. 11–12
4.6. Ablation Study
- Both single-objective ablations improved on plain VAE; E-adVAE was more competitive than G-adVAE on most datasets, and tests indicated improved encoder and generator discrimination.The latent-space visualization supports improved encoder discrimination, while Wasserstein-distance comparisons indicate improved generator discrimination.Source: §4.6 · p. 12
4.7. Robustness Experiments
- AdVAE was robust to hyperparameter changes and reasonable network sizes, but contaminated training data reduced accuracy, with greater sensitivity above 3% contamination.The authors recommend training AE-based anomaly detectors on clean or low-contamination data.Source: Figure 9 · p. 13, §4.7 · p. 14
5. Conclusion
The conclusion presents adVAE as a VAE-based outlier detector that distinguishes normal latent codes from Gaussian-transformer-generated anomalous codes, with additional regularization. It reports outperforming state-of-the-art anomaly-detection methods and identifies redesigning the generator’s discrimination objective as future work.
- The authors report that adVAE outperforms other state-of-the-art anomaly-detection methods.Source: §5 · p. 14
- adVAE encourages discrimination between normal latent codes and anomalous variables generated by Gaussian transformer T, adding regularization to VAE-based outlier detection.Source: §5 · p. 14
- Future work will redesign the generator’s discrimination objective to further enhance its ability to recognize anomalies.Source: §5 · p. 14