Feature Space Anomaly Synthesis

23 concepts13 papers1 proposal

Anomaly detection is fundamentally a one-class problem. Because real-world anomalies are rare, unpredictable, and infinitely diverse, training a model requires defining a sharp boundary around what is "normal." A common workaround is to synthesize artificial anomalies during training to teach a classifier where that boundary lies.

Traditionally, this synthesis happens in the image or pixel space—for example, by cutting and pasting textures or adding artificial blurs. However, pixel-level synthesis is brittle. It forces models to memorize specific visual artifacts rather than learning the abstract concept of abnormality. Furthermore, as noted by Wei Luo et al., pixel-level manipulations are highly sensitive to low-level noise and can cause models to over-generalize or fail to capture true structural deviations.

To solve this, a powerful paradigm has emerged: synthesizing anomalies directly within the latent feature space of a neural network.

In a trained feature space, normal data naturally clusters into tight, coherent representations. An anomaly is conceptually simple: it is any point that departs from these normal clusters. By bypassing the need to model complex, high-dimensional visual textures, feature-space synthesis allows models to focus entirely on the geometric boundaries of normality.

Pixel Space Synthesis:  [Normal Image] ---> (Add Texture/Cut-Paste) ---> [Messy Artifacts] 
                                                                                | (Hard to generalize)
Feature Space Synthesis: [Normal Cluster] ---> (Apply Latent Distortion) ---> [Out-of-Cluster Pseudo-Anomaly]

Direct Feature Distortion and Layer Mixing

The most direct way to simulate an anomaly in the feature space is to corrupt the clean feature maps generated by a backbone network.

Zhikang Liu et al. demonstrated that simply adding Gaussian noise to normal feature representations acts as an incredibly effective proxy for real-world defects. Because the network learns to treat any significant departure from the normal feature cluster as an anomaly, this straightforward approach achieves state-of-the-art performance without ever seeing a real defect during training. To capture more structured anomalies, Luc P. J. Sträter et al. introduced self-supervised feature distortions that shuffle feature patches based on their importance in attention maps, simulating semantic irregularities.

However, completely random noise can sometimes push features too far away from the normal distribution, making the classification task trivial and failing to teach the model how to detect subtle, borderline defects. To generate more realistic and challenging training signals, researchers look to the internal structure of the network itself:

  • Cross-Layer Mixing: Wenxi Lv et al. proposed distorting feature maps by interpolating embeddings across different layers of a neural network. This cross-layer mixing simulates complex structural deviations that preserve some semantic context while breaking normal patterns.
  • Codebook Vector Replacement: Vitjan Zavrtanik et al. leveraged a quantized feature space, replacing specific latent vectors with alternative entries from a learned codebook. This creates "near-in-distribution" anomalies that force the model to distinguish between normal variations and subtle deviations.

Geometry-Guided and Boundary-Aware Perturbations

If pseudo-anomalies are generated completely at random, they risk overlapping with normal data or appearing in uninformative regions of the latent space. To maximize their utility, synthesis techniques can be guided by the geometry of the normal feature distribution.

Qiyu Chen et al. introduced a directional synthesis approach. Instead of scattering noise uniformly, their method actively pushes features away from the center of the normal feature distribution. A self-adaptive length mechanism controls this distance, ensuring that the synthetic anomalies sit precisely on the outer edge of the normal boundary.

In multi-class scenarios, the density of normal clusters varies. To handle this, Qiyu Chen et al. proposed a distance-guided approach: features lying close to their class center receive a higher dose of noise, while features already near the edge receive less. This gradient of perturbation prevents the synthetic anomalies from blurring the established boundaries of the normal data.

       Adaptive Noise Injection

             ( Pseudo-Anomaly )
                   ^
                   |  (Large push)
        [ Center of Normal Cluster ]
                   |  (Small push)
                   v
             ( Pseudo-Anomaly )

Feature-space geometry can also be used to strip away unwanted dataset biases. For instance, models often mistakenly rely on orientation or perspective as a proxy for normality. To counter this, Romain Hermary et al. applied sample-specific, low-rank linear transformations to high-level feature vectors. This mathematical perturbation ensures that the resulting pseudo-anomalies represent deviations in abstract concepts like shape or texture, making the detector robust against low-level geometric biases like object rotation.

Latent Space Interpolation and Generative Guidance

Rather than applying mathematical noise or distortions to a single feature map, another strategy exploits the topological structure of learned latent spaces via generative models.

If a latent space is well-behaved, the space between normal samples contains highly informative data. Arif Mahmood et al. showed that fusing or averaging the latent embeddings of two distinct normal samples within an autoencoder bottleneck creates realistic "pseudo-anomalies." These points represent plausible, non-existent data variations that force a discriminator to learn a tighter, more precise boundary around the true normal points.

This interpolation concept scales powerfully when paired with modern generative architectures like diffusion models and variational autoencoders (VAEs):

  • Diffusion Interpolation: Clement Fung et al. utilized pre-trained diffusion models to interpolate between the latent representations of normal images. This allows the model to "hallucinate" semantically plausible validation anomalies without requiring any task-specific fine-tuning.
  • Continuous Latent Sampling: Zuhao Liu et al. trained a VAE on synthetic data to establish a continuous anomaly space. By sampling vectors directly from this space, the authors could guide feature transformations to generate an unbounded variety of novel anomalous behaviors.

Instead of merely interpolating between known points, generative models can also be actively steered to find the most informative pseudo-anomalies. Jinyu Cai et al. introduced a learnable perturbation condition into the reverse denoising process of a latent diffusion model. This condition acts as a subtle gravitational pull, steering the generation process away from the core normal distribution toward near-normal samples that exhibit fine-grained irregularities. Similarly, for structured domains like medical imaging, Farzad Beizaee et al. corrupted normal latent states using random-walk masks to simulate realistic, organically shaped anomaly distributions.

By shifting the generation of anomalies from the chaotic world of pixels to the structured world of latent features, these methods allow models to learn the true boundary of normality, resulting in faster training, sharper decision boundaries, and vastly superior generalization to unseen real-world defects.

Key Foundational Work

DSR - A Dual Subspace Re-Projection Network for Surface Anomaly Detection (2022) — contributed 2 concept elements to this direction.
Stabilizing Adversarially Learned One-Class Novelty Detection Using Pseudo Anomalies (2022) — contributed 2 concept elements to this direction.
Generating Anomalies for Video Anomaly Detection with Prompt-based Feature Mapping (2023) — contributed 2 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_synthetic_anomaly_generation_feature_spa_a42a3531,
  title = {synthetic anomaly generation (feature-space anomaly synthesis)},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/synthetic-anomaly-generation-feature-space-anomaly-synthesis/rdr_a42a3531c19c4927b89045d932072e66},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-25},
}

This exact version (version 1, frozen text):

@misc{lacuna_synthetic_anomaly_generation_feature_spa_a42a3531_v1,
  title = {synthetic anomaly generation (feature-space anomaly synthesis)},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/synthetic-anomaly-generation-feature-space-anomaly-synthesis/rdr_a42a3531c19c4927b89045d932072e66/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-25},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake