Resetting the Loop: Stopping Self-Inflicted Errors in Recursive Reconstruction Anomaly Detectors

Reconstruction-based anomaly detectors learn what normal images look like, "repair" a test image toward normal, and flag the pixels that changed. Recursive versions run the same repair network several times on its own output, and they now match far larger models on industrial inspection benchmarks. The weakness this note targets is simple. Every pass after the first takes the previous pass's output as its input. Any mistake an early pass makes on a normal region becomes trusted input for later passes: a blurred wood grain, or a grid-shaped artifact from the upsampling layer. Later passes then build on that mistake, and the final "what changed?" map reports the error as a defect. Language-model agent pipelines show the same failure, where an early fabricated claim cascades downstream. That literature has developed tools to track how much of a step's error is inherited and to prune corrupted context between rounds. Nobody has applied those tools to the pixel loop.

We propose recursive reconstruction with context reset. At every pass we estimate how much of each pixel's change is inherited from earlier passes and how much originates in that pass. We then return regions judged normal to their original pixel values before the next pass, so the loop keeps editing only the regions it still suspects. The same evolving outlier mask also chooses, without any labels, which feature channels the final anomaly score uses. We use the sub-pixel upsampling layer in the decoder as a controlled source of injected errors to test whether the method separates inherited artifacts from real defects. In two sentences: recursive anomaly detectors poison their own context, and we measure and cut that inheritance pass by pass. The pixels that survive as anomalous are those the model still wants to change when it sees clean surroundings.

Core Claim

RcAE feeds a weight-shared autoencoder its own output for $N$ passes. A 3D-convolution module observes how reconstructions fluctuate across passes. A separate detail network restores textures. RcAE reports 98.9% image AUROC and 98.7% pixel AUROC on MVTec AD. It never prevents an early pass's distortion from becoming later passes' input. It only watches the fluctuations after the fact.

Our claim is that a meaningful share of recursive-reconstruction false positives on normal textures is inherited: it disappears if the pass is rerun with earlier edits to normal regions undone. Undoing them should improve pixel-level precision without hurting recall on real defects. We further claim that the outlier mask produced by this loop is a usable label-free supervisor for choosing scoring features. This closes the supervision gap in greedy eigencomponent selection, which reaches 100% AUROC on "bottle" and "wood" with under 10 components but picks those components using labeled anomalies.

Mechanism

Let $x_0$ be the test image, $f$ the repair network, and $m_{t-1}(p)\in[0,1]$ the current belief that pixel $p$ is anomalous. Ordinary recursion computes $x_t = f(x_{t-1})$. We additionally form a reset input. It keeps the previous edits only where the mask is confident and restores the original image elsewhere:

$$\tilde{x}_{t-1} = m_{t-1}\odot x_{t-1} + (1-m_{t-1})\odot x_0 .$$

Running $f$ on both inputs splits each pixel's change into two parts. The inherited deviation $a_t(p)=|f(x_{t-1})_p - f(\tilde{x}_{t-1})_p|$ is how much the output at $p$ depends on earlier edits to supposedly normal context. The originating deviation $u_t(p)$ is the feature-space distance between $f(\tilde{x}_{t-1})$ and $x_0$ at $p$. We normalise $a_t$ into an acceptance weight $\alpha_t(p)\in[0,1]$. We then update the risk that $p$ is corrupted using the propagation rule of PropUQ-MAS, where the agent graph becomes the chain of passes:

$$r_t(p) = 1-\big(1-u_t(p)\big)\big(1-\alpha_t(p)\,r_{t-1}(p)\big),$$

The final anomaly score credits only originating evidence: $s(p)=\sum_t u_t(p)\,(1-\alpha_t(p)\,r_{t-1}(p))$. The next mask $m_t$ is a smoothed threshold of $s$.

PropUQ-MAS concedes that it assumes local and inherited uncertainty are independent. Here $\alpha_t$ is not assumed. It is measured by a counterfactual forward pass. The reset step plays the role of the between-round pruning in memory-masked debate, which removes erroneous transcript content before the next round. Here the "transcript" is the image and the pruning is restoration of the original pixels. Both cited works supply technique and are evaluated only on text. The transfer is the contribution, not the formulas.

The feature-selection loop works as follows. $u_t$ is computed in a subspace $S$ of frozen backbone channels. After each full recursion we re-choose $S$ by recursive backward elimination. The criterion is the average score margin $J$ from HOUR, the gap between the top-$k$ scored pixels and the median pixel, with the current mask standing in for outlier labels. HOUR was built for categorical data, and its cost grows quadratically in the number of features. We therefore run elimination over eigencomponents of the normal-feature covariance, as Gula and Bertoldo did, rather than over raw channels.

The obvious danger is self-confirmation, where the loop locks onto whatever it flagged first. The experiments compare against selection guided by synthetic defects and against a labeled oracle precisely to expose this.

Role of Sub-Pixel Upsampling

Sub-pixel convolution (pixel shuffle) upsamples by predicting $r^2$ channels per low-resolution location and rearranging them into an $r\times r$ block. The checkerboard note identifies three ways this layer produces periodic grid artifacts:

  • Kernel overlap: the filter size does not divide evenly by the stride.
  • Random initialisation: independently initialised sub-kernels behave differently at the start of training.
  • Training losses: some losses re-create the artifacts during training even after ICNR initialisation, which copies one sub-kernel across all positions.

These artifacts land directly in residual maps. They also have a known spatial frequency, $1/r$. That makes the decoder a natural instrument: it injects errors whose origin we can verify. We train three otherwise identical decoders: plain pixel shuffle, pixel shuffle with ICNR, and the resize-then-convolve design used by EnhanceNet. Our prediction is that plain recursion amplifies the periodic residual energy over passes, and context reset suppresses it.

Research Program

Stage 1: measure the problem. We train a convolutional autoencoder on normal images only, using SSIM loss, which MVTec AD found better than L2 for this task. We run plain recursion for $N=1\ldots8$ passes. On normal test images we record:

  • the false-alarm area;
  • the Fourier power of residuals at frequency $1/r$;
  • the fraction of each pass's change that vanishes under reset.

If inherited deviation is small, the premise fails and we stop. That is a cheap, decisive first check.

Stage 2: add context reset and propagated risk, with the mask initially computed in the full feature space.

Stage 3: add the label-free feature-selection loop.

Stage 4: pass-level attribution study, modelled on AgentHallu. AgentHallu shows that strong models localise the responsible step in only 41.1% of agent trajectories, and that accuracy falls as trajectories get longer. We inject a known distortion at a chosen pass $k$, either a checkerboard patch or a texture smear. We then ask whether the argmax over passes of $u_t(1-\alpha_t r_{t-1})$ recovers $k$, and how accuracy changes with $N$.

Baselines

The naive reference is a single-pass SSIM autoencoder with the same encoder, decoder and backbone. It is the starting point that recursion is supposed to improve.

The strongest existing reconstruction method in the file is RcAE, which reports 98.9% image AUROC and 98.7% pixel AUROC on MVTec AD (RcAE). We will reproduce it with its cross-recursion module and detail network, using our backbone and our three decoder variants. Our method costs two forward passes per iteration. RcAE will therefore get $2N$ passes and the same total tuning trials per category, so the comparison is matched in compute rather than in pass count. We treat a reproduction falling short of the reported numbers as a reproduction gap to report, not a baseline to beat.

DRÆM is the strongest discriminative-reconstruction competitor on localisation. It reports 98.0 image AUROC and 68.4 pixel AP on MVTec AD, and 99.0 image AUROC on DAGM. Pixel AP and PRO are the metrics where reducing false positives should show. For VisA, no reported RcAE or DRÆM result was found on Lacuna, so we will run both ourselves.

"Beating" means two things on MVTec AD at equal compute:

  • a statistically reliable gain in pixel AP and PRO over reproduced RcAE, with image AUROC no worse;
  • a reduction in false-alarm area on normal images.

The key ablations isolate each ingredient:

  • Context reset with a hard fixed threshold and no propagated risk. This isolates whether the soft risk rule earns its place.
  • Propagated scoring without reset, which keeps feeding $x_{t-1}$ forward. This isolates the reset itself.

Feature-selection baselines all use the same final mask:

  • the full feature space;
  • top-variance PCA and lowest-variance PCA;
  • greedy selection guided by synthetic Perlin-noise defects in the DRÆM style;
  • Gula and Bertoldo's labeled greedy search, as an oracle ceiling.

Why not just…?

Why not just use resize-convolution and avoid checkerboard artifacts entirely? Resize-convolution removes one error source, periodic grids, but not the inheritance mechanism. Blurred textures from early passes still propagate. Our decoder sweep tests this directly. If resize-convolution under plain recursion matches pixel-shuffle with context reset, inherited error was mostly an upsampling artifact, and the honest conclusion is "choose your decoder carefully," not our method. We regard this as a real threat. The diagnostic is false-alarm area on texture categories after the $1/r$ frequency component is removed from residuals.

Why not just average residuals across passes, or rely on RcAE's cross-recursion module? Averaging and temporal convolution both look at outputs that were already computed from corrupted inputs. Neither ever sees what the network would produce from clean context. The without-reset ablation is exactly this family. Stage 4's injected-distortion attribution tests whether output fluctuation alone can identify the pass that introduced an error, compared with our counterfactual estimate.

Why not just reset with a simple threshold? This is plausibly most of the gain, and we say so. If the hard-threshold ablation matches the propagated-risk version, the contribution narrows to "context reset," which is still absent from RcAE. In that case we would drop the risk rule rather than defend it.

Why not just select features with synthetic defects instead of the self-generated mask? Synthetic Perlin anomalies are a label-free surrogate and may transfer well. If synthetic-guided greedy selection matches or beats mask-guided elimination, the joint loop adds nothing and we will report that. The decisive comparison is per category against the labeled oracle. Mask-guided selection should help most where synthetic textures look least like real defects, for example on object categories rather than textures.

Proposed Experiments and Decisive Checks

Benchmarks and metrics. We use all 15 MVTec AD categories, VisA's 12 objects, and DAGM. We report image AUROC, pixel AUROC, pixel AP and PRO. We add two diagnostics computed on normal test images: false-alarm area at a fixed operating threshold, and residual Fourier power at frequency $1/r$.

Go/no-go checks. The project stands or falls on three checks:

  1. Stage 1 must show inherited deviation. On normal images, a non-trivial fraction of late-pass change must disappear under reset, and that fraction must grow with $N$. If it does not, the premise is false.
  2. Context reset must cut false-alarm area relative to plain recursion, and the improvement must hold under the RcAE comparison matched to $2N$ passes. If it does not, the extra compute alone explains any gain.
  3. Feature selection must not collapse onto its seed. Mask-guided selection must recover a component set that overlaps the labeled-oracle set more than PCA or low-variance PCA does, and that set must stay stable across random initial masks. Otherwise the joint loop is merely confirming whatever the initial mask flagged.

Attribution study. Accuracy in recovering the injected pass $k$, plotted against $N$, will show whether pixel recursion degrades with chain length the way agent trajectories do in AgentHallu.