arXiv is now an independent nonprofit! Learn more
License: CC BY 4.0
arXiv:2609.24265v1 [cs.AI] 21 Sep 2026

Unsupervised Brain Anomaly Detection as a Bayesian Inverse Problem with Diffusion Prior

Hugues Roy    Reuben Dorent*    Ninon Burgos* Affiliation: Sorbonne Université, Institut du Cerveau - Paris Brain Institute - ICM, CNRS, Inria, Inserm, AP-HP, Hôpital de la Pitié Salpêtrière, F-75013, Paris, France E-mail huguesroy1277@gmail.com Affiliation:  Affiliation: Contributed equally
Abstract

Unsupervised anomaly detection (UAD) aims to localize abnormal regions in medical scans without pixel-level annotations. A typical strategy seeks to reconstruct a pseudo-healthy image that preserves subject-specific anatomy. Recently, diffusion models have been proposed to perform UAD. However, these methods rely on heuristic noise schedules or synthetic corruptions to balance subject-specificity and anomaly removal. In this work, we propose an alternative formulation of UAD as a Bayesian inverse problem under a diffusion prior. First, we introduce a latent spatial anomaly mask that models pixel-wise consistency between a test image and its latent corresponding pseudo-healthy image. Then, we propose an approximation of the unknown generation process that links healthy anatomy, anomalies, and the observed image, enabling a well-defined likelihood within the Bayesian framework. Building on recent advances in diffusion-based inverse problem methods, we jointly infer the pseudo-healthy image and the anomaly mask via annealed posterior sampling. We evaluate our approach on FDG PET (ADNI) and FLAIR MRI (BraTS 2021), demonstrating improved anomaly localization performance compared to other diffusion-based approaches and validating the contribution of our introduced model. Our code is available at https://github.com/HuguesRoy/UAD_DAPS.

Keywords: 
Unsupervised anomaly detection Inverse problem

1 Introduction

Unsupervised anomaly detection (UAD) in medical imaging aims to identify abnormal regions without requiring assumptions about anomaly characteristics or pixel-level annotations. A common strategy is to reconstruct a pseudo-healthy version of an abnormal image to detect anomalies.

Such reconstruction must satisfy two competing objectives: (i) it should be plausible under the healthy data distribution, and (ii) it should preserve subject-specific anatomical details.

Diffusion models trained on healthy data have recently been used for UAD due to their strong generative capabilities. However, to balance these competing objectives, these methods rely on heuristic choices, such as denoising noise levels [1, 3, 4, 23], corruption strategies [4, 22, 24, 18], or synthetic anomalies [11, 13, 2].

In parallel, diffusion models recently achieved strong performance in Bayesian inverse problems by leveraging learned data priors [19, 25]. These approaches progressively estimate a latent clean signal from noisy observations through iterative denoising updates. However, they rely on a known forward model linking the clean signal to the noisy measurement, which is unavailable in UAD.

In this work, we bridge these two lines of research by formulating unsupervised anomaly detection as a Bayesian inverse problem in which the forward model is unknown and must be approximated. Our contributions are fourfold: (1) we formulate diffusion-based UAD as a Bayesian inverse problem with a latent anomaly mask; (2) we introduce an approximation of the unknown forward model; (3) we propose a spatially regularized mask prior enabling stable joint inference via intermediate posterior sampling [25]; and (4) we conduct extensive experiments demonstrating the effectiveness of our approach which outperforms existing diffusion-based methods on both PET and MRI benchmarks.

2 Inverse problem using diffusion models

Inverse problems aim to reconstruct an unknown signal 𝒙0\boldsymbol{x}_{0} from a partial, noisy measurement 𝒚\boldsymbol{y} by inverting a known forward model that describes the measurement process. In a Bayesian setting, reconstruction is formulated as inference under the posterior distribution p⁡(𝒙0∣𝒚)∝p⁡(𝒚∣𝒙0)​p​(𝒙0)p(\boldsymbol{x}_{0}\mid\boldsymbol{y})\propto p(\boldsymbol{y}\mid\boldsymbol{x}_{0})p(\boldsymbol{x}_{0}), where the likelihood p⁡(𝒚∣𝒙0)p(\boldsymbol{y}\mid\boldsymbol{x}_{0}) is defined by the forward model and p⁡(𝒙0)p(\boldsymbol{x}_{0}) is the prior distribution. A key challenge of inverse problems is to approximate this unknown prior.

Recently, diffusion models have shown strong performance to approximate priors [5, 6, 7, 12, 19] in inverse problems. A noisy signal 𝒙t\boldsymbol{x}_{t} is iteratively denoised using both a prior diffusion model trained on clean signals and the likelihood p⁡(𝒚∣𝒙t)p(\boldsymbol{y}\mid\boldsymbol{x}_{t}), leading to a denoising process conditioned on the measurement 𝒚\boldsymbol{y}. However, early denoising errors have been found to be difficult to correct [25].

To address this limitation, Zhang et al. [25] proposed the Decoupled Annealed Posterior Sampling (DAPS) strategy. Rather than strictly following the diffusion trajectory, DAPS introduces a sequence of intermediate posteriors pk​(𝒙0∣𝒚,𝒙tk)∝p⁡(𝒚∣𝒙0)​pk​(𝒙0∣𝒙tk)p_{k}(\boldsymbol{x}_{0}\mid\boldsymbol{y},\boldsymbol{x}_{t_{k}})\propto p(\boldsymbol{y}\mid\boldsymbol{x}_{0})p_{k}(\boldsymbol{x}_{0}\mid\boldsymbol{x}_{t_{k}}) which gradually converge to the true posterior p⁡(𝒙0∣𝒚)p(\boldsymbol{x}_{0}\mid\boldsymbol{y}) and enable exploring a larger solution space. As in [6, 19], they approximate the conditional prior pk​(𝒙0∣𝒙tk)p_{k}(\boldsymbol{x}_{0}\mid\boldsymbol{x}_{t_{k}}) using a Gaussian distribution,

pk​(𝒙0∣𝒙tk)≈𝒩⁡(𝒙0,𝒙^0​(𝒙tk,tk),rk2​𝑰),p_{k}(\boldsymbol{x}_{0}\mid\boldsymbol{x}_{t_{k}})\approx\mathcal{N}\left(\boldsymbol{x}_{0};\hat{\boldsymbol{x}}_{0}(\boldsymbol{x}_{t_{k}},t_{k}),r_{k}^{2}\boldsymbol{I}\right), (1)

where 𝒙^0\hat{\boldsymbol{x}}_{0} is sampled from the reverse process of the diffusion model. The variance rk2r_{k}^{2} weights the contribution of the conditional prior in the intermediate posterior.

Instead of directly sampling 𝒙tk+1\boldsymbol{x}_{t_{k+1}} from 𝒙tk\boldsymbol{x}_{t_{k}}, an intermediate signal 𝒙0(k)\boldsymbol{x}_{0}^{(k)} is sampled using the intermediate posterior pk​(𝒙0∣𝒚,𝒙tk)p_{k}(\boldsymbol{x}_{0}\mid\boldsymbol{y},\boldsymbol{x}_{t_{k}}) and re-noised to obtain a sample 𝒙tk+1\boldsymbol{x}_{t_{k+1}}. Thanks to this decoupled sampling strategy and intermediate posterior parameterization, larger changes between iterations are obtained, preventing early denoising errors from propagating through the sampling process.

A key limitation of DAPS and other inverse problem approaches is their reliance on a known and available forward model. This assumption typically does not hold in unsupervised anomaly detection for medical imaging, where no forward model exists to sample an abnormal image 𝒚\boldsymbol{y} from a healthy image 𝒙0\boldsymbol{x}_{0}.

3 Method

In this work, we propose a new diffusion-based approach to unsupervised anomaly detection. Specifically, we formulate anomaly detection as a Bayesian inverse problem and approximate the unknown forward model by introducing a latent variable 𝒎\boldsymbol{m} that represents a probabilistic anomaly mask. Under this formulation, the objective is to jointly infer the healthy image 𝒙0\boldsymbol{x}_{0} and the mask 𝒎\boldsymbol{m} from the observed image 𝒚\boldsymbol{y}. In the following sections, we define the probabilistic model, including the likelihood, the priors, and the proposed inference strategy.

Refer to caption
Figure 1: Top left: Probabilistic graphical model of the proposed method. Right: Overview of the inference process. As kk increases, the posterior distribution progressively concentrates, enabling the sampling of the final estimates 𝒙0\boldsymbol{x}_{0} and 𝒎\boldsymbol{m}. The variable 𝒙tk\boldsymbol{x}_{t_{k}} denotes the noisy version of 𝒙0\boldsymbol{x}_{0} at step kk, which allows a decoupling between the previously sampled noisy variable and the newly generated one.

Generative model

To formalize anomaly detection as a Bayesian inverse problem, we assume that the observed image 𝒚\boldsymbol{y} is generated from a latent healthy image 𝒙0\boldsymbol{x}_{0} and a latent anomaly mask 𝒎\boldsymbol{m} through the likelihood p⁡(𝒚∣𝒙0,𝒎)p(\boldsymbol{y}\mid\boldsymbol{x}_{0},\boldsymbol{m}). Specifically, the observation 𝒚\boldsymbol{y} is expected to coincide with 𝒙0\boldsymbol{x}_{0} only in regions labeled as normal by the mask 𝒎\boldsymbol{m}. As shown in the graphical model in Fig. 1, assuming prior independence between 𝒙0\boldsymbol{x}_{0} and 𝒎\boldsymbol{m}, the joint distribution factorizes as p⁡(𝒙0,𝒎,𝒚)=p⁡(𝒙0)​p​(𝒎)​p​(𝒚∣𝒙0,𝒎),p(\boldsymbol{x}_{0},\boldsymbol{m},\boldsymbol{y})=p(\boldsymbol{x}_{0})p(\boldsymbol{m})p(\boldsymbol{y}\mid\boldsymbol{x}_{0},\boldsymbol{m}), where p⁡(𝒙0)p(\boldsymbol{x}_{0}) is the prior over healthy images and p⁡(𝒎)p(\boldsymbol{m}) is a spatial prior over anomaly masks. As in Bayesian inverse problems, the objective is to sample the healthy image 𝒙0\boldsymbol{x}_{0} and anomaly mask 𝒎\boldsymbol{m} from the posterior p⁡(𝒙0,𝒎∣𝒚)∝p⁡(𝒚∣𝒙0,𝒎)​p​(𝒙0)​p​(𝒎)p(\boldsymbol{x}_{0},\boldsymbol{m}\mid\boldsymbol{y})\propto p(\boldsymbol{y}\mid\boldsymbol{x}_{0},\boldsymbol{m})p(\boldsymbol{x}_{0})p(\boldsymbol{m}). To approximate this posterior, we adopt a similar formulation as in DAPS [25]. Introducing the noisy diffusion states 𝒙tk\boldsymbol{x}_{t_{k}} to approximate the image prior p⁡(𝒙0)p(\boldsymbol{x}_{0}), we define a sequence of intermediate posteriors

pk(𝒙0,𝒎∣𝒚,𝒙tk)∝pk(𝒚∣𝒙0,𝒎)pk(𝒙0∣𝒙tk)p(𝒎),\displaystyle p_{k}(\boldsymbol{x}_{0},\boldsymbol{m}\mid\boldsymbol{y},\boldsymbol{x}_{t_{k}})\propto p_{k}(\boldsymbol{y}\mid\boldsymbol{x}_{0},\boldsymbol{m})\,p_{k}(\boldsymbol{x}_{0}\mid\boldsymbol{x}_{t_{k}})\,p(\boldsymbol{m}), (2)

where pk​(𝒙0∣𝒙tk)p_{k}(\boldsymbol{x}_{0}\mid\boldsymbol{x}_{t_{k}}) is the conditional diffusion prior defined in Eq. (1).

Approximate the forward model

Unlike classical inverse problems, the forward model relating a healthy image 𝒙0\boldsymbol{x}_{0} to an abnormal scan 𝒚\boldsymbol{y} is unknown. In this section, we propose an approximation of the forward model p⁡(𝒚∣𝒙0,𝒎)p(\boldsymbol{y}\mid\boldsymbol{x}_{0},\boldsymbol{m}) based on the introduced anomaly mask 𝒎\boldsymbol{m}. The probabilistic anomaly mask 𝒎\boldsymbol{m} encodes pixel-level abnormality: values close to 0 indicate anomalous measurements, whereas values close to 1 enforce consistency between 𝒚\boldsymbol{y} and 𝒙0\boldsymbol{x}_{0}. Accordingly, we model the likelihood as:

pk​(𝒚∣𝒙0,𝒎)=𝒩⁡(𝒚,𝒙0,rk2​diag​(𝒎)−2),\displaystyle p_{k}(\boldsymbol{y}\mid\boldsymbol{x}_{0},\boldsymbol{m})=\mathcal{N}(\boldsymbol{y};\boldsymbol{x}_{0},r_{k}^{2}\,\mathrm{diag}(\boldsymbol{m})^{-2})\kern 5.0pt, (3)

with variance rk2r_{k}^{2}, matched to the conditional prior pk​(𝒙0∣𝒙tk)p_{k}(\boldsymbol{x}_{0}\mid\boldsymbol{x}_{t_{k}}) variance. This ensures that, at intermediate step kk, in normal regions, the variability of the diffusion-based prediction is consistent with the variability observed in 𝒚\boldsymbol{y}. Deviations exceeding this expected variability cannot be explained by the prior and are therefore attributed to abnormal regions.

Spatial prior on the mask

Since the probabilistic mask 𝒎\boldsymbol{m} is introduced as a latent variable, we must specify a prior distribution p⁡(𝒎)p(\boldsymbol{m}). To enforce values in (0,1)(0,1), we parametrize it as 𝒎=s⁡(𝒂)\boldsymbol{m}=s(\boldsymbol{a}), where 𝒂\boldsymbol{a} are unconstrained logits and ss denotes the sigmoid function. We then define a prior p⁡(𝒂)p(\boldsymbol{a}), that (i) defines the initial mask value, (ii) controls the magnitude of mask updates during inference, and (iii) enforces spatial consistency. To this end, we assume a Gaussian Markov random field prior:

p⁡(𝒂)=𝒩⁡(𝒂,μ​𝟏,𝑸−1),\displaystyle p(\boldsymbol{a})=\mathcal{N}(\boldsymbol{a};\mu\boldsymbol{1},\boldsymbol{Q}^{-1})\kern 5.0pt, (4)

with a precision matrix 𝑸=λ0​𝑰+λc​𝑳\boldsymbol{Q}=\lambda_{0}\boldsymbol{I}+\lambda_{c}\boldsymbol{L}, where λ0,λc>0\lambda_{0},\lambda_{c}>0 and 𝑳\boldsymbol{L} is the graph Laplacian of the image grid. The quadratic form 𝒂⊤​𝑳​𝒂\boldsymbol{a}^{\top}\boldsymbol{L}\boldsymbol{a} penalizes differences between neighboring logits, promoting spatial consistency. The parameter μ\mu sets the initial value of the mask, λ0\lambda_{0} controls the global shrinkage of logits toward μ\mu, and λc\lambda_{c} governs the spatial consistency strength.

Energy formulation of the intermediate posterior

Finally, by combining the conditional diffusion prior defined in Eq. (1), the approximate likelihood in Eq. (3) and the logit mask prior in Eq. (4), the intermediate posteriors in Eq. (2) can be formulated as a Gibbs distribution, i.e. pk(𝒙0,𝒂∣𝒚,𝒙tk)∝exp(−Uk(𝒙0,𝒂))p_{k}(\boldsymbol{x}_{0},\boldsymbol{a}\mid\boldsymbol{y},\boldsymbol{x}_{t_{k}})\propto\exp(-U_{k}(\boldsymbol{x}_{0},\boldsymbol{a})), where Uk​(𝒙0,𝒂)U_{k}(\boldsymbol{x}_{0},\boldsymbol{a}) is defined as:

Uk​(𝒙0,𝒂)=12​rk2​‖𝒙0−𝒙^0​(𝒙tk,tk)‖2⏟Conditional prior consistency +12​rk2​‖s⁡(𝒂)⊙(𝒚−𝒙0)‖2⏟Mask-weighted measurement consistency−∑ilogs(ai)+λ02∥𝒂−μ𝟏∥2⏟Mask value regularization+λc2​∑(i,j)∈E(ai−aj)2⏟Spatial mask consistency.\displaystyle\begin{aligned} U_{k}(\boldsymbol{x}_{0},\boldsymbol{a})&=\underbrace{\frac{1}{2r_{k}^{2}}\big\|\boldsymbol{x}_{0}-\hat{\boldsymbol{x}}_{0}(\boldsymbol{x}_{t_{k}},t_{k})\big\|^{2}}_{\text{Conditional prior consistency }}+\underbrace{\frac{1}{2r_{k}^{2}}\big\|s(\boldsymbol{a})\odot(\boldsymbol{y}-\boldsymbol{x}_{0})\big\|^{2}}_{\text{Mask-weighted measurement consistency}}\\ &\qquad\underbrace{-\sum_{i}\log s(a_{i})+\frac{\lambda_{0}}{2}\|\boldsymbol{a}-\mu\boldsymbol{1}\|^{2}}_{\text{Mask value regularization}}+\underbrace{\frac{\lambda_{c}}{2}\sum_{(i,j)\in E}(a_{i}-a_{j})^{2}}_{\text{Spatial mask consistency}}.\end{aligned} (5)

Inference by Langevin dynamics

In order to sample from the intermediate posteriors, we use unadjusted Langevin dynamics [21] targeting the energy UkU_{k} at each intermediate step kk. We denote jj the Langevin steps and (𝒙0(j),𝒂(j))(\boldsymbol{x}_{0}^{(j)},\boldsymbol{a}^{(j)}) the samples at step jj. At each step kk, the reconstruction 𝒙0\boldsymbol{x}_{0} is initialized using the mean of the conditional prior sample and the observation. The mask logits are initialized once at k=0k=0 as 𝒂0=μ​𝟏\boldsymbol{a}^{0}=\mu\boldsymbol{1} and are propagated across intermediate steps without re-initialization, enabling progressive refinement of the anomaly mask as the noise level decreases.

𝒙0(j+1)\displaystyle\boldsymbol{x}_{0}^{(j+1)} =𝒙0(j)−ηx​∇𝒙0Uk​(𝒙0(j),𝒂(j))+2​ηx​𝝃x(j),\displaystyle=\boldsymbol{x}_{0}^{(j)}-\eta_{x}\nabla_{\boldsymbol{x}_{0}}U_{k}(\boldsymbol{x}_{0}^{(j)},\boldsymbol{a}^{(j)})+\sqrt{2\eta_{x}}\,\boldsymbol{\xi}_{x}^{(j)}, (6)
𝒂(j+1)\displaystyle\boldsymbol{a}^{(j+1)} =𝒂(j)−ηa​∇𝒂Uk​(𝒙0(j),𝒂(j))+2​ηa​𝝃a(j),\displaystyle=\boldsymbol{a}^{(j)}-\eta_{a}\nabla_{\boldsymbol{a}}U_{k}(\boldsymbol{x}_{0}^{(j)},\boldsymbol{a}^{(j)})+\sqrt{2\eta_{a}}\,\boldsymbol{\xi}_{a}^{(j)}, (7)

where 𝝃x(j)\boldsymbol{\xi}_{x}^{(j)} and 𝝃a(j)\boldsymbol{\xi}_{a}^{(j)} are standard Gaussian noise terms. We use only a few iterations per intermediate step kk. The step sizes ηx,ηa>0\eta_{x},\eta_{a}>0 are automatically adjusted based on gradient magnitudes ‖∇𝒙0Uk​(𝒙0(j),𝒂(j))‖22\|\nabla_{\boldsymbol{x}_{0}}U_{k}(\boldsymbol{x}_{0}^{(j)},\boldsymbol{a}^{(j)})\|^{2}_{2} and ‖∇𝒂Uk​(𝒙0(j),𝒂(j))‖22\|\nabla_{\boldsymbol{a}}U_{k}(\boldsymbol{x}_{0}^{(j)},\boldsymbol{a}^{(j)})\|^{2}_{2}.

Hyperparameter reparameterization

The posterior energy in Eq. (5) depends explicitly on the variance schedule rkr_{k}. We parametrize rk=c​σtkr_{k}=c\,\sigma_{t_{k}}, where σtk\sigma_{t_{k}} denotes the diffusion noise level and c>0c>0 is a calibration constant estimated on a healthy validation set to ensure stable reconstruction in the absence of anomalies. As rkr_{k} decreases, the relative strength of the likelihood increases compared to the mask prior since it scales as 1/rk21/r_{k}^{2}. If the prior weight λ0\lambda_{0} is kept fixed across intermediate steps, this changing scale alters the balance between the likelihood and the logit prior. To preserve a stable trade-off across intermediate steps, we adapt λ0\lambda_{0}. It is chosen such that the gradient magnitudes from the likelihood and mask value are almost equal.

Refer to caption
Figure 2: Qualitative results on BraTS FLAIR (top) and ADNI PET (AD 50%, bottom).

Implementation details

We adopt the diffusion parameterization of Karras et al. [10] and train the diffusion model exclusively on healthy data. The conditional estimate 𝒙^0​(𝒙tk,tk)\hat{\boldsymbol{x}}_{0}(\boldsymbol{x}_{t_{k}},t_{k}) in Eq. (1) is obtained using the probability flow ordinary differential equation [20] (PF-ODE) with two solver steps per noise level. For all experiments, we use 150 intermediate posterior steps in the DAPS framework and 75 Langevin iterations at each intermediate step. The noise levels {tk}\{t_{k}\} follow the DAPS parameterization with σmax=20\sigma_{\max}=20. We set the spatial consistency parameters λc\lambda_{c} to 1. An 80GB NVIDIA H100 GPU was used for training.

4 Experiments & Results

To evaluate the performance of our proposed model, experiments were conducted on 2D FLAIR MRI of glioblastoma patients and on 2D FDG PET with synthetic Alzheimer-like hypometabolism. Our framework was compared with UAD diffusion models [3, 4, 24] and state of the art methods [9, 11, 13]. For the proposed approach, we use the inferred latent anomaly mask directly as anomaly maps, while other methods use residuals.

Datasets  ADNI PET FDG PET images were obtained from ADNI [16] and preprocessed with Clinica [17] (affine registration to MNI, intensity normalization, cropping, resampling to 1283128^{3}, rescaling to [−1,1][-1,1]). We selected 621 images from 301 cognitively normal subjects. Fifty images were kept for testing. Because no ground truth exists, we use the framework described in [8] to generate synthetic images with Alzheimer-like hypometabolism (50%). The remaining images were split at the subject level into training (545) and validation (25 volumes) sets. BRATS FLAIR FLAIR images from BraTS 2021 [15] and ADNI [16] were preprocessed with Clinica [17] in a similar manner as the PET images. Models were trained on healthy ADNI FLAIR slices (234 subjects) and evaluated on BraTS slices containing tumors (1,251 subjects). To analyze sensitivity to anomaly size, slices were grouped into medium and large categories using the 33rd and 66th percentiles of lesion area. One slice per subject was randomly selected per category, yielding 819 large lesions and 1,156 medium lesions.

Evaluation For the PET images, because multiple slices come from the same subject, we account for this hierarchical structure using stratified bootstrapping at the subject level when computing metrics. We also report the inference time. Detection performance was evaluated using the best possible Dice score (⌈Dice⌉\lceil\text{Dice}\rceil) and pixel-wise average precision (AP). Significance was assessed via Wilcoxon signed-rank tests with Bonferroni correction for multiple comparisons (p<0.01p<0.01).

Baselines We compare our method to diffusion-based UAD approaches, including AnoDDPM [24] (G-Gaussian and S-simplex noise variants), AutoDDPM (Gaussian noise) [3], and THOR (Simplex noise) [4]. For fairness, all diffusion models use the same U-Net backbone. We additionally compare against IterMask2\text{IterMask}^{2} [13], a recent state-of-the-art UAD framework that uses synthetic anomalies, and a variational autoencoder (β\beta-VAE) [9, 14]. All models are trained on healthy data only. Hyperparameters were tuned on the healthy validation set.

Table 1: Performance on BraTS FLAIR. Best possible Dice and AP are reported in % as mean (standard deviation). Arrows indicate favorable direction of each metric.
Large Medium
Category Method ⌈Dice⌉\lceil\text{Dice}\rceil(%) ↑\uparrow AP (%) ↑\uparrow ⌈Dice⌉\lceil\text{Dice}\rceil (%) ↑\uparrow AP (%) ↑\uparrow
Reconstruction DAE [11] 68.6​(17.5)68.6(17.5) 71.9​(20.5)71.9(20.5) 66.9​(21.0)66.9(21.0) 69.0​(25.5)69.0(25.5)
β\beta-VAE [14] 56.3​(16.5)56.3(16.5) 54.2​(22.4)54.2(22.4) 48.3​(19.8)48.3(19.8) 44.7​(25.4)44.7(25.4)
IterMask2 [13] 78.7​(14.5)\mathbf{78.7(14.5)} 82.3​(17.0)\mathbf{82.3(17.0)} 71.0​(18.3)\mathbf{71.0(18.3)} 72.8​(22.3)\mathbf{72.8(22.3)}
Diffusion AnoDDPM-G [24] 36.7​(9.8)36.7(9.8) 30.3​(11.5)30.3(11.5) 31.8​(13.9)31.8(13.9) 24.5​(15.3)24.5(15.3)
AnoDDPM-S [24] 63.1​(19.6)63.1(19.6) 64.9​(24.5)64.9(24.5) 51.5​(23.5)51.5(23.5) 50.1​(29.0)50.1(29.0)
AutoDDPM-G [3] 44.7​(19.4)44.7(19.4) 39.1​(21.5)39.1(21.5) 45.2​(22.7)45.2(22.7) 40.6​(26.6)40.6(26.6)
THOR-S [4] 62.6​(20.4)62.6(20.4) 60.4​(26.9)60.4(26.9) 50.3​(21.6)50.3(21.6) 42.5​(26.5)42.5(26.5)
Ours 72.3​(19.2)72.3(19.2) 73.0​(24.3)73.0(24.3) 63.8​(22.6)63.8(22.6) 62.5​(28.3)62.5(28.3)
Table 2: Performance on ADNI PET. Mean ⌈Dice⌉\lceil\text{Dice}\rceil and AP are reported in % with 95% bootstrap confidence intervals. Inference speed is reported as slices per second.
Synthetic Alzheimer-like hypometabolism
Category Method ⌈Dice⌉\lceil\text{Dice}\rceil (%) ↑\uparrow AP (%) ↑\uparrow Slices/s ↑\uparrow
Reconstruction DAE [11] 47.3​[46.0,48.6]47.3[46.0,48.6] 46.8​[44.7,48.8]46.8[44.7,48.8] 296.7296.7
β\beta-VAE [9] 61.9​[61.2,62.6]61.9[61.2,62.6] 64.5​[63.4,65.7]64.5[63.4,65.7] 535.4\mathbf{535.4}
IterMask2 [13] 40.1​[39.7,40.6]40.1[39.7,40.6] 17.0​[16.7,17.3]17.0[16.7,17.3] 108.7108.7
Diffusion AnoDDPM-G [24] 25.2​[24.9,25.4]25.2[24.9,25.4] 14.1​[14.0,14.3]14.1[14.0,14.3] 2.12.1
AnoDDPM-S [24] 40.9​[39.3,42.5]40.9[39.3,42.5] 34.7​[32.4,37.3]34.7[32.4,37.3] 2.52.5
AutoDDPM-G [3] 9.8​[9.3,10.3]9.8[9.3,10.3] 13.7​[13.6,13.9]13.7[13.6,13.9] 1.21.2
THOR-S [4] 43.0​[41.6,44.4]43.0[41.6,44.4] 35.0​[33.3,36.7]35.0[33.3,36.7] 2.12.1
Ours 65.7​[64.7,66.7]\mathbf{65.7[64.7,66.7]} 67.9​[66.2,69.7]\mathbf{67.9[66.2,69.7]} 2.82.8

Results Quantitative results on the BraTS dataset are reported in Table 1. Diffusion-based approaches (AnoDDPM, AutoDDPM, THOR) achieve lower AP and ⌈Dice⌉\lceil\text{Dice}\rceil compared to reconstruction-based methods relying on synthetic anomalies (IterMask2\text{IterMask}^{2}) or single-step denoising (DAE). Among diffusion models, Ours shows the best performance (p<0.01p<0.01) for both lesion sizes and both evaluation metrics. Compared to all methods, it ranks second on large lesions and third on medium lesions. From Fig. 2, we observe that the DAE and IterMask2\text{IterMask}^{2} attenuate abnormal hyperintensities toward normal tissue values. In contrast, Ours shows restoration of the anomaly, for example reconstructing the ventricles. On ADNI PET (Table 2), our method outperforms all baselines by +3.8+3.8pp in ⌈Dice⌉\lceil\text{Dice}\rceil and +3.4+3.4pp in AP (p<0.01p<0.01). We observe that IterMask2\text{IterMask}^{2}, which performs strongly on BraTS, fails to generalize to this modality. Finally, inference speed shows that our method does not introduce computational overload compared to standard diffusion models while achieving better detection performance.

Ablation study We evaluate the contribution of each modeling component on the BraTS dataset (Table 3). (A) No latent mask. Removing the latent anomaly mask results in no detection; the abnormal image is reconstructed. (B) Fixed likelihood variance (rk2r_{k}^{2}). Instead of using the variance schedule, the likelihood variance is fixed to 5×10−25\times 10^{-2} as commonly done in classical inverse problems [25]. This modification degrades performance. (C) No spatial regularization. Removing spatial consistency in the mask prior (i.e., setting λc=0\lambda_{c}=0) negatively impacts anomaly detection performance. This highlights the importance of spatial regularization to enforce coherent anomaly regions and suppress isolated false positives.

Table 3: Ablation experiments on BraTS FLAIR (large lesions only). Best possible Dice and AP are reported in % as mean (standard deviation).
Method ⌈Dice⌉\lceil\text{Dice}\rceil (%) ↑\uparrow AP (%) ↑\uparrow
(A) No latent mask 0.0​(0.0)0.0(0.0) 7.9​(2.2)7.9(2.2)
(B) Fixed likelihood variance 65.8​(19.3)65.8(19.3) 64.6​(25.6)64.6(25.6)
(C) No spatial regularization 46.6​(13.9)46.6(13.9) 38.1​(15.4)38.1(15.4)
Ours 72.3​(19.2)\mathbf{72.3(19.2)} 73.0​(24.3)\mathbf{73.0(24.3)}

5 Conclusion

In summary, we formulated unsupervised anomaly detection as a Bayesian inverse problem, using a diffusion model as a prior over healthy anatomy. Our method introduces a latent anomaly mask that is inferred jointly with the reconstruction through sampling of a sequence of intermediate posteriors. The mask provides an approximation of the unknown forward model, while a spatial prior ensures coherent and anatomically consistent anomaly regions. Ablation studies confirmed the importance of each proposed component. Experimentally, our model achieves competitive performance on BraTS and state-of-the-art results on ADNI PET compared to multiple baselines.

While the current formulation already demonstrates competitive performance, it also opens several directions for further development. Replacing the Gaussian approximation of the conditional diffusion prior with a more expressive model could improve the approximation of the intermediate posteriors and enhance anomaly detection. Similarly, refining the forward model formulation may allow the framework to better capture pathological patterns. Since our method relies on joint intermediate posterior inference, alternative sampling or optimization strategies may improve stability and computational efficiency. Extending the framework to full 3D volumes is another important direction. Together, these improvements would extend the framework to other imaging modalities and clinical problems.

Acknowledgements

This work was supported by ANR through the “Investissements d’avenir” program (ANR-10-IAIHU-06, ANR-19-P3IA-0001, PRAIRIE 3IA Institute), the “France 2030” program (ANR-23-IACL-0008, PRAIRIE-PSAI), and the MediTwin project. It also received support from the European Union’s Horizon Europe Framework Programme under grant agreement No. 101136607 (CLARA), and from Next Generation EU through the “France Relance” plan. The ARAMIS Lab is affiliated with DIM C-BRAINS, funded by the Conseil Régional d’Ile-de-France. Experiments used GENCI–IDRIS HPC resources under grants 2025-AD011011648R5 and AD011017165. R.D. received Marie Skłodowska-Curie grant No. 101154248 (SafeREG). Data collection and sharing were funded by the Alzheimer’s Disease Neuroimaging Initiative (ADNI), supported by NIH grant U19AG024904, with additional public and private-sector support.

Disclosure of Interests.

The authors have no competing interests to declare that are relevant to the content of this article.

References

  • [1] F. Behrendt, D. Bhattacharya, J. Krüger, R. Opfer, and A. Schlaefer (2024) Patched Diffusion Models for Unsupervised Anomaly Detection in Brain MRI. In Medical Imaging with Deep Learning, pp. 1019–1032. External Links: ISSN 2640-3498 Cited by: §1.
  • [2] F. Beizaee, G. Lodygensky, C. Desrosiers, and J. Dolz (2026) MAD-ad: masked diffusion for unsupervised brain anomaly detection. In Information Processing in Medical Imaging, pp. 139–153. Cited by: §1.
  • [3] C. I. Bercea, M. Neumayr, D. Rueckert, and J. A. Schnabel (2023) Mask, Stitch, and Re-Sample: Enhancing Robustness and Generalizability in Anomaly Detection through Automatic Diffusion Models. In ICML 3rd Workshop on Interpretable Machine Learning in Healthcare (IMLH), Cited by: §1, Table 1, Table 2, §4, §4.
  • [4] C. I. Bercea, B. Wiestler, D. Rueckert, and J. A. Schnabel (2024) Diffusion Models with Implicit Guidance for Medical Anomaly Detection. In Medical Image Computing and Computer Assisted Intervention – MICCAI 2024, Cham, pp. 211–220. Cited by: §1, Table 1, Table 2, §4, §4.
  • [5] G. Cardoso, Y. J. el Idrissi, S. L. Corff, and E. Moulines (2023) Monte Carlo guided Denoising Diffusion models for Bayesian linear inverse problems.. In The Twelfth International Conference on Learning Representations, Cited by: §2.
  • [6] H. Chung, J. Kim, M. T. Mccann, M. L. Klasky, and J. C. Ye (2022) Diffusion Posterior Sampling for General Noisy Inverse Problems. In The Eleventh International Conference on Learning Representations, Cited by: §2, §2.
  • [7] Z. Dou and Y. Song (2024) Diffusion posterior sampling for linear inverse problem solving: a filtering perspective. In International Conference on Learning Representations, Vol. 2024, pp. 12069–12095. Cited by: §2.
  • [8] R. Hassanaly, C. Brianceau, M. Solal, O. Colliot, and N. Burgos (2024) Evaluation of pseudo-healthy image reconstruction for anomaly detection with deep generative models: Application to brain FDG PET. Machine Learning for Biomedical Imaging 2 (Special Issue for Generative Models), pp. 611–656. Cited by: §4.
  • [9] R. Hassanaly, M. Solal, O. Colliot, N. Burgos, and f. t. A. D. N. Initiative (2025) Benchmarking 3D generative autoencoders for pseudo-healthy reconstruction of brain 18F-fluorodeoxyglucose positron emission tomography. Journal of Medical Imaging 12 (5), pp. 054005. Cited by: Table 2, §4, §4.
  • [10] T. Karras, M. Aittala, T. Aila, and S. Laine (2022) Elucidating the Design Space of Diffusion-Based Generative Models. In Advances in Neural Information Processing Systems, Cited by: §3.
  • [11] A. Kascenas, N. Pugeault, and A. Q. O’Neil (2022) Denoising Autoencoders for Unsupervised Anomaly Detection in Brain MRI. In Proceedings of The 5th International Conference on Medical Imaging with Deep Learning, pp. 653–664. External Links: ISSN 2640-3498 Cited by: §1, Table 1, Table 2, §4.
  • [12] B. Kawar, M. Elad, S. Ermon, and J. Song (2022) Denoising diffusion restoration models. In Advances in Neural Information Processing Systems, Cited by: §2.
  • [13] Z. Liang, X. Guo, J. A. Noble, and K. Kamnitsas (2024) IterMask2: Iterative Unsupervised Anomaly Segmentation via Spatial and Frequency Masking for Brain Lesions in MRI. In Medical Image Computing and Computer Assisted Intervention – MICCAI 2024, Cham, pp. 339–348. External Links: ISBN 978-3-031-72111-3 Cited by: §1, Table 1, Table 2, §4, §4.
  • [14] S. Loizillon, Y. Jacob, M. Aurélien, D. Dormont, O. Colliot, N. Burgos, and A. S. Group (2024) Detecting Brain Anomalies in Clinical Routine with the β\beta-VAE: Feasibility Study on Age-Related White Matter Hyperintensities. In Proceedings of The 7nd International Conference on Medical Imaging with Deep Learning, pp. 903–917. Cited by: Table 1, §4.
  • [15] B. H. Menze, A. Jakab, S. Bauer, J. Kalpathy-Cramer, K. Farahani, J. Kirby, Y. Burren, N. Porz, J. Slotboom, R. Wiest, L. Lanczi, E. Gerstner, M. Weber, T. Arbel, B. B. Avants, N. Ayache, P. Buendia, D. L. Collins, N. Cordier, J. J. Corso, A. Criminisi, T. Das, H. Delingette, Ç. Demiralp, C. R. Durst, M. Dojat, S. Doyle, J. Festa, F. Forbes, E. Geremia, B. Glocker, P. Golland, X. Guo, A. Hamamci, K. M. Iftekharuddin, R. Jena, N. M. John, E. Konukoglu, D. Lashkari, J. A. Mariz, R. Meier, S. Pereira, D. Precup, S. J. Price, T. R. Raviv, S. M. S. Reza, M. Ryan, D. Sarikaya, L. Schwartz, H. Shin, J. Shotton, C. A. Silva, N. Sousa, N. K. Subbanna, G. Szekely, T. J. Taylor, O. M. Thomas, N. J. Tustison, G. Unal, F. Vasseur, M. Wintermark, D. H. Ye, L. Zhao, B. Zhao, D. Zikic, M. Prastawa, M. Reyes, and K. Van Leemput (2015) The multimodal brain tumor image segmentation benchmark (brats). IEEE Transactions on Medical Imaging 34 (10), pp. 1993–2024. Cited by: §4.
  • [16] R. C. Petersen, P. S. Aisen, L. A. Beckett, M. C. Donohue, A. C. Gamst, D. J. Harvey, C. R. Jack, W. J. Jagust, L. M. Shaw, A. W. Toga, J. Q. Trojanowski, and M. W. Weiner (2010) Alzheimer’s Disease Neuroimaging Initiative (ADNI): Clinical characterization. Neurology 74 (3), pp. 201–209. External Links: ISSN 0028-3878, 1526-632X Cited by: §4.
  • [17] A. Routier, N. Burgos, M. Díaz, M. Bacci, S. Bottani, O. El-Rifai, S. Fontanella, P. Gori, J. Guillon, A. Guyot, R. Hassanaly, T. Jacquemont, P. Lu, A. Marcoux, T. Moreau, J. Samper-González, M. Teichmann, E. Thibeau-Sutre, G. Vaillant, J. Wen, A. Wild, M. Habert, S. Durrleman, and O. Colliot (2021) Clinica: An Open-Source Software Platform for Reproducible Clinical Neuroscience Studies. Frontiers in Neuroinformatics 15, pp. 39. Cited by: §4.
  • [18] H. Roy, R. Dorent, and N. Burgos (2025) Unsupervised anomaly detection using Bayesian flow networks: application to brain FDG pet in the context of Alzheimer’s disease. In Lecture Notes in Computer Science : Deep Generative Models, Cited by: §1.
  • [19] J. Song, A. Vahdat, M. Mardani, and J. Kautz (2022) Pseudoinverse-Guided Diffusion Models for Inverse Problems. In International Conference on Learning Representations, Cited by: §1, §2, §2.
  • [20] Y. Song, J. Sohl-Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole (2020) Score-Based Generative Modeling through Stochastic Differential Equations. In International Conference on Learning Representations, Cited by: §3.
  • [21] M. Welling and Y. W. Teh (2011) Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th International Conference on International Conference on Machine Learning, External Links: ISBN 978-1-4503-0619-5 Cited by: §3.
  • [22] J. Wolleb, F. Bieder, P. Friedrich, P. Zhang, A. Durrer, and P. C. Cattin (2024) Binary Noise for Binary Tasks: Masked Bernoulli Diffusion for Unsupervised Anomaly Detection. In Medical Image Computing and Computer Assisted Intervention – MICCAI 2024, Cham, pp. 135–145. External Links: ISBN 978-3-031-72120-5 Cited by: §1.
  • [23] J. Wolleb, F. Bieder, R. Sandkühler, and P. C. Cattin (2022) Diffusion Models for Medical Anomaly Detection. In Medical Image Computing and Computer Assisted Intervention – MICCAI 2022, Cham, pp. 35–45. External Links: ISBN 978-3-031-16452-1 Cited by: §1.
  • [24] J. Wyatt, A. Leach, S. M. Schmon, and C. G. Willcocks (2022) AnoDDPM: Anomaly Detection With Denoising Diffusion Probabilistic Models Using Simplex Noise. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Cited by: §1, Table 1, Table 1, Table 2, Table 2, §4, §4.
  • [25] B. Zhang, W. Chu, J. Berner, C. Meng, A. Anandkumar, and Y. Song (2025) Improving Diffusion Inverse Problem Solving with Decoupled Noise Annealing. In 2025 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 20895–20905. External Links: ISSN 2575-7075 Cited by: §1, §1, §2, §2, §3, §4.