Source-linked AI summary

Memory-Bounded Continuation of Greedy Sampling for Continual Anomaly Detection

Yoon Gyo Jung, Jaewoo Park, Kuan-Chuan Peng, Seongdeok Bang, Octavia Camps

arXiv:2608.15277v1cs.CVcs.LG

TL;DR

Continual anomaly detection needs to preserve prior normal-data information under fixed memory, but existing approaches can forget past tasks or require unbounded storage. ContCore uses continued greedy sampling with expansion and consolidation, achieving state-of-the-art performance across 11 MVTecAD and VisA task schedules while extending to online settings.

  • Problem

    Continual anomaly detection must retain legacy normal-data information while detecting new anomalies without labels, despite existing methods suffering catastrophic forgetting or requiring costly resources.

  • Method

    ContCore builds a fixed-memory greedy-continued coreset by expanding with distant new-task features and consolidating to preserve representativeness.

  • Results

    ContCore achieves state-of-the-art performance across 11 MVTecAD and VisA task schedules and remains robust in online continual anomaly detection settings.

  • Takeaways & Limitations

    Continued greedy sampling preserves representative normal-data summaries under strict memory limits, supporting continual anomaly detection without unbounded memory growth.

  • Takeaways & Limitations

    The theoretical guarantee assumes bounded Hausdorff-distance errors for the oracle, task summaries, and consolidated coresets.

Abstract

from arXiv · show

Greedy sampling produces a compact yet representative summary of normal data, which is essential for reliable anomaly detection that relies on measuring distance from normality. For continual anomaly detection where tasks arrive sequentially, extending greedy sampling is straightforward with unbounded memory through coreset accumulation. However, practical deployment requires fixed memory where the coreset size remains constant regardless of task count. We observe that continued greedy sampling, which iteratively applies greedy selection over previously greedy-sampled sets, effectively preserves representativeness under strict memory limits. Despite discarding data at each step to satisfy the memory constraint, coreset quality degrades gracefully rather than catastrophically, enabling reliable anomaly detection across the tasks. We provide theoretical justification by showing that resulting greedy-continued coreset approximates the oracle coreset within a bounded gap. We instantiate this principle in ContCore, which constructs a greedy-continued coreset through greedy expansion on new task features followed by greedy consolidation to enforce the memory budget. Unlike neural methods susceptible to catastrophic forgetting or naive coreset accumulation requiring unbounded memory, ContCore maintains fixed memory with theoretical guarantees. Empirically, ContCore achieves state-of-the-art performance across 11 task schedules on MVTecAD and VisA, and extends effectively to online continual AD settings where prior methods degrade significantly. Code: https://github.com/jungyg/ContCore

1 Introduction

Continual anomaly detection must retain legacy normal information while detecting new anomalies under unsupervised, fixed-memory constraints. The paper addresses this with continued greedy sampling and ContCore, providing bounded-gap guarantees and strong results across benchmark task schedules and online settings.

  • Problem: CAD must prevent catastrophic forgetting while retaining legacy information and detecting newly introduced anomalies using only normal training images.The introduction identifies this as the central challenge under the unsupervised setup.
  • Core idea: Continued greedy sampling preserves representative normal-data coverage under strict memory limits, approximating the oracle coreset within a bounded gap.Greedy sampling selects maximally separated points, while its continual extension avoids unbounded memory growth.
  • Method: ContCore performs greedy expansion on new-task features followed by greedy consolidation that enforces the memory budget while preserving representativeness.Expansion selects features maximally distant from the current coreset; consolidation maintains the fixed-size constraint.
  • Evaluation: ContCore achieves state-of-the-art performance across 11 task schedules on MVTecAD and VisA.The method maintains representative normal-data coverage across task transitions.
  • Online evaluation: ContCore remains robust in online continual anomaly detection, where prior methods degrade significantly under stricter conditions.This validates the approach beyond the benchmark task schedules.

2 Related works

Prior anomaly-detection work primarily uses reconstruction or memory-based methods, while continual approaches rely on replay, task statistics, semantic compression, or diffusion-based modeling. These methods face challenges including identity shortcuts, growing memory, label requirements, computational cost, and stability–plasticity trade-offs.

  • Anomaly detection: Anomaly detection methods mainly use reconstruction or memory-based approaches, with multi-class methods addressing the decoder’s identity shortcut issue.Reconstruction methods score anomalies by differences between inputs and reconstructed normal images.
  • Continual anomaly detection: Replay-based continual methods interleave stored past samples with new data but scale poorly as memory grows with task count.Their performance also depends heavily on replay-sample quality.
  • Continual anomaly detection: IUF preserves key semantics through object-aware self-attention and semantic compression but requires class labels, limiting it to supervised settings.Most multi-class anomaly-detection methods instead assume class information is unavailable.
  • Continual anomaly detection: CDAD combines an anomaly-masked diffusion model with SVD-based memory-efficient gradient projection but is computationally heavy and slow to train.The supplied passage ends while describing an additional limitation.

3 Preliminaries

This section defines greedy sampling as distance-based subset selection over latent embeddings and introduces continual anomaly detection as a sequence of tasks containing only normal training data.

  • Greedy Sampling: Greedy sampling selects a subset of latent embedding vectors by maximizing distances within the input set.The operation is denoted G and takes a set Z as input.
  • Greedy Sampling: The set distance from a vector to a selected set is defined as its minimum Euclidean distance to the set’s vectors.This distance is used during greedy selection.
  • Greedy Sampling: The first selected point is chosen randomly or by maximizing its summed distance to all data points.The sampling notation sets G_n(Z) = Z when |Z| ≤ n.
  • Continual Anomaly Detection: Continual anomaly detection consists of an unknown-length sequence of T tasks, each paired with training data containing only normal samples without task or class labels.The tasks are represented as (T_1, ..., T_T), with training data D_t for task T_t.

4 Method

ContCore maintains a representative normal-data coreset under fixed memory by alternating greedy expansion on new-task features with greedy consolidation. Its theoretical analysis bounds the gap to an oracle coreset, while nearest-neighbor approximation reduces consolidation cost.

  • Coreset construction: ContCore alternates greedy expansion, which selects new-task features farthest from the current coreset, with greedy consolidation, which enforces the fixed memory budget.The memory update is M_t = G_m,n_t(Z_t; M_t−1), starting from M_0 = ∅.
  • Coreset construction: The resulting greedy-continued coreset preserves a representative summary of all observed normal data despite bounded memory.Greedy sampling selects maximally separated points, supporting anomaly detection based on distance from normality.
  • Efficiency: Nearest-neighbor approximation accelerates greedy consolidation by selecting a fraction q of samples using nearest-neighbor distances instead of full greedy sampling.The approximation relies on the expanded combined features already being mostly representative.
  • Anomaly detection: At inference, ContCore computes PatchCore-style nearest-distance anomaly scores for patches and labels regions or samples anomalous when scores exceed thresholds.A sample is anomalous if its maximum patch score exceeds the threshold.
  • Theoretical justification: The representational gap between the greedy-continued coreset and the oracle coreset remains bounded, with error accumulating per task without catastrophic compounding.The guarantee supports continued representativeness under memory constraints when per-task sampling size is sufficient.

5 Experiments · 5.1 Experimental setup

The experiments evaluate ContCore’s robustness on MVTecAD and VisA under continual task schedules from prior work, using AUROC and forgetting-related metrics. They compare against state-of-the-art baselines, assess component ablations and theoretical bounds, and examine additional cross-dataset settings.

  • 5 Experiments: Experiments evaluate ContCore against state-of-the-art baselines across 11 continual task schedules, followed by ablations and analyses supporting the theoretical bound.The study also compares ContCore with PatchCore under an oracle setup.
  • 5.1 Experimental setup: Most experiments use the MVTecAD and VisA anomaly-detection datasets, with task schedules following IUF and UCAD.Schedules encode class counts per task; for example, 10 – 1 × 5 denotes one 10-class task followed by five single-class tasks.
  • 5.1 Experimental setup: Cross-dataset continual anomaly-detection results include AUROC and FM measurements.These results are identified in Table 3.
  • 5.1 Experimental setup: Task orders are sorted by class names in ascending alphabetical order, and experiments include transferring between the whole VisA and MVTecAD datasets.The passage specifies the ordering convention and cross-dataset directionality.
  • 5.1 Experimental setup: The schedules test single-class incremental learning, minor updates to multiclass models, and major additions of new classes.Examples include 1×15 and 1×12, 14 – 1 and 11 – 1, and 10 – 5 and 8 – 4.
  • 5.1 Experimental setup: Forgetting measurement quantifies information lost during continual learning by comparing previous-task best performance with final performance.FM averages these differences across previously learned tasks.
  • 5.1 Experimental setup: Results report task-average performance RT and FM for image-level and pixel-level AUROC in the main tables.The evaluation covers image-level and pixel-level anomaly-detection performance.
  • 5.1 Experimental setup: Additional metrics include image-level Average Precision and pixel-level AUPRO, reported in supplementary tables.The supplement contains these results in Tables 11–14.

5.2 Comparison with the SOTA baselines · 5.3 Large scale datasets - Real-IAD · 5.4 Ablation study

ContCore is compared with state-of-the-art continual and anomaly-detection baselines, evaluated on large-scale Real-IAD, and analyzed through ablations of sampling and representation choices. The results indicate reduced forgetting, strong large-scale performance, robust sampling-ratio behavior, and backbone-dependent outcomes.

  • 5.2 Comparison with the SOTA baselines: ContCore is evaluated against UniAD, continual-learning variants, and existing CAD methods across the reported comparison experiments.The comparison covers both continual adaptations of UniAD and established CAD approaches.
  • 5.2 Comparison with the SOTA baselines: UniAD and its continual-learning variants show catastrophic forgetting, whereas CAD baselines achieve lower forgetting and higher AUROC but face task-schedule and complexity trade-offs.Compared methods include EWC, SI, MAS, LVT, DNE, UCAD, IUF, and CDAD.
  • 5.3 Large scale datasets - Real-IAD: Real-IAD evaluation uses a coreset size of m = 250,000, 36,465 normal training images, 114,585 test images, and 30 classes under the official noisefree protocol.The test set contains 63,256 normal and 51,329 anomalous images, with multiple task schedules spanning simple, complex, and mixed settings.
  • 5.3 Large scale datasets - Real-IAD: ContCore outperforms both UniAD-oracle and PatchCore-OneClass in all reported metrics on Real-IAD despite continual task schedules.Training takes around 65,000 seconds for each model.
  • 5.4 Ablation study: Varying the sampling ratio from 0.01 ≤ p ≤ 0.5 does not severely fluctuate overall performance, leading to the selected value p = 0.01.Greedy consolidation retains representative features, while higher p may be needed for datasets with fewer samples.
  • 5.4 Ablation study: Approximation ratio q reduces ContCore’s overall sampling time by approximating greedy consolidation via nearest-neighbor sampling.The ablation focuses on sampling-time differences regardless of performance.
  • 5.4 Ablation study: With large p and m values, sampling time drops to half at q = 0.75, while backbone experiments show performance correlates with extracted-feature representation quality.ContCore consistently performs well across the evaluated backbones.

5.5 Empirical tightness of theory · 5.6 Online learning

The empirical study supports the theoretical bound, with the bound’s right-hand side exceeding oracle coreset distortion across all tested task counts. Under online continual anomaly detection constraints, ContCore achieves state-of-the-art performance with only a minor drop from standard CAD settings.

  • 5.5 Empirical tightness of theory: A toy MVTecAD dataset uses the first 10 classes with 12 images sampled per class to make the bound computable.Computing H(O, ∪Tt=1Zt) requires pairwise distances between every dataset feature and sampled coreset feature.
  • 5.5 Empirical tightness of theory: For single-class incremental tasks T ∈ {2,3,...,10} with m = 150 × T, the right-hand side of Eq. (6) exceeds H(O, MT) for every T.The experiment measures each component of the inequality across the tested task counts.
  • 5.6 Online learning: Online CAD processes each sample exactly once and restricts batch size to 1, unlike prior protocols allowing multiple epochs and unrestricted batches.The sampling ratio is increased to p = 0.1 to obtain maximally informative patch features from single samples.
  • 5.6 Online learning: ContCore is evaluated under the online continual anomaly detection setup reported in Table 8.This table covers the stricter online CAD protocol rather than the standard continual anomaly detection setting.
  • 5.6 Online learning: The online-learning comparison with PatchCore-Oracle is reported in Table 9.The table is part of the online continual anomaly detection evaluation.

5.7 ContCore and PatchCore · 5.8 Qualitative analysis

ContCore is evaluated against PatchCore-oriented coreset baselines and random sampling, showing competitive continual performance and quantitatively better coreset properties. Qualitative MVTecAD results further show stable fine-grained localization across task schedules where other methods forget or fail.

  • 5.7 ContCore and PatchCore: PatchCore performs one offline greedy sampling over all features, while naive accumulation of new features causes memory overflow.PatchCore is not inherently designed for continual learning.
  • 5.7 ContCore and PatchCore: PatchCore-Oracle uniformly divides the memory budget across tasks using oracle knowledge of the total task count.This provides a comparable coreset-based baseline for continual learning.
  • 5.7 ContCore and PatchCore: ContCore performs comparably to PatchCore-Oracle in the standard continual setting.The supplied passage introduces this comparison but truncates the accompanying table values.
  • 5.7 ContCore and PatchCore: Compared with random sampling, ContCore produces more overlapping samples and lower average minimum, sliced Wasserstein, and Hausdorff distances.These measures evaluate how closely the continual coreset approximates PatchCore’s coreset sampled from all features.
  • 5.8 Qualitative analysis: On MVTecAD, UCAD fails on complex schedules such as (14–1, 10–5), while IUF and CDAD fail on the long-ranged schedule (1 × 14).The qualitative comparison visualizes forgetting using samples from the oldest task.
  • 5.8 Qualitative analysis: ContCore maintains stable fine-grained localization quality across the evaluated MVTecAD task schedules.Figure 4 compares anomaly segmentation qualitatively across schedules, with all samples drawn from the first task.

6 Conclusion

Continued greedy sampling preserves a representative normal-data coreset for continual anomaly detection under strict memory limits. The paper combines this empirical observation with theoretical justification.

  • Greedy sampling selects maximally separated points to form a compact, representative summary of normal data.Such representativeness is essential because anomaly detection measures distance from normality.
  • Continual anomaly detection must maintain coreset representativeness as tasks accumulate under memory constraints.
  • Continued greedy sampling effectively preserves representativeness under strict memory limits, with theoretical justification provided.

Theoretical Analysis

The theoretical analysis formalizes greedy continuation across sequential tasks and proves its approximation behavior through Hausdorff-distance bounds. The result follows by combining per-task sampling and consolidation errors with inductive recursion and standard metric inequalities.

  • Greedy-continued coreset: Greedy continuation sequentially samples each task from its embeddings using the previous memory, then consolidates the union into a bounded coreset.The sequence is defined by S_t = G_n_t(Z_t; M_t−1) and M_t = G_m_t(S_t ∪ M_t−1), with M_0 = ∅.
  • Metric tools: Triangle inequality and Hausdorff-distance subadditivity provide the metric tools used throughout the derivation.The propositions are stated before the induction and are used to combine approximation terms.
  • Assumptions: The analysis assumes bounded Hausdorff error for task sampling and consolidation, including H(S_t,Z_t) ≤ ε_t and H(M_t,S_t ∪ M_t−1) ≤ bε_t.These assumptions hold for all t = 1,...,T, with M_0 = ∅ and bε_0 = 0.

8 Additional results

Additional results show that ContCore outperforms state-of-the-art baselines in most reported AP and AUPRO cases across MVTecAD and VisA. Ablations and fixed-memory comparisons further examine coreset size, sampling and approximation ratios, backbones, online continual settings, and qualitative performance.

  • Additional ablation results: The additional experiments evaluate ContCore across coreset sizes, sampling ratios, approximation ratios, backbones, and online continual settings.These ablations are reported for both MVTecAD and VisA in the supplementary tables, with coreset-size variation also illustrated on VisA.
  • Additional quantitative results: ContCore outperforms state-of-the-art baselines in most reported task-mean image-level AP and pixel-level AUPRO cases on MVTecAD and VisA.The comparisons include AP and AUPRO results across the two datasets.
  • Additional quantitative results: ContCore is compared with fixed-memory sampling baselines using an identical m=20k budget, feature representation, and inference procedure, averaged across all schedules.The comparison is summarized in Table 25 using image/pixel results.
  • Qualitative results: Qualitative results visualize anomaly-detection quality for five MVTecAD task schedules, including 1×15, 10–5, 10–1×5, 14–1, and 3×5.The figures cover multiple incremental task arrangements.
Loading 2608.15277v1…