In standard machine learning, we expect a balanced view of the world: to learn what a concept is, a model needs to see both positive and negative examples. However, in domains like industrial quality control, financial fraud detection, and infrastructure monitoring, this balanced assumption completely breaks down. Real-world systems operate in a state of extreme class imbalance. A manufacturing line might produce millions of perfect components before a single defective part appears (Zavrtanik et al.; Xie et al.). A bank processes billions of legitimate transactions alongside a tiny handful of money laundering schemes (Tan et al.).
This fundamental data scarcity makes traditional supervised learning impractical. If a model requires thousands of labeled examples of every possible failure mode to draw a decision boundary, it will fail when faced with novel, unseen anomalies. To overcome this, researchers have developed a spectrum of strategies that shift the focus from classifying known defects to understanding the boundaries of normal behavior.
Mapping the Boundaries of Normality
When anomalous data is completely unavailable during training, the most intuitive approach is to build a comprehensive model of what is "normal" (nominal) and flag anything that deviates. This is the essence of one-class and unsupervised anomaly detection.
Instead of trying to anticipate every way a system can break, these methods map nominal data into tight, well-defined representations. For instance, Chen et al. propose mapping discrete event sequences into tight hyperspheres in a latent space, ensuring that standard operational logs cluster closely together while deviations are pushed outward. In computer vision, Roth et al. demonstrate that building a dense "memory bank" of representative nominal image patches allows a system to achieve near-perfect detection accuracy without ever seeing a real defect during training. The intuition is simple: if every patch of a test image matches a known good patch in the memory bank, the object is healthy; otherwise, it is anomalous.
Adversarial learning offers another powerful mechanism for defining normality. Sabokrou et al. utilize a reconstruction network trained exclusively on normal data. Because the network only knows how to reconstruct nominal patterns, it naturally distorts any anomalous inputs, creating a wide, measurable gap that a discriminator can easily spot. Similarly, in video anomaly detection, Sabokrou introduces an "Inpainter" network that learns to erase irregularities and reconstruct the underlying normal scene, effectively turning the model's inability to reconstruct an anomaly into a precise localization signal.
Anchoring Boundaries with Few-Shot Guidance
While purely unsupervised methods avoid the need for anomaly labels, they can suffer from high false-positive rates because the boundary of "normality" is often complex and ambiguous. However, in many practical scenarios, engineers might possess a tiny handful of confirmed anomaly examples—perhaps 10 or 30 instances. Weakly-supervised and few-shot anomaly detection frameworks leverage these scarce examples not to learn the full distribution of anomalies, but to anchor and sharpen the decision boundary of the normal class.
A key insight here is that a few anomalies can act as a repelling force. Pang et al. introduced this concept via "deviation loss," which forces the model to directly optimize anomaly scores by pushing the few known anomalous examples statistically far away from the normal distribution. Rather than trying to model what an anomaly looks like, the network learns to maximize the distance between nominal data and any known deviance.
To prevent the model from overfitting to these few examples, researchers combine unsupervised representation learning with discriminative supervision. For example, Zhou et al. extract geometric factors—such as hidden representations and reconstruction residuals from an autoencoder—to build a robust feature space where a handful of labeled examples can effectively guide the model. Yao et al. refine this boundary further by using normalizing flows and a "semi-push-pull" contrastive loss. This loss uses the scarce anomalies to sharpen the edge of the nominal distribution, ensuring the model remains highly sensitive to entirely new, unseen types of defects.
Manufacturing the Missing Evidence
If real-world anomalies are too rare to collect, why not manufacture them? A rapidly growing frontier in handling data scarcity is the generation of "pseudo-anomalies"—artificial defects injected into normal data to train a robust discriminative classifier.
The success of this approach depends on how realistically the synthetic anomalies challenge the model. In the context of surface defect detection, Zavrtanik et al. developed a framework that trains a network to "repair" synthetically generated anomalies. By learning to identify the exact differences between the original image and its repaired version, the model develops a highly discriminative understanding of anomalies without ever seeing a real factory defect. Similarly, Qiao et al. leverage structural and feature-based graph priors to generate pseudo-anomalies for graph-based data, transforming a difficult semi-supervised problem into a balanced, highly effective binary classification task.
Beyond simple heuristic augmentations, researchers are increasingly turning to advanced generative models to simulate complex failure modes. Zhang et al. utilize text-to-audio latent diffusion models conditioned on machine metadata to synthesize what a mechanical failure might sound like before it ever occurs. In the domain of time-series, Cai et al. introduce a self-perturbed framework where a model learns to treat its own internal reconstruction errors as pseudo-anomalies, creating a dynamic feedback loop that eliminates the need for real-world anomalous training data entirely.