Manuscript Offprint
arXiv:2610.31538LACToS: Local Anomaly Detection via Conditional Typicality of Superpixels
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
Local anomaly detection is the task of identifying spatially confined anomalous or out-of-distribution (OOD) regions within an otherwise in-distribution (ID) image. Most existing methods are designed for a specific context, with a strong focus on industrial defect detection, where they achieve excellent performance on well-established benchmarks. However, we observe that these methods can exhibit significant performance drops in other contexts, especially when the inlier distribution is multimodal. To account for this inlier complexity, we propose LACToS, a principled local OOD detection method based on statistical typicality and made tractable through two innovations: (i) grouping pixels into superpixels and (ii) using a computationally efficient proxy to estimate typicality. We evaluate LACToS across three diverse applications spanning medical imaging, human faces, and X-ray security screening. LACToS performs more robustly than prior methods across these benchmarks. The code is released here: https://github.com/voilalab/LACToS.
1 INTRODUCTION
Local anomaly detection is the task of identifying out-of-distribution (OOD) regions that are spatially confined within an otherwise in-distribution (ID) image. It is central to applications such as industrial defect inspection, medical image analysis, and security screening, where an anomalous region may occupy only a small fraction of the image yet indicate a defect, tumor, or weapon. Unlike image-level OOD detection, which assigns a single anomaly score to an entire image, localized pixel-level anomaly detection involves generating a dense heatmap that indicates which pixels or regions of each outlier image are inconsistent with the inlier distribution. This makes the problem espe-
Image
LACToS
Heatmap

Figure 1: Using a diffusion model pretrained on ID images only, LACToS is able to identify locally OOD regions in images across various tasks, including tumors in CT scans, anomalies such as scars on faces, and harmful objects such as scissors in X-ray baggage scans.
cially challenging: a local OOD detector must be sensitive to subtle local deviations while remaining robust to natural variation in normal image content.
Prior work on localized anomaly detection has largely followed representation-based and reconstruction-based approaches. Representation-based methods extract local features from normal (inlier) training images, and score test patches using their distance from the learned distribution or their
Equal contribution.
likelihood under it (Cohen and Hoshen, 2020; Defard et al., 2021; Roth et al., 2022). Reconstruction-based methods instead reconstruct, inpaint, or denoise the target image under a prior for inlier images, and use the discrepancy between the input and its reconstruction as an anomaly signal (Mousakhan et al., 2024; Wu et al., 2024). Although both approaches have achieved strong empirical performance, especially for industrial defect detection (Bergmann et al., 2019), their anomaly scores are often heuristic: representation-based methods depend on the choice of feature and distance metric, while reconstruction-based methods typically collapse the distribution of inlier completions into a point estimate. Conformal and risk-control methods can provide statistical guarantees for calibrated segmentation outputs (Shen and Liu, 2025), but they generally rely on a large amount of OOD calibration data. Moreover, we empirically observe that these methods do not always generalize reliably beyond industrial defect detection.
We present LACToS, a statistical method for local OOD detection that is designed to address these limitations of existing methods. Our approach is fundamentally reconstruction-based, but uses the key insight that the distribution of the reconstructions contains valuable information that is lost when reconstruction error is computed using a single sample or an aggregated point estimate. To leverage this richer distributional information towards improved local anomaly detection, we propose an anomaly metric based on statistical typicality, a measure of how representative a sequence of observations is for a given distribution. Our use of typicality is inspired by previous typicality-based OOD detection methods (Nalisnick et al., 2019; Osada et al., 2023; Barkley et al., 2026). However, these works are focused on image-level OOD detection where an entire image is classified as OOD, and to the best of our knowledge, using typicality for local anomaly detection has not yet been explored.
We begin with the typicality score of Nalisnick et al. (2019), and adapt it to identify local rather than whole-image anomalies (Section 4.1). Instead of asking whether an entire image is typical with respect to the unconditional prior distribution, we ask whether each pixel is typical with respect to the inpainting posterior conditioned on all other pixels in the image. However, this substitution induces three major challenges: (i) failure to detect larger local anomalies that span multiple contiguous pixels, (ii) loss of statistical validity, because typicality testing requires sampling a sequence of i.i.d. observations, and (iii) prohibitive computational cost of performing posterior sampling separately for each pixel.
LACToS tackles these challenges through two innovations: we partition images into superpixels and replace pixel-level typicality with superpixel-level typicality (Section 4.2), and we use a single denoising posterior as a common proxy for all inpainting posteriors. Our use of superpixels addresses challenges (i) and (ii), because a local OOD feature is more likely to be captured by a superpixel than a single pixel, and the individual pixels in each superpixel can be treated as independent observations to evaluate superpixel-level typicality. Our use of denoising rather than inpainting addresses challenge (iii), by dramatically reducing the number of posterior samples needed to estimate typicality. Through these innovations, we show that LACToS achieves strong quantitative and qualitative performance across a wide range of local OOD detection tasks including detecting tumors in CT scans, detecting unusual facial accessories in photographs, and detecting weapons in X-ray baggage scans.
To summarize, we propose LACToS, a statistical approach to local OOD detection in images using an inlier diffusion model and typicality testing. Our method (1) is grounded in statistical typicality, and (2) is competitive with, and often more precise than, existing methods across diverse local OOD detection tasks with complex inlier distributions.
OOD detection is studied at both the image and pixel (local) levels. Image-level OOD detection assigns a single anomaly score to an entire image, with the goal of identifying images that are not drawn from the inlier distribution seen during training. In contrast, we focus on pixel-level OOD detection, in which the goal is to produce a dense anomaly heatmap to localize anomalous regions.
within each image. Formally, given an image , the goal is to estimate the ground truth anomaly mask . Previous works (Mousakhan et al., 2024; Wyatt et al., 2022; Defard et al., 2021) define an anomaly score that captures how likely each pixel is to be OOD, where is an index set of size over all pixels. Then, they compute an anomaly heatmap with elements for each pixel, fix some threshold , and set . Many of these works, especially those using diffusion models, are reconstruction-based: they generate an in-distribution reconstruction of the input using posterior sampling and use discrepancies such as , , SSIM (Wang et al., 2004), LPIPS (Zhang et al., 2018), or feature-space distances as anomaly scores (Zavrtanik et al., 2021; Wu et al., 2024; Mousakhan et al., 2024; Pirnay and Chai, 2022). Although effective, these methods often collapse the distribution of plausible reconstructions into a first-order statistic, such as the mean reconstruction error, which does not capture the full reconstruction distribution and can reduce robustness to complex inlier distributions.
Meanwhile, distribution-aware statistics have been explored across several image-level OOD detection methods. For example, EigenScore (Shoushtari et al., 2025) uses the eigenvalue spectrum of the posterior covariance, and DDPM-OOD (Graham et al., 2023) aggregates standardized reconstruction statistics. There are also typicality-based methods that compare the average negative log-likelihood of the samples with the entropy of the inlier distribution (Nalisnick et al., 2019; Osada et al., 2023; Barkley et al., 2026). Specifically, let be independent draws from the inlier distribution . The -typical set is defined as
where is the entropy of . By the Asymptotic Equipartition Property (Cover et al., 1991),
For image-level OOD detection, Nalisnick et al. (2019) estimate the deviation from typicality as
and classify a set of samples as OOD when exceeds a threshold. Typicality has been shown to be a more effective image-level OOD detection metric than likelihood, especially in high dimensions (Nalisnick et al., 2019; Osada et al., 2023).
3 MOTIVATION
The local OOD detection problem has been extensively studied in the context of industrial defect detection. Prior works such as PatchCore (Roth et al., 2022), EfficientAD (Batzner et al., 2024), GLASS (Chen et al., 2024), and diffusion-based DDAD (Mousakhan et al., 2024) achieve excellent performance on widely used benchmarks such as MVTec AD (Bergmann et al., 2019) and VisA (Zou et al., 2022). However, we observe that these methods do not extend robustly to other OOD detection tasks, such as tumor detection, facial anomaly detection, and security screening using X-ray images, as shown in Table 1. One potential cause of this brittleness is the complexity of the inlier distribution. Industrial defect-detection datasets often have very structured inlier distributions, as products without defects are visually near-homogeneous, whereas CT scans, images of human faces, and X-ray baggage scans are far more heterogeneous even in the absence of anomalies. Moreover, defects in products are context-agnostic: a defective feature, such as a crack or fracture, is anomalous regardless of where in the image or product it occurs. In contrast, a dark region in a CT scan may be innocuous normal anatomy in one location, or indicative of a tumor in another.
Specifically, when the conditional distribution over a local region given the rest of the image is multimodal, methods that rely on a first-order statistic may erroneously identify samples from a different inlier mode as anomalous. To illustrate this phenomenon through a toy experiment, we construct four inlier distributions with increasing complexity levels, and train a diffusion model on each inlier distribution. Each image contains four shapes, one per quadrant. In the upper-right quadrant, every inlier image contains a circle, which allows us to define all other shapes placed in that quadrant as local anomalies. The other three quadrants can contain a wider variety of shapes, as shown in the top row of Figure 2, with the candidate shapes at each level occurring with equal probability. From level 1 to level 4, the set of shapes that can be placed in these three quadrants progressively grows, which increases the number of modes of the inlier distribution. We then introduce local anomalies in test images by replacing the top-right circle with a square, and evaluate two baseline methods, DDAD (Mousakhan et al., 2024) and PatchCore (Roth et al., 2022), on how well they can correctly identify only the square as an anomaly. The bottom row of Figure 2 demonstrates that at a per-image true positive rate (TPR) of 95%, the false positive rate (FPR) increases with inlier multimodality for both baseline methods. This trend holds across the TPR values shown in Figure 7. For more information on the experimental setup, please refer to Section B.
4 METHOD
To tackle this problem, we propose LAC-ToS, a typicality-based pixel-level OOD detection method using diffusion models, which is much more robust to inlier multimodality. In Section 4.1, we first describe an idealized extension of an existing typicality-based metric for image-level OOD detection to pixel-level anomaly localization, and several issues that limit its direct application. Then, in Section 4.2 and Section 4.3 we introduce two key techniques, superpixels and a denoising proxy, that help overcome these issues and allow for an effective and tractable approximation to pixel-level typicality. In Section 4.4, we additionally incorporate extracted pixel-level features which can provide more informative statistical context than color alone.
Throughout, we use to denote the test image and subscripts to identify specific pixels or superpixels. Similarly, we use (again with appropriate subscripts) to de-

Figure 2: Multimodality Toy Experiment. (Top) Images from the inlier distributions across different complexity levels. The top-right corner always contains a circle, while other corners can contain different shapes, with a wider variety of shapes at higher levels. (Bottom) False positive rates at true positive rate of 95%, evaluated on images that contain anomalous squares in the top-right corner.
note the corresponding random variable under the prior or posterior, with Monte Carlo realizations indexed by superscripts.
4.1 TYPICALITY-BASED ANOMALY SCORE
A natural extension of the existing typicality-based OOD detection metric in Equation (3) from images to pixels is conditional typicality. It is defined as
where the superscript inp stands for inpainting, and are the values of pixel and all remaining pixels in the test image and all other pixels, respectively, and is the distribution of prior-consistent values for pixel when all other pixel values are fixed at their observed values . Intuitively, we define a pixel in to be OOD if it does not belong to the typical set with respect to this conditional data distribution , given all other pixel values.
Unfortunately, this direct extension of typicality to conditional distributions in Equation (4) is not a practical score for anomaly detection for the following reasons. (P1) Due to the spatial locality of pixel intensities and the smoothness of natural images, the value of a pixel given all others is often strongly constrained by nearby pixels. With conditional distributions that are concentrated on a tiny set determined by the neighboring pixels, the typicality score is unlikely to capture OOD features that span multiple adjacent pixels. (P2) In addition, a single pixel value is a sequence of length 1, which is insufficient for the theoretical guarantees of typical sets (Equation (2)) to hold. Indeed, the typicality test of Nalisnick et al. (2019) has been shown to exhibit poor empirical performance on single samples (Chauhan et al., 2022). (P3) It is also computationally demanding to compute the anomaly heatmap A by approximating Equation (4), as has to be evaluated for every pixel . Using N posterior samples for a Monte Carlo estimate of for each pixel would require a total of posterior samples, which is computationally prohibitive at practical image resolution H, W. (P4) Finally, raw RGB values often do not capture sufficient information about local image contents, including semantic information, which can lead to subpar performance in anomaly detection tasks.
4.2 SUPERPIXEL-LEVEL TYPICALITY
Our first key insight is that superpixels (Ren and Malik, 2003; Achanta et al., 2012; Stutz et al., 2018), groups of spatially contiguous pixels that share similar color, can help us address (P1) and (P2), by grouping OOD pixels together into small groups that are easier to detect and can be treated as a sequence to estimate typicality. The latter requires Assumption 4.1, which captures the intuition that, within each superpixel, individual pixel values are independent and identically distributed. An example of superpixels is visualized in Figure 3.
Concretely, we define to be a fine-grained superpixel partition of the pixels in , which can be obtained using off-the-shelf superpixel algorithms (Achanta et al., 2012; Van den Bergh et al., 2012; Liu et al., 2011; Li and Chen, 2015). Here indexes superpixels and is the set of pixels in superpixel . Let denote image pixels in superpixel , and denote all other pixels.

Figure 3: A fine-grained superpixel decomposition of an example image.
Assumption 4.1. [Conditionally i.i.d. pixel values within each superpixel] Given and , there exists a single-pixel distribution associated with each superpixel such that
Under Assumption 4.1, we define the superpixel-level typicality score as
where is the conditional distribution of the superpixel given all other pixel values, and the last equality holds due to the conditional independence assumption (Assumption 4.1) on the pixels in . We can then compute the pixel-level anomaly heatmap by estimating the typicality score in Equation (5) using Monte Carlo sampling. For each superpixel , this involves drawing samples from the inpainting distribution , extracting pixels , fitting a histogram to estimate , and computing the estimate . Finally, for pixel-level scores it is natural to duplicate the same score over all pixels , i.e. for all , and apply Gaussian smoothing to smooth out the hard boundaries between superpixels.
Estimating the superpixel-level typicality score rather than the pixel-level typicality score helps address these problems. (P1) By inpainting a group of similar pixels instead of a single pixel, can better identify local OOD features that span multiple pixels than . (P2) Under Assumption 4.1, we are given a sequence of independent observations for , which facilitates computing a typicality score for each superpixel. (P3) In terms of computational cost, the number of anomaly scores to evaluate is reduced from the number of pixels to the number of superpixels . We can also use a much smaller number of samples to compute the histogram for , since each posterior sample from translates to samples from .

Figure 4: LACToS Overview. (1) Posterior Sampling. We sample noise independently from an isotropic Gaussian distribution and add it to the test image to create noised versions of denoted by . Then, using diffusion-based posterior sampling methods, we sample reconstructions . (2) Feature Extraction. For and each sample , we pass the image through a pretrained ResNet model, extract activations, and compress them using an encoder to create a feature vector of dimension for each pixel, where is the original channel dimension. (3) Histogram Fitting. For a given superpixel , we gather the features of the reconstructed pixels in the superpixel, and construct , a -dimensional histogram. (4) Typicality Computation. Finally, using the fitted histogram, we compute the typicality of the pixel features in and report the anomaly heatmap .
4.3 DENOISING POSTERIOR
Although superpixel-level typicality reduces the required number of posterior samples from to , the cost remains prohibitive for fine superpixel partitions. For instance, Figure 3 shows a image partitioned into 2,600 superpixels (approximately 25 pixels per superpixel on average), which would require a total of at least 2600 posterior samples using a diffusion model. This cost could be reduced by partitioning the image into fewer, larger superpixels, but these may struggle to localize small anomalies and fail to satisfy Assumption 4.1.
We overcome this problem (P3) by estimating for all simultaneously using a small number of posterior samples. Instead of using different samples from each of the inpainting conditional distributions , we use the same samples from the denoising conditional distribution, defined as
For each , we pool the pixel values across these samples to form , which we use to fit a histogram for , and compute the anomaly score.
Intuitively, serves as a shared relaxation of the superpixel-specific inpainting posteriors . In each , the complement is fully observed while is left unobserved. For the denoising posterior , there is a tension between information on and lack of information on , controlled by the noise level . With increasing , we lose more information about , which is desirable, but we also lose information about the context . The following theorem informally bounds the error introduced by replacing the inpainting posterior with the denoising posterior. Appendix section D states and proves the formal result and gives bounds without Assumption 4.1.
Theorem 4.1. (Informal). Let and be the anomaly scores obtained using the ideal inpainting distribution and the proxy denoising distribution with a noise distribution of , respectively. Under appropriate assumptions, the error can be bounded as
for some positive constants , and .
4.4 FEATURE AUGMENTATION
One final problem remains (P4): RGB values alone may not distinguish local ID and OOD features. To address this issue, (P4) we follow the convention of previous works (Mousakhan et al., 2024; Roth et al., 2022; Defard et al., 2021) and augment RGB values with additional features. Specifically, we extract the activations of the last three layers of a pretrained ResNet (He et al., 2016) , as later layers of convolutional neural networks are known to encode higher-level visual structure and have been widely used as transferable representations for downstream vision tasks (Razavian et al., 2014; Zeiler and Fergus, 2014). The high activation dimension, denoted as , can increase histogram estimation error when few samples are available. We therefore use an autoencoder trained on each ID dataset to compress the features to dimension ; in our experiments we use .
Algorithm Summary. Our complete algorithm, illustrated in Figure 4, can be summarized as follows. First, we generate M samples from the denoising conditional distribution through posterior sampling using a diffusion model. Second, each of the samples is passed through to extract features, which are then compressed using the trained encoder . Third, the pixel values and the compressed features are concatenated, resulting in
for each pixel . Fourth, the augmented vectors that belong to each superpixel are collected to form and used to construct a histogram , an estimate of the -dimensional distribution . The fourth step is repeated over all superpixels, after which we can compute the anomaly map by computing the typicality of for each superpixel (Equation (5)), and finally apply spatial Gaussian smoothing to refine pixel-level anomaly scores across superpixel boundaries.
5 EVALUATION
Datasets. We evaluate LACToS on three local anomaly detection datasets spanning medical imaging, human faces, and X-ray security screening (Table 4). In each case, the diffusion model in LACToS is trained only on ID images, and all methods are evaluated on a held-out test set. Each test set includes an equal number of ID images and images containing local OOD features.
CHAOS (Kavur et al., 2019) provides abdominal CT scans of healthy patients. We train on 3,070 inlier slices and construct a test set containing 100 healthy test slices and 100 locally anomalous slices acquired by adding synthetic tumor to each. Following common practice in CT image analysis (Wang et al., 2021; Thummerer et al., 2023; Su et al., 2019), we apply the provided body mask at evaluation to exclude background pixels. FFHQ (Karras et al., 2019) is a dataset of high-quality face images, which we treat as the inlier distribution. We train on a random subset of 5,000 images, and manually curate an OOD test set of 50 photographs of movie and television characters with prosthetics or atypical facial features (e.g., scars, metal implants), verified not to overlap with FFHQ. The ID test set contains 50 randomly selected held-out FFHQ images. DVXray (Ma et al., 2024) is a dataset of X-ray luggage scans, with an ID set of weapon-free bags and an OOD set containing weapons. We train on 5,000 inlier images and restrict the OOD test set to the scissors category, where targets are small and spatially confined. For randomly sampled scissor images, we used SAM 3 (Carion et al., 2026) to convert the dataset's bounding-box annotations into segmentation masks, manually discarding images with visibly inaccurate masks for a final OOD test set of 72 images. We construct an ID test set that also contains 72 images, none of which contains a weapon.
Baselines & Models. We compare LACToS against six strong baselines developed for industrial defect detection, spanning representation- and reconstruction-based methods. PatchCore (Roth et al., 2022) builds a coreset-subsampled memory bank of ID patch features from a frozen ImageNet-pretrained backbone and scores test patches by nearest-neighbor distance. SimpleNet (Liu et al., 2023) learns a feature adapter and a discriminator that separates adapted ID features from synthetic anomalies generated by injecting Gaussian noise in feature space. SuperSimpleNet (Rolih et al., 2024) extends SimpleNet with architectural and training improvements for fast, reliable surface defect detection. EfficientAD (Batzner et al., 2024) combines a lightweight student–teacher model with an autoencoder to detect local structural anomalies and violations of global logical constraints through feature discrepancies. GLASS (Chen et al., 2024) trains a discriminator to separate ID
Table 1: Pooled quantitative performance in local anomaly detection. AUROC and AP are computed over all pixels in each dataset jointly. AUPRO is computed over the dataset using per-region overlap for FPR . Higher is better for all metrics. The best result is shown in bold and the second-best is underlined.
| Dataset | Metric | PatchCore | SimpleNet | SuperSimpleNet | EfficientAD | GLASS | DDAD | LACToS (Ours) |
|---|---|---|---|---|---|---|---|---|
| CHAOS | AUROC | 0.9297 | 0.7464 | 0.3786 | 0.6664 | 0.8318 | 0.9707 | 0.9620 |
| AP | 0.0590 | 0.0193 | 0.0051 | 0.0105 | 0.0410 | 0.3159 | 0.4318 | |
| AUPRO | 0.6811 | 0.4191 | 0.0332 | 0.2513 | 0.5530 | 0.8676 | 0.8764 | |
| FFHQ | AUROC | 0.8491 | 0.7162 | 0.7647 | 0.6200 | 0.6707 | 0.7469 | 0.8515 |
| AP | 0.0798 | 0.0537 | 0.0772 | 0.0405 | 0.0345 | 0.0563 | 0.1177 | |
| AUPRO | 0.4094 | 0.3174 | 0.4047 | 0.2365 | 0.2440 | 0.3083 | 0.5320 | |
| DVXray | AUROC | 0.9640 | 0.9234 | 0.8688 | 0.9184 | 0.8944 | 0.8567 | 0.9607 |
| AP | 0.0545 | 0.0254 | 0.0165 | 0.0235 | 0.0155 | 0.0118 | 0.0568 | |
| AUPRO | 0.8141 | 0.6577 | 0.5351 | 0.6592 | 0.6062 | 0.5183 | 0.8179 |

Figure 5: Anomaly heatmaps generated by each method on example images from each test dataset. Rows 1-2 (CHAOS): detect liver tumors in CT scans. Rows 3-4 (FFHQ): detect anomalous facial features. Rows 5-6 (DVXray): detect weapons (scissors) in X-ray baggage scans.
features from synthetic anomalies generated using gradient ascent with truncated projection in feature space and local texture overlays in image space. DDAD (Mousakhan et al., 2024) conditions a denoising diffusion model on the test image to produce an ID reconstruction and scores anomalies by feature-space discrepancy.
LACToS requires an unconditional diffusion model and a posterior sampler. For all benchmarks, we use the guided-diffusion U-Net of Dhariwal and Nichol (2021) with diffusion posterior sampling (DPS) (Chung et al., 2022) at inference time. Full experimental details are provided in Section E and in our code, which will be released upon publication.
Results. Each method produces a heatmap of anomaly scores per test image. Following standard practice, we pool pixel-level anomaly scores across all test images and evaluate three complementary pixel-level detection metrics. AUROC captures the relative ordering of heatmap values against the ground-truth anomaly mask, but can reward low-contrast heatmaps that flag many ID pixels as nearly as anomalous as the true OOD pixels. AP summarizes precision across recall levels, weighting each precision value by the corresponding increase in recall. AUPRO is the normalized area under the per-region overlap curve up to a false positive rate of 0.3, where per-region overlap is the fraction of correctly detected pixels within each connected ground-truth anomalous region, averaged equally across regions. When different anomalies have different sizes, AUPRO weights all anomalies equally rather than overweighting large anomalies.
Table 1 reports these metrics, which indicate that LACToS is competitive with baselines across all tasks, though the best method differs across metrics. The example heatmaps in Figure 5 also suggest that LACToS tends to be more precise: it correctly marks OOD pixels but rarely flags ID pixels, at the cost of occasionally missing part or all of the OOD region. The baselines instead produce blurrier heatmaps that recover the OOD region but also flag many ID pixels.
Ablation Studies. To verify the robustness of LACToS, we conduct ablation studies on several hyper-parameters, which we describe in detail in Section G. These include the number of posterior samples M and the average size of each superpixel. We observe that the performance of LACToS is mostly stable across different settings, demonstrating its robustness to hyperparameter choices. In addition, we perform an ablation on the use of autoencoder-based features, which shows that the features can substantially improve performance compared to typicality based solely on RGB color, though this improvement is dataset-dependent.
6 DISCUSSION
We present LACToS, a framework for general-purpose local anomaly detection. We leverage a pretrained diffusion model to represent the inlier distribution, and combine it with a statistical approach that scores image regions by their typicality (or rather, atypicality) under the conditional distribution induced by their surrounding context. Empirically, LACToS shows strong performance across diverse local OOD detection tasks ranging from medical imaging to security screening.
We note that since LACToS is more robust to inlier multimodality, it is also less likely to flag features from minority inlier modes as anomalous, especially when using a larger M. We demonstrate this behavior through a toy experiment, and refer interested readers to Section C. It is possible that some features annotated as anomalies in the benchmarks we evaluate may be similar to features present with low frequency in the inlier (training) datasets, causing LACToS to classify them as inliers and thus generate false negative predictions according to the dataset anomaly labels. We therefore advise practitioners that, in order to maximize the accuracy of LACToS, it is important to ensure that the training set does not contain the anomalies one desires to detect.
Limitations and future work. Since LACToS targets general-purpose local anomaly detection, specialized approaches can outperform LACToS for specific highly structured datasets, such as those common in industrial defect detection. Please refer to table 7 for evaluation on MVTec AD Bergmann et al. (2019). LACToS inherits the computational cost of diffusion posterior sampling, which is significantly higher per-image than feedforward representation-based methods such as PatchCore. LACToS also relies on Assumption 4.1, which may be violated when superpixels are large or when the anomalous region spans multiple superpixels with heterogeneous pixel statistics. LACToS requires several hyperparameters, such as the noise variance in the denoising posterior sampling, the quantization granularity and smoothing bandwidth in the histogram estimation, the number of posterior samples, the granularity of superpixels, and the spatial smoothing variance of the final heatmap. While we provide ablation studies showing LACToS is fairly robust to these hyperparameters, future work may find mechanisms to remove or automatically set optimal parameter values across tasks. Future work may also replace our histogram estimation with a learned or parametric density model, or extend our LACToS framework to video and 3D data types where spatiotemporal or volumetric superpixels could provide longer sequences for improved typicality estimation.
7 AKNOWLEDGEMENT
This work was supported in part by the HIVES program at Georgia Tech Research Institute (GTRI).
REFERENCES
Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Süsstrunk. Slic superpixels compared to state-of-the-art superpixel methods. IEEE transactions on pattern analysis and machine intelligence, 34(11):2274–2282, 2012.
Brian DO Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 12(3):313–326, 1982.
Brett Barkley, Preston Culbertson, and David Fridovich-Keil. SCOPED: Score-curvature out-of-distribution proximity evaluator for diffusion. International Conference on Learning Representations, 2026.
Kilian Batzner, Lars Heckler, and Rebecca König. Efficientad: Accurate visual anomaly detection at millisecond-level latencies. In 2024 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 127–137. IEEE, 2024.
Paul Bergmann, Michael Fauser, David Sattlegger, and Carsten Steger. Mvtec ad-a comprehensive real-world dataset for unsupervised anomaly detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 9592–9600, 2019.
Nicolas Carion, Laura Gustafson, Yuan-Ting Hu, Shoubhik Debnath, Ronghang Hu, Didac Suris, Chaitanya Ryali, Kalyan Vasudev Alwala, Haitham Khedr, Andrew Huang, Jie Lei, Tengyu Ma, Baishan Guo, Arpit Kalla, Markus Marks, Joseph Greer, Meng Wang, Peize Sun, Roman Rädle, Triantafyllos Afouras, Effrosyni Mavroudi, Katherine Xu, Tsung-Han Wu, Yu Zhou, Liliane Momeni, Rishi Hazra, Shuangrui Ding, Sagar Vaze, Francois Porcher, Feng Li, Siyuan Li, Aishwarya Kamath, Ho Kei Cheng, Piotr Dollár, Nikhila Ravi, Kate Saenko, Pengchuan Zhang, and Christoph Feichtenhofer. Sam 3: Segment anything with concepts, 2026. URL https://arxiv.org/abs/2511.16719.
Kushal Chauhan, Pradeep Shenoy, Manish Gupta, Devarajan Sridharan, et al. Robust outlier detection by de-biasing vae likelihoods. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9881–9890, 2022.
Qiyu Chen, Huiyuan Luo, Chengkan Lv, and Zhengtao Zhang. A unified anomaly synthesis strategy with gradient ascent for industrial anomaly detection and localization. In European Conference on Computer Vision, pages 37–54. Springer, 2024.
Hyungjin Chung, Jeongsol Kim, Michael T Mccann, Marc L Klasky, and Jong Chul Ye. Diffusion posterior sampling for general noisy inverse problems. arXiv preprint arXiv:2209.14687, 2022.
Niv Cohen and Yedid Hoshen. Sub-image anomaly detection with deep pyramid correspondences. arXiv preprint arXiv:2005.02357, 2020.
Thomas M Cover, Joy A Thomas, and John Kieffer. Elements of information theory, volume 2. wiley New York, 1991.
Thomas Defard, Aleksandr Setkov, Angelique Loesch, and Romaric Audigier. Padim: a patch distribution modeling framework for anomaly detection and localization. In International conference on pattern recognition, pages 475–489. Springer, 2021.
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780–8794, 2021.
Mark S Graham, Walter HL Pinaya, Petru-Daniel Tudosiu, Parashkev Nachev, Sebastien Ourselin, and Jorge Cardoso. Denoising diffusion models for out-of-distribution detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 2948–2957, 2023.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840–6851, 2020.
Aapo Hyvärinen and Peter Dayan. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 6(4), 2005.
Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 4401–4410, 2019.
Ali Emre Kavur, M. Alper Selver, Oğuz Dicle, Mustafa Barış, and N. Sinem Gezer. CHAOS - Combined (CT-MR) Healthy Abdominal Organ Segmentation Challenge Data, April 2019. URL https://doi.org/10.5281/zenodo.3362844.
Bahjat Kawar, Michael Elad, Stefano Ermon, and Jiaming Song. Denoising diffusion restoration models. Advances in neural information processing systems, 35:23593–23606, 2022.
Zhengqin Li and Jiansheng Chen. Superpixel segmentation using linear spectral clustering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1356–1363, 2015.
Yaron Lipman, Ricky TQ Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. Flow matching for generative modeling. arXiv preprint arXiv:2210.02747, 2022.
Ming-Yu Liu, Oncel Tuzel, Srikumar Ramalingam, and Rama Chellappa. Entropy rate superpixel segmentation. In CVPR 2011, pages 2097–2104. IEEE, 2011.
Zhikang Liu, Yiming Zhou, Yuansheng Xu, and Zilei Wang. Simplenet: A simple network for image anomaly detection and localization. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 20402–20411, 2023.
Bowen Ma, Tong Jia, Mingyuan Li, Songsheng Wu, Hao Wang, and Dongyue Chen. Toward dual-view x-ray baggage inspection: A large-scale benchmark and adaptive hierarchical cross refinement for prohibited item discovery. IEEE Transactions on Information Forensics and Security, 19:3866–3878, 2024. doi:10.1109/TIFS.2024.3372797.
Fernand Meyer and Serge Beucher. Morphological segmentation. Journal of visual communication and image representation, 1(1):21–46, 1990.
Arian Mousakhan, Thomas Brox, and Jawad Tayyub. Anomaly detection with conditioned denoising diffusion models. In DAGM German Conference on Pattern Recognition, pages 181–195. Springer, 2024.
Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, and Balaji Lakshminarayanan. Detecting out-of-distribution inputs to deep generative models using typicality. arXiv preprint arXiv:1906.02994, 2019.
Genki Osada, Tsubasa Takahashi, Budrul Ahsan, and Takashi Nishide. Out-of-distribution detection with reconstruction error and typicality-based penalty. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 5551–5563, 2023.
Jonathan Pirnay and Keng Chai. Inpainting transformer for anomaly detection. In International conference on image analysis and processing, pages 394–406. Springer, 2022.
Ali Sharif Razavian, Hossein Azizpour, Josephine Sullivan, and Stefan Carlsson. CNN features off-the-shelf: An astounding baseline for recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pages 806–813, 2014.
Ren and Malik. Learning a classification model for segmentation. In Proceedings ninth IEEE international conference on computer vision, pages 10–17. IEEE, 2003.
Blaž Rolih, Matic Fučka, and Danijel Skočaj. Supersimplenet: Unifying unsupervised and supervised learning for fast and reliable surface defect detection. In International Conference on Pattern Recognition, pages 47–65. Springer, 2024.
Karsten Roth, Latha Pemula, Joaquin Zepeda, Bernhard Schölkopf, Thomas Brox, and Peter Gehler. Towards total recall in industrial anomaly detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 14318–14328, 2022.
Cheng Shen and Yuewei Liu. Conformal segmentation in industrial surface defect detection with statistical guarantees. Mathematics, 13(15):2430, 2025.
Shirin Shoushtari, Yi Wang, Xiao Shi, M Salman Asif, and Ulugbek S Kamilov. Eigenscore: Ood detection using covariance in diffusion models. arXiv preprint arXiv:2510.07206, 2025.
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020.
Yang Song, Liyue Shen, Lei Xing, and Stefano Ermon. Solving inverse problems in medical imaging with score-based generative models. arXiv preprint arXiv:2111.08005, 2021.
David Stutz, Alexander Hermans, and Bastian Leibe. Superpixels: An evaluation of the state-of-the-art. Computer Vision and Image Understanding, 166:1–27, 2018.
Kuan-Hao Su, Harry T Friel, Jung-Wen Kuo, Rose Al Helo, Atallah Baydoun, Christian Stehning, Adina N Crisan, Melanie S Traughber, Ajit Devaraj, David W Jordan, et al. Ute-mdixon-based thorax synthetic ct generation. Medical physics, 46(8):3520–3531, 2019.
Adrian Thummerer, Erik Van der Bijl, Arthur Galapon Jr, Joost JC Verhoeff, Johannes A Langendijk, Stefan Both, Cornelis (Nico) AT van den Berg, and Matteo Maspero. Synthrad2023 grand challenge dataset: Generating synthetic ct for radiotherapy. Medical physics, 50(7):4664–4674, 2023.
Michael Van den Bergh, Xavier Boix, Gemma Roig, Benjamin De Capitani, and Luc Van Gool. Seeds: Superpixels extracted via energy-driven sampling. In European conference on computer vision, pages 13–26. Springer, 2012.
Tonghe Wang, Yang Lei, Yabo Fu, Jacob F Wynne, Walter J Curran, Tian Liu, and Xiaofeng Yang. A review on medical imaging synthesis using deep learning and its clinical applications. Journal of applied clinical medical physics, 22(1):11–36, 2021.
Yinhuai Wang, Jiwen Yu, and Jian Zhang. Zero-shot image restoration using denoising diffusion null-space model. arXiv preprint arXiv:2212.00490, 2022.
Zhou Wang, Alan C Bovik, Hamid R Sheikh, and Eero P Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4):600–612, 2004.
Di Wu, Shicai Fan, Xue Zhou, Li Yu, Yuzhong Deng, Jianxiao Zou, and Baihong Lin. Unsupervised anomaly detection via masked diffusion posterior sampling. arXiv preprint arXiv:2404.17900, 2024.
Julian Wyatt, Adam Leach, Sebastian M Schmon, and Chris G Willcocks. Anoddpm: Anomaly detection with denoising diffusion probabilistic models using simplex noise. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 650–656, 2022.
Vitjan Zavrtanik, Matej Kristan, and Danijel Skočaj. Reconstruction by inpainting for visual anomaly detection. Pattern Recognition, 112:107706, 2021.
Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In European conference on computer vision, pages 818–833. Springer, 2014.
Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 586–595, 2018.
Yang Zou, Jongheon Jeong, Latha Pemula, Dongqing Zhang, and Onkar Dabeer. Spot-the-difference self-supervised pre-training for anomaly detection and segmentation. In European conference on computer vision, pages 392–408. Springer, 2022.
A BACKGROUND
A.1 DIFFUSION MODELS
Diffusion models are generative models that have gained enormous popularity for their high sample quality Ho et al. (2020); Dhariwal and Nichol (2021). To sample from a desired data distribution p, these models first define a noising process (also called the forward process) as a stochastic differential equation (SDE) (Song et al., 2020) of the form
where is a standard Wiener process (Brownian motion) and , are the drift and diffusion coefficients, respectively, which are determined by a chosen noise schedule. If we denote the marginal distribution of at time as , this process transforms clean data samples across time until the distribution becomes pure noise at , i.e. . Once the forward process is defined, there exists, under regularity conditions, a corresponding backward SDE with drift and diffusion (Anderson, 1982; Song et al., 2020):
where is also a Wiener process but with indexed backwards. This backward SDE shares the same marginal distributions as the marginal distributions induced by the forward process for all . Since the drift coefficient of the backward SDE has the form
a diffusion model is optimized on either a score-matching loss to predict Hyvärinen and Dayan (2005); Song et al. (2020) or on a flow-matching loss to predict directly Lipman et al. (2022), and used to iteratively sample from through discretization of the backward SDE.
A.2 POSTERIOR SAMPLING USING DIFFUSION MODELS
To condition generation on inference-time measurements using a pretrained diffusion model, prior works modify the reverse sampling process to approximately sample from the posterior distribution capturing simultaneous consistency with the prior encoded by the diffusion model and the likelihood induced by the measurement model Song et al. (2021); Kawar et al. (2022); Chung et al. (2022); Wang et al. (2022).
These methods decompose the conditional score using Bayes' rule as
where is the unconditional score, which is provided by the pretrained diffusion model, and is the likelihood score, which is typically approximated to promote consistency with while maintaining computational tractability. These works have shown strong empirical performance on various imaging inverse problems such as inpainting, denoising, deblurring, super-resolution, and tomography; in all of these tasks the condition is given in the form of measurements for linear or non-linear observation model and noise .
B TOY EXPERIMENT 1
Here we provide further details and results for the toy experiment conducted in Section 3. For each level of inlier complexity, we train a dedicated diffusion model on a set of inlier images that always contain a circle at the upper-right corner. The other 3 corners of the inlier images contain a shape randomly selected from the set of candidate shapes, with probabilities defined in Table 2. As the level increases, more shapes are equally probable at these three corners, thereby isolating the effect of increasing local multimodality in the inlier distribution. Some example images in each training set are shown in Figure 6.
Table 2: Toy Experiment 1 Inlier Distribution Specification.
| Level | Set of Candidate Shapes | Probability |
|---|---|---|
| Level 1 | {Circle, Square} | [0.5, 0.5] |
| Level 2 | {Circle, Square, Triangle} | [0.3, 0.3, 0.3] |
| Level 3 | {Circle, Square, Triangle, Ellipse} | [0.25, 0.25, 0.25, 0.25] |
| Level 4 | {Circle, Square, Triangle, Ellipse, Star} | [0.2, 0.2, 0.2, 0.2, 0.2] |
Example Images from Training Set

Figure 6: Example Images from Training Sets. The shape orientations are random, with positions sampled with jitter around fixed anchors in each quadrant. The upper-right corner, marked with a red box, always contains a circle. With increasing level, each of the other three corners has increasing modality, as more shapes are equally probable under the inlier distribution.

Inlier Complexity
Figure 7: LACToS Toy Experiment 1: Robustness Under Multimodality. Average per-image False Positive Rates at True Positive Rate , evaluated on images that contain squares on the upper-right corner.
Using these diffusion models, we evaluate how the multimodality of the inlier distribution affects the performance of different local anomaly detection methods. We generate 50 test images that contain a square on the upper-right corner, and place other inlier shapes at the other corners. We label the pixels in the square as positive (anomalous), and all others as negative (non-anomalous). For DDAD Mousakhan et al. (2024), each test image is noised then denoised, which is used in conjunction with ResNet embeddings of the image to construct the anomaly heatmap. We also evaluate a variant of DDAD that uses more samples by repeating the noising-then-denoising process 20 times with different random seeds, averaging the denoised samples, and using the resulting average to construct the anomaly heatmap. For PatchCore Roth et al. (2022), a feed-forward model is trained for each inlier distribution, and a heatmap is generated by evaluating the test image with the feed-forward model. Finally, for LACToS, we follow the process described in Section 4, while varying the sample count from 1 to 20. Since the images are grayscale, we use the same set of parameters as for CHAOS, the dataset containing abdominal CT scans which are also in grayscale, for all methods.
To effectively isolate how likely different methods are to erroneously predict inlier shapes as anomalous, we report per-image averaged false-positive rate (FPR) at fixed values of per-image true-positive rate (TPR) . Figure 7 shows that the FPR of DDAD (Mousakhan et al., 2024) and PatchCore (Roth et al., 2022) increases with inlier multimodality, whereas the FPR of LACToS decreases rapidly with sample size, and stays negligible compared to the baseline methods when 20 samples are used, even when the inlier distribution is increasingly multimodal. This demonstrates that LACToS is more robust to inlier multimodality.
C TOY EXPERIMENT 2
We conduct a second toy experiment to better understand how LACToS and baseline methods treat ID but under-represented features, compared to dominant ID features and strictly OOD features. We hypothesize that, due to the distribution-aware nature of statistical typicality, LACToS considers these minority ID features to be closer to majority ID features, whereas baseline methods that use a first-order statistic may consider them to be closer to OOD. To demonstrate this concretely, we train 5 diffusion models on training distributions whose specifications are provided in Table 3.
Table 3: Toy Experiment 2 Inlier Distribution Specification.
| Level | Set of Candidate Shapes | Probability |
|---|---|---|
| Level 1 | {Circle, Square} | {0.5, 0.5} |
| Level 2 | {Circle, Square} | {0.6, 0.4} |
| Level 3 | {Circle, Square} | {0.7, 0.3} |
| Level 4 | {Circle, Square} | {0.8, 0.2} |
| Level 5 | {Circle, Square} | {0.9, 0.1} |
Similar to the toy experiment in Section B, the upper-right corner still only admits a circle under the inlier distribution, so a square there is a strict OOD feature. On the other hand, the inlier probability of a square being placed in the other 3 corners is progressively lowered from 0.5 to 0.1. Example images in each training set are shown in Figure 8.
To verify the hypothesis, we measure two quantities. First, we measure the AUROC over pixels that belong to ID squares and circles, where squares are labeled positive and circles are labeled negative. A higher AUROC here means the method treats ID, but potentially under-represented, squares differently from ID circles, and vice versa. Second, we measure the AUROC over pixels that belong to squares, where OOD squares (those at the upper-right corner) are labeled positive and ID squares (those at other corners) are labeled negative. Higher AUROC here means that the method treats the under-represented ID squares differently from truly OOD squares, and vice versa. In Figure 9, we observe that LACToS is less likely to distinguish ID squares from ID circles and more likely to distinguish under-represented ID squares from truly OOD squares compared to DDAD. Both trends become more apparent with increasing number of sampled reconstructions. Together, these results verify our hypothesis, and inform practitioners that LACToS is a more reliable choice when one wishes to detect features that are not included in the training set without falsely flagging uncommon inlier features.
Example Images from Training Set
Level 1
Level 2
Level 3
Level 4
Level 5

Figure 8: Example Images from Training Sets. Positions of the shapes are sampled with jitter around fixed anchors, with random orientations. The upper-right corner, marked with a red box, always contains a circle. With increasing level, the probability of a square at the other three corners decreases, making it more difficult to distinguish squares there from the square in the upper-right corner.
DDAD 1 sample LACToS 1 sample LACToS 5 samples LACToS 20 samples DDAD 20 sample mean LACToS 2 samples LACToS 10 samples LACToS 40 samples
Inlier Square vs. Inlier Circle

Inlier vs. Outlier Square
Figure 9: LACToS Toy Experiment 2. AUROCs across different inlier square probabilities, over methods and different sample sizes. (Left) AUROC is computed over pixels that belong to inlier squares and circles, with those pixels from squares labeled positive, and negative otherwise. Higher AUROC means the method is more likely to distinguish an inlier square (minority) from inlier circles (majority). (Right) AUROC is computed over pixels that belong to squares, with those pixels from the square in the upper-right corner (truly OOD) labeled positive, and negative otherwise (minority inlier). Higher AUROC means the method better distinguishes an inlier but uncommon square from a strictly out-of-distribution square.
D THEORY
Here we provide a formal version of Theorem 4.1. Fix a test image and a superpixel . Let , where denotes the set of possible 8-bit values for one color channel. Thus, is the single-pixel state space, under the finite quantized histogram setting. We consider features as an empirical extension, and do not include them in the discussion here. Under Assumption 4.1, the ideal inpainting posterior induces the single-pixel distribution
For , write . For a realization of , let denote the noised version of used to sample , and define the pooled single-pixel denoising marginal for superpixel as
The denoising surrogate distribution used by the score is then
The corresponding ideal and denoising scores are
For a realization of y, define the auxiliary distribution
This is the ideal inpainting conditional after additionally revealing the noisy superpixel values, pooled over pixels in . It is used only to separate the two sources of error: loss of context from observing the noised version of instead of , and the leakage of information about from observing a noisy instead of completely masked superpixel. We will refer to the former as context gap, and the latter as self-leakage.
The following assumption formalizes the bias–variance-like tradeoff induced by using denoising instead of inpainting. A denoising conditional observes a noisy version of the entire image, whereas the ideal inpainting conditional observes the clean complement and does not observe . As increases, the noisy observation outside becomes a worse proxy for the clean outside context and widens that context gap, which we capture as a linear function of in the form of . In the opposite direction, when is too small, the noisy values inside reveal too much about , allowing the denoising posterior to copy the held-out region rather than predict it from context; this self-leakage is represented by the term.
Assumption D.1. [Denoising–inpainting tradeoff] There exist constants and such that, for every ,
We add another assumption, which is a mild regularity condition ensuring that small distributional errors translate into small score errors. Since the score contains both a log-likelihood term and an entropy term, probabilities near zero can make the functional unstable. The lower bound by rules out this degenerate case on the finite single-pixel state space. In practice, the computed histogram-based scores can enforce such a floor by smoothing or clipping the estimated probabilities.
Assumption D.2 (Score regularity). There exists such that, for every ,
We now state the formal version of Theorem 4.1.
Theorem D.1 (Formal denoising score approximation). Under Assumptions D.1 and D.2, for every ,
where
Equivalently, after absorbing into the constants, there exist positive constants and such that
Proof. First, we begin by inspecting the error of the anomaly scores. For any two distributions satisfying for every ,
(23)
by applying reverse triangle inequality, and then triangle inequality. Since has derivative bounded in absolute value by on ,
Similarly, for , the derivative satisfies
Applying the mean-value theorem coordinate-wise gives
Combining (23)–(26),
It remains to control . By the definition of and convexity of the norm,
(28)
For each realization of , insert and apply the triangle inequality:
Taking expectations and using Assumption D.1 yields
Finally, apply (27) with and . This proves (20). The absorbed-constant form (22) follows by setting and .
Corollary D.1 (Bound-optimal denoising noise). Under the conditions of Theorem D.1, the upper bound in (20) is minimized over by
In particular, if
then the bound is minimized at the interior value
and the minimum value of the right-hand side of (20) is
Proof. The multiplicative factor in (20) is positive and therefore does not affect the choice of . It is enough to minimize
The derivative is
which vanishes exactly when
The second derivative is
so this critical point is the unique unconstrained minimizer. Restricting to gives (31). When the unconstrained minimizer lies inside the interval, substituting (33) into gives (34).
This corollary should be interpreted as selecting the bound-optimal noise level rather than the necessarily optimal empirical denoising noise. The expression balances the two errors in Assumption D.1: increasing worsens the context gap, while decreasing worsens self-leakage. At an interior optimum, these two effects satisfy .
We now analyze the typicality score without Assumption 4.1. The signed statistic remains centered under the ID model, while dependence affects its concentration through the covariance of the per-pixel information values.
Fix and , and write . Since the single-pixel marginals may now differ, replace by their pooled marginal
This reduces to under Assumption 4.1. Retaining the probability floor of Assumption D.2 for , define
(40)
Here is the per-pixel counterpart of the score in (14), using the pooled marginal.
By the definition of , the expected average information is , and hence . Dependence enters through the total variance
(41)
Since , Chebyshev's inequality gives
To express this in terms of effective sample size, let
The bound becomes . Under Assumption 4.1, the cross-covariances vanish and ; a positive sum of cross-covariances reduces the effective sample size and weakens concentration.
The same variance dependence appears in OOD detection. For an OOD conditional distribution , let and . If , then . Chebyshev's inequality therefore yields
Finally, let be the score in (15) divided by , with its denoising marginal evaluated at the image being scored. If Assumptions D.1 and D.2 hold uniformly over the considered superpixel realizations, with common constants and replacing , the proof of Theorem D.1 gives
Applying (42) and (44) at the resulting shifted thresholds gives
Under Assumption 4.1, the effective sample size equals the number of pixels in the superpixel. Without this assumption, the signed statistic remains centered under the ID model, but positive within-superpixel covariance reduces the effective sample size and weakens the concentration and detection bounds. The denoising approximation retains the same form, with the effect of dependence captured by the variance terms.
E EXPERIMENTAL DETAILS
E.1 DATASET SUMMARY
Table 4 summarizes the train/test composition, masking, and image resolution for each dataset. MVTec AD and CHAOS are evaluated at following standard practice; FFHQ is ; DVXray is in its native form, and we report per-pixel mean metrics so resolution does not bias cross-dataset comparison.
Table 4: Dataset composition. Training images contain only inlier (anomaly-free) examples. Test images contain local anomalies and are paired with pixel-level ground-truth masks.
| Dataset | # train (inlier) | # test (ID + OOD) | Eval mask | Resolution |
|---|---|---|---|---|
| CHAOS | 3,070 | 100 + 100 | body silhouette | 256×256 |
| FFHQ | 5,000 | 50 + 50 | — | 256×256 |
| DVXray (scissors) | 5,000 | 72 + 72 | — | 600×800 |
| MVTec AD (15 categories) | 3,629 | 1,258 | — | 256×256 |
E.2 DIFFUSION MODELS AND RECONSTRUCTION
For MVTec AD, we use DDAD's checkpoints, which are -prediction UNet diffusion models, trained separately for each category. For all other benchmarks, we use the guided-diffusion UNet of Dhariwal and Nichol (Dhariwal and Nichol, 2021) trained from scratch on each inlier set, and produce reconstructions via DPS (Chung et al., 2022).
E.3 LACTOS HYPERPARAMETERS
For sample reconstruction using DPS (Chung et al., 2022), we utilize the identity forward model and zero-mean Gaussian noise with variance . DPS also has a scale parameter that controls the posterior guidance strength.
Once reconstructions are computed and the corresponding features are acquired, we rescale RGB values from [0, 255] and autoencoder outputs from [0, 1] to a common [0, 255] range. Then, we partition the reconstructions and feature maps into superpixels containing an average of pixels each, using marker-controlled watershed segmentation (Meyer and Beucher, 1990). For each superpixel, we quantize the rescaled values into and bins per dimension, for RGB values and autoencoder outputs respectively. While it is ideal to construct -dimensional histograms, the number of histogram bins grows exponentially with the dimension. Therefore, we construct two empirical histograms per superpixel, one over RGB values and one over feature values. We smooth each histogram with a Gaussian kernel of to mitigate empty bins under limited samples, and use the histograms to compute the RGB and feature typicality scores for each superpixel. The two scores are summed with a weight parameter multiplied to the feature typicality to balance the trade-off between the two scores. Finally, we smooth the anomaly map that contains the same value over all pixels in each superpixel to acquire the pixel-level anomaly map. All parameters are selected by performing a grid search over a small subset containing 20 test images, and the configuration with the highest AUROC is used to evaluate over the full test set. The specific parameters used for each benchmark can be found in Table 5.
Table 5: Dataset-specific hyperparameters used for LACToS.
| Parameter | CHAOS | FFHQ | DVXray |
|---|---|---|---|
| DPS | 0.1 | 0.01 | 2.0 |
| DPS scale | 0.4 | 0.1 | 1.0 |
| 100 | 20 | 10 | |
| M | 5 | 20 | 20 |
| 0.5 | 1.0 | 0 | |
| (16, 64) | (16, 32) | (16, 16) | |
| 1.0 | 0.25 | 0 |
E.4 BASELINES
For baselines, we use the official implementations of PatchCore, SimpleNet, SuperSimpleNet, EfficientAD, GLASS, and DDAD, with each method's default backbone: WideResNet-50 for PatchCore; ImageNet-pretrained ResNet/WideResNet for the SimpleNet variants.
For fair comparison, we perform parameter tuning for each baseline method using the same set of 20 test images. Note that we do not tune the parameters of SimpleNet, SuperSimpleNet, and GLASS as this would require retraining; we use the default parameters in the respective manuscripts or github repositories. For PatchCore, , the number of nearest neighbors in the coreset to compare each test patch, is swept across . For EfficientAD, , which balances the strengths of the student-teacher detector and the autoencoder detector, is swept across . For DDAD, a 2D grid of is searched, where controls the guidance strength during denoising and balances the strengths of pixels and extracted features. The selected parameter values are described in Table 6.
Table 6: Dataset-specific hyperparameters used for baseline methods.
| Parameter | CHAOS | FFHQ | DVXray |
|---|---|---|---|
| PatchCore | |||
| EfficientAD | |||
| DDAD |
E.5 FEATURE EXTRACTOR AND AUTOENCODER
The feature extractor is an ImageNet-pretrained ResNet-101 He et al. (2016), frozen at all stages. We extract activations from the last three residual stages, upsample them to the input resolution, and concatenate them. To reduce histogram error under limited samples, these features are compressed to dimensions by a per-pixel autoencoder trained on each inlier dataset.
F ADDITIONAL RESULTS
We provide additional visualizations of each benchmark in Figure 10, Figure 11, and Figure 12.
Image
LACToS
DDAD
PatchCore
SimpleNet
Super
SimpleNet
EfficientAD
GLASS

Figure 10: CHAOS Additional Visualizations. 10 randomly selected test images and the heatmaps for each method.
Image
LACToS
DDAD
PatchCore
SimpleNet
Super
SimpleNet
EfficientAD
GLASS

Figure 11: FFHQ Additional Visualizations. 10 randomly selected test images and the heatmaps for each method.
Image
LACToS
DDAD
PatchCore
SimpleNet
Super
SimpleNet
EfficientAD
GLASS

Figure 12: DVXray Additional Visualizations. 10 randomly selected test images and the heatmaps for each method.
In Table 7, we report the AUROC, AP, and AUPRO of all methods for each of the object category in the MVTec dataset.
Table 7: Results on MVTec AD. We report pixel-level AUROC, AP, and AUPRO for each object or texture category. AUROC and AP pool every pixel of all test images of the category (anomalous and anomaly-free); AUPRO is the region-based per-region overlap integrated up to an FPR of 0.3. Each method occupies three rows, one per metric. Higher is better for all metrics.
| Method | Metric | Carpet | Grid | Leather | Tile | Wood | Bottle | Cable | Capsule |
|---|---|---|---|---|---|---|---|---|---|
| SimpleNet | AUROC | 0.9765 | 0.9656 | 0.9898 | 0.9326 | 0.9177 | 0.9775 | 0.9688 | 0.9862 |
| AP | 0.3650 | 0.2440 | 0.3257 | 0.5470 | 0.3673 | 0.6315 | 0.6151 | 0.3729 | |
| AUPRO | 0.9047 | 0.8757 | 0.9630 | 0.7781 | 0.7866 | 0.8945 | 0.8741 | 0.9093 | |
| SuperSimpleNet | AUROC | 0.9832 | 0.9771 | 0.9878 | 0.9383 | 0.9208 | 0.9779 | 0.9728 | 0.9805 |
| AP | 0.4548 | 0.2383 | 0.3492 | 0.5109 | 0.3867 | 0.6202 | 0.6151 | 0.3973 | |
| AUPRO | 0.9222 | 0.9236 | 0.9686 | 0.8107 | 0.8551 | 0.8982 | 0.8746 | 0.8753 | |
| PatchCore | AUROC | 0.9877 | 0.9729 | 0.9903 | 0.9496 | 0.9301 | 0.9813 | 0.9831 | 0.9873 |
| AP | 0.5770 | 0.2326 | 0.3533 | 0.4947 | 0.4016 | 0.6842 | 0.6258 | 0.3935 | |
| AUPRO | 0.9295 | 0.8932 | 0.9574 | 0.8212 | 0.8312 | 0.9253 | 0.9153 | 0.9227 | |
| DDAD | AUROC | 0.9822 | 0.9795 | 0.9878 | 0.9790 | 0.9374 | 0.9860 | 0.9784 | 0.8693 |
| AP | 0.6422 | 0.2710 | 0.4124 | 0.7853 | 0.5285 | 0.8047 | 0.6641 | 0.2313 | |
| AUPRO | 0.8994 | 0.9291 | 0.9811 | 0.9117 | 0.8604 | 0.9003 | 0.8835 | 0.6845 | |
| EfficientAD | AUROC | 0.9831 | 0.9833 | 0.9916 | 0.9816 | 0.9680 | 0.9884 | 0.9863 | 0.9915 |
| AP | 0.7511 | 0.4328 | 0.5421 | 0.7505 | 0.6273 | 0.7852 | 0.7593 | 0.4603 | |
| AUPRO | 0.9489 | 0.9144 | 0.9840 | 0.9249 | 0.9207 | 0.9550 | 0.9009 | 0.9445 | |
| GLASS | AUROC | 0.9952 | 0.9908 | 0.9952 | 0.9963 | 0.9761 | 0.9922 | 0.9569 | 0.9898 |
| AP | 0.8108 | 0.4528 | 0.5518 | 0.9640 | 0.7196 | 0.8966 | 0.4997 | 0.4798 | |
| AUPRO | 0.9832 | 0.9606 | 0.9815 | 0.9770 | 0.9467 | 0.9652 | 0.8470 | 0.9460 | |
| LACToS (Ours) | AUROC | 0.9822 | 0.9712 | 0.9935 | 0.9307 | 0.9099 | 0.9839 | 0.9739 | 0.9703 |
| AP | 0.4489 | 0.3813 | 0.6339 | 0.7085 | 0.4139 | 0.8151 | 0.5891 | 0.4118 | |
| AUPRO | 0.9209 | 0.8934 | 0.9540 | 0.8165 | 0.6801 | 0.8877 | 0.8712 | 0.8757 | |
| Method | Metric | Hazelnut | Metal Nut | Pill | Screw | Toothbrush | Transistor | Zipper | Average |
| SimpleNet | AUROC | 0.9741 | 0.9747 | 0.9839 | 0.9887 | 0.9823 | 0.9746 | 0.9790 | 0.9715 |
| AP | 0.3978 | 0.8049 | 0.7402 | 0.2325 | 0.3377 | 0.6181 | 0.4712 | 0.4714 | |
| AUPRO | 0.9297 | 0.8082 | 0.9009 | 0.9464 | 0.8404 | 0.9354 | 0.9091 | 0.8837 | |
| SuperSimpleNet | AUROC | 0.9792 | 0.9855 | 0.9841 | 0.9873 | 0.9851 | 0.9618 | 0.9813 | 0.9735 |
| AP | 0.5013 | 0.8630 | 0.7763 | 0.2242 | 0.4923 | 0.6081 | 0.4395 | 0.4985 | |
| AUPRO | 0.9447 | 0.9004 | 0.9326 | 0.9434 | 0.8473 | 0.9130 | 0.9304 | 0.9027 | |
| PatchCore | AUROC | 0.9851 | 0.9659 | 0.9895 | 0.9908 | 0.9827 | 0.9742 | 0.9813 | 0.9768 |
| AP | 0.5019 | 0.7060 | 0.7824 | 0.2585 | 0.3272 | 0.6312 | 0.4444 | 0.4943 | |
| AUPRO | 0.9559 | 0.8557 | 0.9517 | 0.9572 | 0.8613 | 0.9431 | 0.9244 | 0.9097 | |
| DDAD | AUROC | 0.9832 | 0.9840 | 0.9461 | 0.8490 | 0.9729 | 0.9436 | 0.9751 | 0.9569 |
| AP | 0.5405 | 0.8580 | 0.6220 | 0.0202 | 0.5126 | 0.6341 | 0.5388 | 0.5377 | |
| AUPRO | 0.9279 | 0.9072 | 0.5272 | 0.5060 | 0.6514 | 0.9233 | 0.9056 | 0.8266 | |
| EfficientAD | AUROC | 0.9856 | 0.9847 | 0.9885 | 0.9945 | 0.9882 | 0.9775 | 0.9892 | 0.9855 |
| AP | 0.5492 | 0.8220 | 0.7474 | 0.4125 | 0.5202 | 0.8170 | 0.5594 | 0.6358 | |
| AUPRO | 0.9457 | 0.9337 | 0.9606 | 0.9692 | 0.9315 | 0.9455 | 0.9615 | 0.9427 | |
| GLASS | AUROC | 0.9863 | 0.8987 | 0.9727 | 0.9315 | 0.9629 | 0.5712 | 0.9948 | 0.9474 |
| AP | 0.6267 | 0.5778 | 0.8330 | 0.2391 | 0.2321 | 0.1719 | 0.7725 | 0.5886 | |
| AUPRO | 0.9733 | 0.9004 | 0.8555 | 0.7053 | 0.7514 | 0.3643 | 0.9822 | 0.8760 | |
| LACToS (Ours) | AUROC | 0.9892 | 0.9871 | 0.9777 | 0.9916 | 0.9871 | 0.9851 | 0.9535 | 0.9725 |
| AP | 0.8157 | 0.9177 | 0.7423 | 0.4611 | 0.6775 | 0.8292 | 0.2678 | 0.6076 | |
| AUPRO | 0.9190 | 0.8397 | 0.9110 | 0.9663 | 0.8534 | 0.8612 | 0.8247 | 0.8717 |
G ABLATION STUDIES
In this section, we ablate our method on the different choices of hyper-parameters.
Sample efficiency. Table 8 reports the AUROC, AP, and AUPRO of diffusion-based methods DDAD (Mousakhan et al., 2024) and LACToS as the number of denoising samples varies from 1 to 20. LACToS exhibits improved performance with increasing on CHAOS and DVXray compared to DDAD, which relies on point estimates of reconstruction errors. This is consistent with the statistical properties of typicality: more samples yield better estimations of , which improves the reliability of the entropy and log likelihood estimates. At , LACToS degenerates toward a reconstruction-error-like score.
Superpixel size. Table 9 shows the effect of the number of superpixels' average size in the performance of LACToS, which is mostly stable but with different trends across benchmarks.
AutoEncoder features. The sensitivity of the metrics under varying is illustrated in Table 10. corresponds to using RGB typicality only. In most datasets, including feature typicality significantly improves performance.
Table 8: Ablation on sample size in diffusion-based methods. AUROC, AP, and AUPRO are reported for each dataset.
| Dataset | Metric | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| DDAD | LACToS | DDAD | LACToS | DDAD | LACToS | DDAD | LACToS | ||
| CHAOS | AUROC | 0.9707 | 0.9552 | 0.9748 | 0.9620 | 0.9749 | 0.9615 | 0.9745 | 0.9620 |
| AP | 0.3159 | 0.2536 | 0.3496 | 0.4318 | 0.3468 | 0.4236 | 0.3489 | 0.4338 | |
| AUPRO | 0.8676 | 0.8524 | 0.8827 | 0.8764 | 0.8825 | 0.8713 | 0.8814 | 0.8729 | |
| FFHQ | AUROC | 0.7469 | 0.8446 | 0.7512 | 0.8521 | 0.7559 | 0.8503 | 0.7583 | 0.8515 |
| AP | 0.0563 | 0.0937 | 0.0543 | 0.1197 | 0.0552 | 0.1119 | 0.0564 | 0.1177 | |
| AUPRO | 0.3083 | 0.4638 | 0.3065 | 0.5157 | 0.3202 | 0.5239 | 0.3151 | 0.5320 | |
| DVXray | AUROC | 0.8567 | 0.9347 | 0.8518 | 0.9541 | 0.8523 | 0.9585 | 0.8495 | 0.9607 |
| AP | 0.0118 | 0.0248 | 0.0119 | 0.0465 | 0.0119 | 0.0530 | 0.0118 | 0.0568 | |
| AUPRO | 0.5183 | 0.7385 | 0.4896 | 0.7964 | 0.4880 | 0.8055 | 0.4890 | 0.8179 | |
Table 9: Ablation on the average size of superpixels. The larger the average size, the smaller the total number of superpixels. AUROC, AP, and AUPRO on CHAOS, FFHQ, and DVXray.
| Dataset | Metric | Average size of superpixels | 200 | |||||
|---|---|---|---|---|---|---|---|---|
| 10 | 20 | 30 | 50 | 70 | 100 | |||
| CHAOS | AUROC | 0.9418 | 0.9504 | 0.9535 | 0.9578 | 0.9595 | 0.9620 | 0.9593 |
| AP | 0.1271 | 0.1599 | 0.1857 | 0.2434 | 0.2643 | 0.4318 | 0.3677 | |
| AUPRO | 0.7992 | 0.8274 | 0.8385 | 0.8499 | 0.8571 | 0.8764 | 0.8600 | |
| FFHQ | AUROC | 0.7930 | 0.8515 | 0.8502 | 0.8480 | 0.8462 | 0.8438 | 0.8383 |
| AP | 0.0774 | 0.1177 | 0.1145 | 0.1107 | 0.1095 | 0.1065 | 0.0998 | |
| AUPRO | 0.3890 | 0.5320 | 0.5263 | 0.5180 | 0.5101 | 0.5068 | 0.4863 | |
| DVXray | AUROC | 0.9607 | 0.9611 | 0.9593 | 0.9501 | 0.9468 | 0.9463 | 0.9330 |
| AP | 0.0568 | 0.0570 | 0.0537 | 0.0495 | 0.0458 | 0.0418 | 0.0342 | |
| AUPRO | 0.8179 | 0.8122 | 0.8125 | 0.8040 | 0.7872 | 0.7817 | 0.7466 | |
Table 10: Ablation on the feature-weighting parameter . corresponds to using RGB features only. AUROC, AP, and AUPRO are reported on CHAOS, FFHQ, and DVXray.
| Dataset | Metric | Feature only | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| CHAOS | AUROC | 0.8418 | 0.9638 | 0.9632 | 0.9625 | 0.9620 | 0.9613 | 0.9609 | 0.9601 | 0.9592 |
| AP | 0.0729 | 0.3893 | 0.4318 | 0.4356 | 0.4318 | 0.4192 | 0.4056 | 0.3645 | 0.2733 | |
| AUPRO | 0.5689 | 0.8764 | 0.8778 | 0.8772 | 0.8764 | 0.8755 | 0.8748 | 0.8735 | 0.8717 | |
| FFHQ | AUROC | 0.7605 | 0.8515 | 0.8488 | 0.8459 | 0.8437 | 0.8406 | 0.8386 | 0.8347 | 0.8293 |
| AP | 0.0677 | 0.1177 | 0.1115 | 0.1075 | 0.1041 | 0.0997 | 0.0975 | 0.0944 | 0.0916 | |
| AUPRO | 0.3688 | 0.5320 | 0.5353 | 0.5345 | 0.5331 | 0.5305 | 0.5287 | 0.5252 | 0.5211 | |
| DVXray | AUROC | 0.9607 | 0.9589 | 0.9522 | 0.9454 | 0.9397 | 0.9305 | 0.9235 | 0.9057 | 0.8088 |
| AP | 0.0568 | 0.0535 | 0.0425 | 0.0336 | 0.0285 | 0.0232 | 0.0205 | 0.0165 | 0.0115 | |
| AUPRO | 0.8179 | 0.7980 | 0.7686 | 0.7432 | 0.7223 | 0.6905 | 0.6675 | 0.6122 | 0.4791 |