Reconstruction-based anomaly detection trains a network to rebuild only normal examples, then flags whatever it fails to rebuild. It has one well-known failure. A network strong enough to handle many product types also learns to copy its input, so defects come back unchanged and leave no trace in the error. A second weakness gets less attention. Industrial defects come in two kinds. Some are structural: a scratch or a stain. Others are logical: a missing screw or two parts in the wrong order, where every local patch looks normal. A single reconstruction error mixes the two, and current systems separate them only by running two branches and hand-tuning how their scores are combined.
We propose to revive the ladder network for anomaly detection, with one change that makes it usable here. A ladder network is a stack of denoising autoencoders that reconstructs a clean version of every hidden layer at once, with a side connection feeding each layer's noisy code to its decoder. Our change is to replace the ladder's Gaussian noise with structured corruption sized to each layer's receptive field: a small patch of features swapped in at shallow layers, a large region swapped at deep layers. The side connections then carry corrupted content that the decoder must learn to distrust. The copying shortcut is penalized at every depth rather than only at the input. The per-layer reconstruction errors also give a separate anomaly score at each depth, so structural and logical defects should appear at different depths without any hand-weighted fusion.
Core Claim
A denoising ladder trained with level-matched structured corruption and gated side connections will do three things. It will resist the copying shortcut in the one-model-for-all-classes setting. It will localize structural defects in shallow-layer residuals and logical defects in deep-layer residuals. It will do both without class labels. The new ingredient is not "hierarchy plus reconstruction", which several papers already combine. It is using the ladder's own lateral pathway, which prior anomaly work treats as the leak to be cut, as a controlled channel that denoising at each depth teaches to distrust structured corruption.
Where This Sits
Ladder networks come from Semi-supervised Learning with Ladder Networks. That paper runs a clean and a corrupted encoder pass and asks the decoder to recover the clean activations at every level. With 100 labels on MNIST it reaches 1.06% error. Deconstructing the Ladder Network Architecture showed that the side connections carry most of that performance: removing them pushes 100-label error above 16%. It also showed that a learned multiplicative combinator, the Augmented MLP (AMLP), which gates between the side and top-down signals, beats hand-designed ones. Both papers study only semi-supervised classification. They supply our architecture and gating mechanism, but say nothing about anomalies.
The anomaly side motivates the proposal and also constrains it. A Unified Model for Multi-class Anomaly Detection (UniAD) showed that unified models copy their inputs. It fights this by masking each position's neighborhood in attention and by adding Gaussian "feature jitter" to frozen EfficientNet-b4 features. This is a single-level denoising objective whose noise is easy to tell apart from real defects. We keep UniAD's frozen features and its evaluation setting, but denoise at every level with structured corruption.
Hierarchical Vector Quantized Transformer for Multi-class Unsupervised Anomaly Detection (HVQ-Trans) forces features through hierarchical codebooks of normal prototypes. Its codebook-switching mechanism, however, needs category labels, and codebooks are prone to collapse. We impose no discrete bottleneck and use no labels.
DRÆM trains a single U-Net to undo synthetic texture corruptions and learns a discriminator on the pair of input and reconstruction. It corrupts only at the pixel level, and it degrades in the unified setting.
Learning Global-Local Correspondence with Semantic Bottleneck for Logical Anomaly Detection (GLCF) separates local and global branches for logical anomalies but fuses their scores by manual weighting. That is the design choice our per-depth normalization is meant to replace.
Background motivates the depth split. Semi-supervised Learning of Feature Hierarchies for Object Detection in a Video reports that lower layers of stacked autoencoders capture local primitives while higher layers capture global structure. Autoencoders, Unsupervised Learning, and Deep Architectures interprets stacking as successive clustering of cluster centers. Neither was tested on anomalies.
Research Program
The primary model runs on frozen multi-stage EfficientNet-b4 features, exactly as UniAD does, so that any gain comes from the reconstruction design and not the backbone. Let $h_l$ be the backbone feature map at stage $l = 1, \dots, L$. It serves as the clean target.
In the corrupted pass, a random set of spatial regions of $h_l$ is overwritten with features taken from other locations or other normal training images. The region size is scaled to stage $l$'s receptive field, so shallow stages see texture-sized swaps and deep stages see part-sized swaps. Swapped content is locally normal but out of context, which is what a logical anomaly looks like. It is also what Gaussian jitter cannot imitate.
The decoder works top-down. At each stage it combines the corrupted side signal $\tilde h_l$ with the upsampled reconstruction from the stage above, using a per-location AMLP-style gate, and outputs $\hat h_l$. Training minimizes
$$\mathcal{L} = \sum_{l=1}^{L} \lambda_l \, \lVert \hat h_l - h_l \rVert_2^2,$$
where $\lambda_l$ is a per-stage weight. We fix $\lambda_l$ by equalizing each stage's initial loss rather than searching over it, which addresses the ladder's known hyperparameter burden.
At test time the input is clean, so the side connections carry any real defect. We expect the gate to have learned to down-weight side content that the top-down context does not predict.
Scoring has two steps. The per-stage residual map $\lVert \hat h_l - h_l \rVert$ is first z-scored against its own statistics on held-out normal images. The pixel map and image score are then the maximum over stages. No anomalies or class labels are used anywhere.
A secondary arm tests the direction the literature calls under-explored: learning the hierarchy end to end from pixels. It trains the same ladder with a trainable convolutional encoder and no ImageNet initialization. This asks whether the argument of SPot-the-Difference Self-supervised Pre-training for Anomaly Detection and Segmentation, that ImageNet features discard the local detail defects live in, translates into gains for reconstruction ladders. We expect this arm to lose on absolute numbers and treat it as a scientific question, not the headline.
Baselines
The naive reference is a monolithic convolutional autoencoder trained with SSIM or $L_2$ loss, as in the original MVTec AD benchmark. There it reached image AUROC 0.93 on bottle and 0.86 on cable, with per-region overlap of only 0.05 on cable. We retrain it in the unified setting on our data splits to show how badly copying hurts without any countermeasure.
The strongest label-free competitor is UniAD. It reports unified MVTec AD detection AUROC of 96.5% and localization AUROC of 96.8%, plus a many-versus-many CIFAR-10 mean AUROC of 87.2%. It is the right comparison because it shares our backbone and setting and attacks the same shortcut with a single-level denoising objective. We run the released configuration and our model with the same frozen EfficientNet-b4 stages, image resolution, epoch count, and an equal hyperparameter search budget. Beating it means higher unified detection and localization AUROC on MVTec AD and VisA across three seeds, with the gap exceeding seed variance.
The strongest overall competitor is HVQ-Trans. It reports 98.0% unified detection AUROC on MVTec AD, against 96.5% for UniAD and 96.4% for PatchCore, and 93.2% on VisA. Because HVQ-Trans uses class labels for codebook switching, we report it as an upper reference. Matching it without labels would count as a success. On VisA, DiffusionAD reports 98.8% image AUROC and 96.0% pixel PRO, but the file does not make clear whether this is the unified setting, so we rerun it where compute permits rather than compare to that number directly.
DRÆM is the monolithic denoising baseline. It reports 98.0 image AUROC per class and drops to 88.1% detection AUROC unified, as measured by UniAD.
For logical anomalies on MVTec LOCO, GLCF is the competitor. It reports only a relative sPRO gain of 24.9% over DRÆM; no reported absolute LOCO result was found on Lacuna for GLCF or any other method. We therefore rerun GLCF and DRÆM ourselves under the same protocol.
Four ablations isolate the key ingredient. The first replaces structured swaps with UniAD-style Gaussian jitter at every stage. The second applies structured corruption only at the pixel input. The third removes side connections. The fourth keeps them ungated. Separately, we compare max-over-normalized-stages fusion against GLCF-style fixed weighting.
Why not just…?
Why not just read per-stage residuals out of UniAD? UniAD already reconstructs multi-stage features, so splitting its error by stage might give the depth separation for free. This is the most serious threat, and we test it directly: we compute UniAD's per-stage residuals and run the same depth-resolved analysis on MVTec LOCO. If UniAD shows the same structural-shallow, logical-deep pattern, our contribution narrows to the corruption and gating design and must earn its place on the ablations alone.
Why not just drop the side connections and rely on a tight bottleneck? Removing laterals stops copying but blurs the reconstruction. DiffusionAD-style analyses in DiffusionAD: Denoising Diffusion for Anomaly Detection identify this blur as a source of false positives on fine textures, and the ladder deconstruction shows how much performance the laterals carry. The no-lateral ablation measures exactly this trade-off on texture categories.
Why not just use HVQ-Trans's discrete prototypes? Quantization blocks copying well, as shown by its roughly 26% drop without the quantization module. But it relies on class labels and on codebooks that can collapse. If HVQ-Trans with labels clearly beats our label-free model, we report that honestly. The label-free, one-model setting remains the regime our method targets.
Why not just use multi-scale DRÆM? DRÆM's pixel-level corruption cannot simulate a correctly rendered but misplaced part. The input-only corruption ablation is effectively this alternative inside our architecture, so it will show whether corrupting at the features' own depth matters.
Decisive Checks
The first check is a shortcut diagnostic. Over training, we track the ratio of residual inside ground-truth defect regions to residual on normal regions. Copying shows up as this ratio drifting toward one. The method succeeds only if the ratio stays high where ungated and Gaussian-jitter variants decline.
The second check is depth resolution on MVTec LOCO. We compute detection AUROC per stage, separately on the structural and logical subsets. The claim predicts that the best stage for logical anomalies is deeper than the best stage for structural ones. If the curves coincide, the depth-separation claim fails.
The third check is that label-free max-over-stages fusion should match or beat GLCF's hand-weighted fusion on LOCO. Together with unified MVTec AD and VisA AUROC against UniAD under matched budgets, these three results decide whether the idea stands.
References
- Semi-supervised Learning with Ladder Networks
- Deconstructing the Ladder Network Architecture
- A Unified Model for Multi-class Anomaly Detection
- Hierarchical Vector Quantized Transformer for Multi-class Unsupervised Anomaly Detection
- DRÆM - A discriminatively trained reconstruction embedding for surface anomaly detection
- Learning Global-Local Correspondence with Semantic Bottleneck for Logical Anomaly Detection
- Semi-supervised Learning of Feature Hierarchies for Object Detection in a Video
- Autoencoders, Unsupervised Learning, and Deep Architectures
- SPot-the-Difference Self-supervised Pre-training for Anomaly Detection and Segmentation
- MVTec AD - A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection
- DiffusionAD: Denoising Diffusion for Anomaly Detection