Next Article in Journal
Theory-Based Interpretability in Deep Knowledge Tracing via Grounded Transformers
Previous Article in Journal
The Impact of the COVID-19 Pandemic on Water Consumption in a Selected Tourist Destination in Poland
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Assessing Membership Inference Privacy Risks in Medical Diffusion Models via Discrete Encoding-Based Inference

1
School of Computer Science, University of Electronic Science and Technology of China, No. 2006, Xiyuan Avenue, West Hi-Tech Zone, Chengdu 611731, China
2
Department of Microelectronics Thrust, The Hong Kong University of Science and Technology (Guangzhou), No. 1 Duxue Road, Guangzhou 511453, China
3
Department of Computer Science, The University of North Carolina at Chapel Hill, Chapel Hill, NC 27599, USA
4
Department of Informatics, Ying Wu College of Computing, New Jersey Institute of Technology, Newark, NJ 07102, USA
*
Author to whom correspondence should be addressed.
Appl. Sci. 2026, 16(7), 3140; https://doi.org/10.3390/app16073140
Submission received: 27 February 2026 / Revised: 17 March 2026 / Accepted: 20 March 2026 / Published: 24 March 2026

Abstract

The rapid adoption of diffusion models in medical imaging has raised significant concerns regarding data privacy, especially their susceptibility to Membership Inference Attacks (MIAs). However, the privacy risks associated with diffusion models in the medical domain remain underexplored compared to natural images. In this study, we propose a novel grey-box attack framework, termed the Discrete Encoding-Based Membership Inference Attack (DEB), inspired by Denoising Diffusion Codebook Models (DDCM). DEB injects semantically meaningful noise via a discrete codebook strategy and identifies training samples by analyzing the model’s output trajectory under this discrete encoding, specifically measuring the average of intermediate predictions across selected time steps. We conduct an evaluation of MIAs across natural images and five representative datasets from the MedMNIST collection. Our experiments reveal that the susceptibility of diffusion models is highly dependent on the data modality; for instance, while certain datasets exhibit near-complete vulnerability, others like PathMNIST demonstrate strong inherent resistance to MIAs. Furthermore, DEB demonstrates superior performance compared to existing baselines (e.g., SecMI, PIA, SimA), particularly on challenging datasets. For example, DEB achieves a True Positive Rate at 1% False Positive Rate (TPR @ 1% FPR) of 60.3% on CIFAR-10, significantly outperforming the SimA baseline (35.9%). Notably, even on the highly resistant PathMNIST dataset, DEB attains a 10.2% TPR @ 1% FPR, establishing a substantial advantage over the PIA baseline (1.1%). This work provides practical insights into the privacy risks inherent in diffusion models and emphasizes that model providers should carefully assess these vulnerabilities when exposing intermediate generation APIs.

1. Introduction

Recently, Generative Artificial Intelligence has witnessed a paradigm shift driven by the breakthrough of Denoising Diffusion Probabilistic Models (DDPMs) [1]. Large-scale diffusion models, such as Stable Diffusion [2], DALL-E 2 [3], and Imagen [4], have achieved dominance in both academia and industry due to their exceptional distribution fitting capabilities and high-fidelity image generation. Unlike traditional Generative Adversarial Networks (GANs) [5,6,7,8] or Variational Autoencoders (VAEs) [9], diffusion models generate data by reversing a progressive noise addition process. This iterative denoising mechanism endows the models with unprecedented diversity and creativity. Crucially, in the field of biomedical engineering, diffusion models have demonstrated superior competitiveness compared to GANs, achieving competitive results in tasks such as medical image segmentation [10,11,12], MRI/CT super-resolution and reconstruction [13,14,15,16], ECG signal enhancement [17] and image-to-image translation [18,19,20]. However, the widespread deployment of these high-performance models in sensitive domains has underscored significant concerns regarding privacy risks [21] and copyright disputes [22]. This issue is particularly critical in the healthcare sector. Unlike general internet data, medical records are governed by strict ethical standards and confidentiality regulations. Potential patient data leakage carries substantially more severe consequences than leakage from generic datasets, necessitating rigorous privacy audits for medical AI models.
Since diffusion models fit data distribution better, studies indicate a significant “memorization” effect, wherein the model may unintentionally memorize specific samples from the training set. Crucially, fundamental works investigating privacy risks in the context of medical imaging have demonstrated that deep learning models are highly susceptible to this memorization, leading to severe vulnerabilities such as inference and inversion attacks [23,24,25]. This phenomenon renders diffusion models vulnerable to Membership Inference Attacks (MIAs) [26,27], which often serve as a precursor to more severe data extraction attacks [28]. As a pivotal metric for assessing privacy risks, MIA aims to determine whether a given data sample was used in the model’s training by analyzing the model’s output behavior. Based on the information accessible from the model, attacks on diffusion models are generally categorized into white-box, grey-box, and black-box settings. This paper primarily focuses on the grey-box setting. In this context, we assume access to the model’s output at each intermediate step of the sampling process, rather than solely the final generated image. This assumption holds substantial practical significance in medical applications; for instance, tasks like image in-painting [29] or iterative reconstruction often require utilizing the model’s output at every step, leading providers to expose APIs that allow users to access these intermediate outputs.
The fundamental assumption underlying Membership Inference Attacks is that models tend to fit training samples better than unseen data [30]. A straightforward approach involves detecting whether the model yields a lower loss function value for a specific sample [31,32]. However, due to the stochastic nature of the diffusion training objective—which typically involves predicting a randomly sampled noise—direct attacks based on the loss function often lack sufficient discriminability. To enhance attack performance, SecMI [33] proposes examining the model from a trajectory perspective, positing that training samples exhibit better alignment along the sampling trajectory. Specifically, it executes a forward and subsequent reverse process on the deterministic DDIM path [34], inferring membership by comparing the consistency of the sample before and after this cycle. PIA [35] further refines the SecMI algorithm by leveraging the property that the sampling trajectory is approximately linear when time step t is small, thereby omitting intermediate steps. More recently, SimA [36] simplifies this further by directly utilizing the norm of the predicted noise ϵ at a specific time step for judgment.
However, SimA relies solely on information from a single time step, and while SecMI and PIA inherently infer membership by measuring trajectory consistency, they utilize information from only key time steps or linear approximations rather than the accumulated information of the entire trajectory. However, diffusion is inherently a multi-step denoising generation process. This raises a pivotal question: Can we leverage information across multiple time steps, or utilize model information via multiple queries at the same time step, to construct a more robust inference attack?
Inspired by Denoising Diffusion Codebook Models (DDCM) [37], we propose a Discrete Encoding-Based membership inference attack (DEB). The original DDCM, designed for image compression, initializes a random codebook and selects the nearest noise to replace the diffusion noise during the denoising process, thereby injecting information from the original sample. We hypothesize that training samples maintain a certain degree of stability around the sample point when subjected to this encoding. However, DDCM cannot be directly applied for MIA: it necessitates denoising from T to 0 and is strictly limited to the DDPM model. In this work, we improve the DDCM framework to be applicable to various diffusion architectures and propose DEB to enhance attack performance by statistically analyzing multiple outputs of model during discrete encoding at selected time steps.
While the aforementioned methods have been extensively verified on natural images, the membership privacy risks within the medical imaging domain remain underexplored. It is currently ambiguous which medical modalities are inherently vulnerable to privacy leakage, which exhibit natural robustness, and how their privacy characteristics diverge from those of natural images. To bridge this gap and provide a comprehensive understanding across diverse domains, we conduct a rigorous evaluation of Loss-Based Attack, SecMI, PIA, SimA, and our proposed DEB on standard natural image benchmarks, text-to-image architectures (Stable Diffusion), and a carefully selected subset of the MedMNIST2D dataset.
Our empirical study reveals that the susceptibility of diffusion models to membership inference is highly dependent on the specific data modality. We hypothesize that this variance in vulnerability arises from the distinct semantic variability and unique visual patterns inherent to different imaging distributions. Consequently, we observe significant heterogeneity across modalities: while the ChestMNIST data is highly vulnerable, others like PathMNIST demonstrate inherent robustness. Besides, DEB demonstrates superior efficacy in these challenging scenarios. By injecting semantically meaningful noise via a discrete codebook, DEB effectively extracts membership signals.
The main contributions of this paper are summarized as follows:
  • We extend the DDCM methodology to be compatible with general diffusion architectures beyond standard DDPM and optimize the efficiency. Based on this, we propose the Discrete Encoding-Based membership inference attack (DEB). By performing statistical analysis on the model’s outputs under discrete noise injection, DEB significantly improves membership inference performance.
  • We perform a rigorous evaluation of MIA performance across diverse data domains, encompassing natural images, text-to-image models, and a carefully selected subset of medical image modalities. Our results reveal a complex landscape of membership inference privacy risks: vulnerability is highly dependent on the specific data modality and its semantic variance, finding that specific modalities that possess natural defense mechanisms against memorization.
  • We validate the proposed DEB algorithm across these diverse domains. Experimental results demonstrate that DEB maintains superior performance, establishing significant advantages on natural images and unconditional text-to-image generation, while remaining superior performance on “hard” medical datasets where existing baselines struggle. Furthermore, we provide a comprehensive analysis of hyperparameters and demonstrate that the computational complexity of DEB remains highly tractable, requiring manageable execution time and GPU memory for practical deployment.
The remainder of this article is organized as follows. Section 2 reviews related work on diffusion models and denoising diffusion codebook models. Section 3 details the materials and methods, including dataset descriptions, evaluation metrics, and the theoretical formulation of our proposed DEB algorithm. Section 4 presents a comprehensive empirical evaluation of DEB across medical and natural image domains, along with ablation studies and hyperparameter sensitivity analysis. Finally, Section 5 concludes the paper with a discussion on the implications of our findings and directions for future research.

2. Related Work

2.1. Diffusion Models

Denoising Diffusion Probabilistic Models (DDPMs) generate samples by modeling the reverse of the forward diffusion process. The forward process is defined as a Markov chain that progressively injects Gaussian noise:
x t = α t x t 1 + β t ϵ t , ϵ t N ( 0 , I ) .
As the time step t increases, the variance parameter β t gradually increases while α t decreases, causing x t to eventually converge towards Gaussian noise. During the sampling phase, the model samples initial noise from a standard Gaussian distribution and subsequently performs a reverse diffusion process for denoising. Let x t denote the sequence generated by the reverse diffusion; it can be theoretically proven that x t remains Gaussian. Assuming its variance matches that of the forward process, the mean of x t can be parameterized as:
μ ˜ t = 1 α t x t β t 1 α ¯ t ϵ θ ( x t , t ) ,
where α ¯ t = k = 0 t α k and α ¯ t + β ¯ t = 1 . Accordingly, the single-step update formula for the reverse diffusion process is given by:
x t 1 = μ ˜ t + β t ϵ , ϵ N ( 0 , I ) .
The training objective is to predict the noise ϵ t injected during the forward process, with the loss function formulated as:
E x 0 , ϵ t ϵ t ϵ θ α ¯ t x 0 + 1 α ¯ t ϵ t , t 2 .
The reverse process is inherently a progressive denoising procedure; however, it typically requires a substantial number of iteration steps (e.g., T = 1000 for CIFAR-10) to ensure generation quality.
Score-based models [38] generalize the discrete-time diffusion process to the continuous-time domain, utilizing Stochastic Differential Equations (SDEs) to describe data evolution. This framework allows for the flexible design of forward and reverse processes with varying variances while maintaining the marginal distribution. The SDE for the forward process is defined as:
d x = f t ( x ) 1 2 ( g t 2 σ t 2 ) x log p t ( x ) d t + σ t d w ,
where w represents a standard forward Wiener process. The corresponding reverse SDE is given by:
d x = f t ( x ) 1 2 ( g t 2 + σ t 2 ) x log p t ( x ) d t + σ t d w ¯ ,
where w ¯ denotes the standard Wiener process in reverse time. When σ t 0 , the process degenerates into a deterministic Ordinary Differential Equation (ODE).
In the ODE formulation, off-the-shelf numerical solvers can be directly applied for sampling. In practical applications, the drift term is typically set as f t ( x ) = f ( t ) x . Sample generation is achieved by training a neural network to estimate the score function x log p t ( x ) , with a loss function highly similar to that of DDPM. The grey-box attack acquires the access to ϵ θ ( x t , t ) , and it cannot apply to pipeline which we can only access to the generated image x 0 .

2.2. Denoising Diffusion Codebook Models

Denoising Diffusion Codebook Models (DDCM) [37] aim to leverage diffusion models to transform continuous images into discrete tokens. Specifically, this method first constructs a codebook E i comprising K noise vectors sampled from a standard normal distribution N ( 0 , 1 ) . During the generation process, the method achieves image reconstruction and encoding by substituting the random noise ϵ in Equation (3) with a specific element selected from the codebook C . The core strategy involves selecting the noise vector ϵ C that maximizes the dot product ( x x 0 | x i ) · ϵ , thereby approximating the direction of x i log p i ( x | x i ) . However, the framework proposed by DDCM is applicable solely to DDPMs, which severely limits its generality.

2.3. Defenses Against MIA

Defenses against Membership Inference Attacks (MIAs) primarily focus on reducing the distinguishability between member and non-member data. These methods generally fall into four paradigms: regularization, transfer learning, information perturbation, and generative models. Regularization techniques [39,40,41] (e.g., L 2 -norm, dropout, and adversarial training) mitigate MIA vulnerabilities by restricting model overfitting and enhancing generalization. Meanwhile, transfer learning methods [42,43,44], such as knowledge distillation and domain adaptation, isolate sensitive training records by leveraging surrogate datasets to transfer knowledge, effectively balancing utility and privacy. Information perturbation mechanisms [45,46], including differential privacy and data obfuscation, mask membership signals by injecting calibrated noise into data, model parameters, or prediction outputs. Recently, defenses based on generative models (e.g., GANs, VAEs) [47,48,49] have gained traction by synthesizing high-fidelity proxy data to train substitute models. This fundamentally severs the direct link between original training data and model predictions, providing a critical foundation for addressing privacy risks and designing robust countermeasures in advanced generative architectures like diffusion models.

3. Materials and Methods

3.1. Datasets and Training Details

Medical Image.   To evaluate the performance of membership inference attacks (MIAs) on diffusion models within the medical domain, we utilized the MedMNIST collection [50,51]. To maintain consistency with experimental setups in the natural image domain and to prevent the overestimation of privacy risks often associated with exceptionally small datasets, we filtered the 12 available 2D subsets and selected only those containing 50,000 or more samples. Specifically, our evaluation focuses on five datasets: PathMNIST, ChestMNIST, OCTMNIST, TissueMNIST, and OrganAMNIST. We opted for the 28 × 28 resolution for this study based on two primary considerations. First, this resolution aligns with the standard datasets widely employed in existing MIA research on natural images [33,35,36], ensuring comparability. Second, prior evaluations [50,51] on MedMNIST (Table 1) indicate that the performance gap (in terms of accuracy and AUC) between 28 × 28 images and higher-resolution counterparts (e.g., 224 × 224 ) on ResNet [52] is little (1 or 2 points for most datasets). For implementation purposes, we resized the images to 32 × 32 to accommodate the spatial dimension requirements of the U-Net architecture. The data modality and dataset sizes are detailed in Table 2, and samples from the different datasets are exhibited in Figure 1. For all datasets, we adopted a unified DDPM training configuration, with detailed hyperparameters provided in Section 4.5. To evaluate the performance of the membership inference attacks, we constructed the target datasets by randomly sampling 50,000 images from the combined pool of each dataset’s original train, validation, and test splits. These 50,000 samples were then randomly partitioned into two equal halves: 25,000 images designated as the training set (members) and the remaining 25,000 images as the hold-out set (non-members). This setup is rigorously consistent with standard benchmarks about CIFAR-10 and CIFAR-100 used in the natural image domain [33,35,36].
Natural Images.   For the evaluation on natural images, we adhered to widely adopted experimental settings, selecting CIFAR-10, CIFAR-100 [53], and TinyImageNet [54] as our primary benchmark datasets. Consistent with the configuration used for medical images, we partitioned each dataset evenly, designating 50% of the samples as the member set and the remaining 50% as the hold-out set. Specifically, the total sample sizes for the MIA evaluation were set to 50,000 for both CIFAR-10 and CIFAR-100, and 100,000 for TinyImageNet. These DDPM models were trained for 800,000 steps using the Adam optimizer with a learning rate of 2 × 10 4 .
Additionally, we extended our evaluation to the Stable Diffusion model using the Pokemon dataset [55], which consists of approximately 800 samples. Preprocessing involved center-cropping images to a resolution of 512 × 512 . We adopted a batch size of 1 and established two distinct training configurations to assess different capabilities: a “weak overfitting” setting trained for 150,000 steps, and a “realistic fine-tuning” setting trained for 7500 steps.

3.2. Baseline

To establish a comprehensive benchmark, we compared our method against the most popular baselines in the grey-box diffusion model landscape, specifically Loss-based inference [31], SecMI [33], and PIA [35]. We also incorporated the recently proposed SimA [36] into our evaluation. Furthermore, for experiments involving Stable Diffusion, we included CLiD [27] as an additional comparative baseline. But CLiD is subject to specific constraints: it is exclusively applicable to text-to-image models and necessitates access to the ground-truth text prompts.

3.3. Evaluation Metrics

We adopt the rigorous evaluation metrics established in the MIA literature [28,56]: the Area Under the Curve (AUC) and the True Positive Rate (TPR) at a fixed False Positive Rate (FPR) of 1% (TPR @ 1% FPR). For notational brevity, we denote this metric as T1F throughout the remainder of this paper.

3.4. Proposed Method

We hypothesize that when a sample lies in the proximity of the training data manifold, the model’s output should exhibit stability around that sample point. To exploit this property, we adopt the noise injection strategy of DDCM—specifically leveraging the term ( x t x p ) · ϵ t —to embed discriminative information into the noise component. However, the original DDCM framework is inherently constrained by its exclusive applicability to DDPMs and the requirement for a complete reverse iteration from T to 0. In this section, we first present a generalized extension of the DDCM framework to address these limitations, and then introduce the proposed MIA algorithm.

3.4.1. Generalizing DDCM

DDCM injects information by replacing the standard random noise term ϵ in the reverse DDPM process (Equation (3)) with a noise vector selected via arg max ϵ t C ( x t x p ) · ϵ t . The marginal distribution of diffusion models is typically expressed as:
x t = s ( t ) x 0 + Σ ( t ) ϵ ,
where x 0 p data and ϵ N ( 0 , I ) . We establish the following theorem to generalize this process:
Theorem 1. 
Performing a backward iteration with step size Δ t utilizing the score-based formulation (Equation (6)) is approximately equivalent to applying the following update rule:
x t Δ t = s ( t Δ t ) x p + Σ ( t Δ t ) 2 σ t 2 Δ t ϵ p + σ t Δ t ϵ .
Proof. 
For notational simplicity, we disregard terms of order higher than O ( Δ t ) . The proof proceeds as follows:
Applying the Euler-Maruyama discretization to the backward SDE, we obtain:
x t Δ t = x t f t x t 1 2 g t 2 x log p t ( x ) Δ t + σ t Δ t ϵ + 1 2 σ t 2 x log p t ( x ) Δ t .
We first analyze the deterministic component of Equation (9), temporarily excluding the noise-related term σ t Δ t ϵ + 1 2 σ t 2 x log p t ( x ) Δ t :
x t Δ t det = x t f t x t 1 2 g t 2 x log p t ( x ) Δ t .
According to [38], the score function can be formulated as:
x t = s ( t ) x p x log p t ( x t ) Σ ( t ) 2 .
where x p is the predicted x 0 | t and:
Σ ( t ) = s ( t ) σ ( t ) ,
σ ( t Δ t ) 2 = σ ( t ) 2 g ( t ) 2 s ( t ) 2 Δ t + O ( Δ t 2 ) .
The predicted noise vector can be formulated as:
ϵ p = x log p t ( x t ) Σ ( t ) .
Additionally, for the term s ( t ) , the following approximation holds [38]:
s ( t Δ t ) s ( t ) f t · s ( t ) Δ t .
Substituting Equation (11) into Equation (10) and rearranging the terms yields:
x t Δ t det = ( s ( t ) s ( t ) f t Δ t ) x p + 1 2 g t 2 Δ t x log p t ( x ) x log p t ( x ) ( s ( t ) σ ( t ) ) 2 f t · ( s ( t ) σ ( t ) ) 2 Δ t .
Using the iterative relationship in Equation (15), we have:
( s ( t ) s ( t ) f t Δ t ) x p s ( t Δ t ) x p .
Furthermore, from Equation (15), we derive:
( s ( t ) σ ( t ) ) 2 f t · ( s ( t ) σ ( t ) ) 2 Δ t s ( t ) s ( t Δ t ) σ ( t ) 2 .
Substituting these back into Equation (16), we obtain:
x t Δ t det = s ( t Δ t ) x p x log p t ( x ) s ( t ) s ( t Δ t ) σ ( t ) 2 g ( t ) 2 s ( t ) s ( t Δ t ) Δ t 2 .
For any continuously differentiable function s ( t ) , the property s ( t Δ t ) s ( t + Δ t ) = s ( t ) 2 + O ( Δ t 2 ) holds. By shifting the time index to t + 1 2 Δ t , we approximate:
s ( t ) s ( t Δ t ) s t + 1 2 Δ t 2 .
Substituting Equation (13) into the bracketed term in Equation (19), it simplifies as:
σ ( t ) 2 g ( t ) 2 s ( t ) s ( t Δ t ) Δ t 2 σ t + Δ t 2 2 σ ( t ) σ ( t Δ t ) .
Combining Equations (12), (14), and (21) into Equation (19), we derive:
x t Δ t det = s ( t Δ t ) x p + Σ ( t Δ t ) ϵ p .
Now, we reintroduce the noise terms from Equation (9):
x t Δ t = s ( t Δ t ) x p + Σ ( t Δ t ) ϵ p + σ t Δ t ϵ + 1 2 σ t 2 x log p t ( x ) Δ t .
Utilizing Equation (14), we substitute the score term:
x t Δ t s ( t Δ t ) x p + Σ ( t Δ t ) 1 1 2 σ t 2 Σ ( t Δ t ) 2 Δ t ϵ p + σ t Δ t ϵ .
Applying the first-order Taylor expansion 1 x = 1 1 2 x + O ( x 2 ) to Equation (24), we arrive at:
x t Δ t s ( t Δ t ) x p + Σ ( t Δ t ) 1 σ t 2 Σ ( t Δ t ) 2 Δ t ϵ p + σ t Δ t ϵ = s ( t Δ t ) x p + Σ ( t Δ t ) 2 σ t 2 Δ t ϵ p + σ t Δ t ϵ .
This concludes the proof.    □
Leveraging the fact that σ t is an arbitrary parameter, we replace the scaling term σ t Δ t with σ t . Consequently, Equation (8) is reformulated as:
x t Δ t = s ( t Δ t ) x p + Σ ( t Δ t ) 2 σ t 2 ϵ p + σ t ϵ .
We employ Equation (26) to overcome the limitations of DDCM—specifically, the rigid step size and non-adjustable noise injection levels mandated by Equation (3). This modification naturally raises critical implementation questions regarding the magnitude of noise injection, the determination of forward iteration step sizes, and the definition of the start ( T s ) and end ( T e ) time steps.

3.4.2. Discrete Encoding-Based Membership Inference Attack

Let T s and T e denote the start and end time steps of the iteration process, respectively. We redefine the discrete time step at the n-th iteration, denoted as t n (formerly t Δ t ). Given a total of N iterations, t n is defined as:
t n = n N ( T e T s ) + T s .
Since the start time is not T, we need a strategy to initialize the x t d . To determine the optimal initialization strategy, we investigate two distinct initialization functions, denoted as I ( x t ) . These are defined as follows:
I ( x 0 , t ) = ( 1 2 s ( t ) ) 2 + Σ ( t ) 2 ϵ ,
and:
I ( x 0 , t ) = s ( t ) x 0 + Σ ( t ) ϵ ,
where the noise vector is selected from the codebook to maximize alignment with the data: ϵ = arg max ϵ C g ( x 0 · ϵ ) .
For σ t , we govern the noise parameter σ t via a time-dependent variable t d :
σ t ( t d , t n ) = 1 α ¯ t n α ¯ t n t d .
To regulate the variation of the noise level, inspired by the EDM framework [57], we establish maximum and minimum time ratios, r max and r min , respectively. The variable t d is iterated in descending order from T s · r m a x to T s · r m a x r m i n . Denoting Δ m a x = T s · r m a x , Δ m i n = T s · r m a x r m i n and P = Δ m a x Δ m i n represent the range, the number of iterations allocated to each time step t d is determined by the function:
r ( t d , σ max , ρ , T s , Δ m i n , Δ m a x , P , N ) = 1 + L ( t d Δ m i n ) · ( σ m a x 1 / ρ 1 ) ρ i 1 + L ( i ) · ( σ m a x 1 / ρ 1 ) ρ N ,
where L ( i ) = l ( i , Δ m i n , Δ m a x ) = log Δ m a x log ( Δ m i n + i ) log Δ m a x log Δ m i n . For the noise injection mechanism, we select the noise vector ϵ t d that maximizes alignment with the residual:
ϵ t d = arg max ϵ C g ( x 0 x p ) · ϵ ,
where the codebook C g is parameterized by a grid size g and is regenerated after each iteration.
We record the model outputs x t n at step t n and the corresponding noise vectors ϵ t n at each iteration. Using a window size W, we compute the moving averages of these sequences, denoted as { x t n w } and { ϵ t n w } . Zero-padding is applied where the sequence length is insufficient to fill the window. Finally, given a decision threshold τ and target step t a , we classify a sample as a member of the training set if either of the following criteria is met:
ϵ t a w p < τ ,
or:
x t a w x 0 p < τ .
We term our proposed algorithm the Discrete Encoding-Based membership inference attack (DEB). The corresponding pseudocode is presented in Algorithm 1, and Figure 2 displays the overview of DEB.
Algorithm 1 Discrete Encoding-Based Membership Inference Attack
1: Input: The start time T s , the end time T e , maximum noise time ratio r m a x , minimum noise time ratio r m i n , σ m a x and ρ for function r, total iteration number N, threshold τ , sample x 0 , DDPM model θ ( x t , t ) , init function I ( x 0 , t ) , codebook size K and codebook grid size g, attack time t a , window size W, norm p.
2: Output: if x 0 is in member set.
3: σ t _list = [], Δ m a x = T s · r m a x , Δ m i n = T s · r m a x r m i n , t d = Δ m a x , P = Δ m a x Δ m i n
4: repeat
5:     t d _list.append([ t d ] * r ( t d , σ m a x , ρ , T s , Δ m i n , Δ m a x , P , N ) ) ▹ Equation (31)
6:     t d = t d 1
7: until  t d == T s · r m a x r min
8: sample C g
9: n = 0 , t n = T s , x t n = I ( x 0 , t n , C g ) ▹ Equation (28) or Equation (29)
10: x p _list = [], ϵ p _list = []
11: repeat
12:     n = n + 1
13:    sample C g
14:     t n = n N ( T e T s ) + T s ▹ Equation (27)
15:     t d = t d _list[n]
16:     x p , ϵ p = θ ( x t n , t n )
17:     ϵ t d = arg max ϵ t d C g ( x 0 x p ) · ϵ t d ▹ Equation (32)
18:     σ t d = σ t ( t d , t n ) ▹ Equation (30)
19:     x t n = s ( t n ) x p + Σ ( t n ) 2 σ t d 2 ϵ p + σ t d ϵ t d
20:     x p _list.append( x p ), ϵ p _list.append( ϵ p )
21: until  n = = N
22: do DDIM
23: apply windowed averaging with size W to x p _list and ϵ p _list.
24: target = x p _list[ t a ] p or target = ϵ p _list[ t a ] p
25: if target < τ  then
26:    return True
27: else
28:    return False
29: end if

4. Results

4.1. Attack Performance on Medical Images

We present the comprehensive evaluation results on the MedMNIST2D benchmark in Table 3. To ensure a rigorous comparison, we optimized the baselines (Loss, SecMI, PIA, and SimA) by conducting a grid search over their hyperparameters and reporting the best results. For our proposed DEB method, we maintain a parameter configuration consistent with that used for natural images (DDPM settings), limiting our search space exclusively to the attack target time t a .
As observed in our evaluations (Table 3), the susceptibility of models to membership inference attacks is highly correlated with the specific data modality. There are significant performance discrepancies across different datasets; for instance, models trained on ChestMNIST exhibit near-complete vulnerability, whereas those trained on PathMNIST demonstrate greater resilience.
To mitigate the risk of overestimating vulnerability due to potential instability in attack performance across different training subsets, we conducted a rigorous evaluation using six distinct data splits of the ChestMNIST dataset (Table 4). For each split, we trained an independent target model and subsequently evaluated the attack efficacy. As demonstrated in our results, the attack performance exhibits remarkable consistency across all six models. Especially, the AUC scores remain highly stable. This confirms that the observed vulnerabilities are intrinsic to the model and data modality rather than statistical anomalies arising from specific data sampling.
To investigate whether the variance in vulnerability across modalities simply stems from differing degrees of overfitting, we analyze the relationship between training loss and attack performance. Generally, for models of identical architecture trained on datasets of the same scale, the loss function can serve as a proxy for overfitting. However, as illustrated in Figure 3, there is no definitive correlation between the loss magnitude and empirical robustness. Notably, while OrganAMNIST presents the highest training loss, it is the second most vulnerable dataset. This further substantiates that attack efficacy is predominantly governed by the intrinsic characteristics of the medical imaging modality.
Furthermore, our proposed DEB method consistently demonstrates superior performance on more challenging datasets, such as TissueMNIST and PathMNIST (Table 3 and Table 5). This effectiveness is fundamentally tied to our attack methodology, which relies on the injection of semantic noise. Consequently, DEB necessitates that the target model has successfully learned robust, semantic-level features to be effective. In scenarios involving datasets with smaller scales where the model fails to capture comprehensive semantic representations, DEB may yield suboptimal results.
Another critical factor influencing model robustness is the application of data augmentation. A comparative analysis between models trained with RandomHorizontalFlip data augmentation (Table 3) and those trained without this augmentation (Table 5) reveals a stark contrast. Models incorporating this augmentation exhibit significantly enhanced robustness against MIAs. This underscores the profound impact of data augmentation strategies on the privacy profile of medical imaging models. We strongly advise model developers to rigorously evaluate how different data augmentations affect empirical robustness during the model design phase.
To confirm that our findings at the standard 28 × 28 resolution are indicative of real-world scenarios, we extended our evaluation to 64 × 64 resolution images (Table 6). The attack performance remains highly consistent across both resolutions. Moreover, according to Table 1, the classification accuracy of ResNet architectures on 224 × 224 images differs from the 28 × 28 images by only a marginal factor, typically within 2%. This minimal discrepancy validates that our evaluations at the 28 × 28 resolution provide highly meaningful and transferable insights. We plan to systematically evaluate larger resolution datasets in future work.
Finally, we contextualize the applicable scenarios for our proposed attack. Our attack requires grey-box access, specifically the ability to query the model’s inputs and outputs during the generation process, and the grey-box attack cannot apply to pipelines which can only access the generated images. In the realm of diffusion models, numerous downstream applications—such as image classification [58] and image inpainting [29]—leverage the intermediate outputs of pre-trained generation processes. Consequently, model providers may expose these intermediate APIs to facilitate broader applicability. While adding noise to the output is a common defensive heuristic, we argue it is fundamentally unsuitable for medical domains. For diffusion models, multi-step iterative processes inherently amplify injected noise. More critically, perturbing medical images can induce fatal diagnostic errors, posing unacceptable risks of misdiagnosis to both practitioners and patients. Instead, as demonstrated by our earlier analysis, applying appropriate data augmentation strategies (such as RandomHorizontalFlip) during the training phase serves as a highly effective and non-destructive defense mechanism to inherently enhance the model’s resistance to MIAs. Given that the aforementioned applications typically utilize pre-trained models with low adaptation costs, we recommend that model providers refrain from exposing intermediate APIs unless strictly necessary. For specific client requirements, a joint-development paradigm with users that restricts API exposure to solely the final outputs can significantly enhance model security without compromising clinical utility.

4.2. Attack Performance on Natural Images

We summarize the performance on standard natural image benchmarks (CIFAR-10, CIFAR-100, and TinyImageNet) in Table 7. DEB demonstrates a substantial performance advantage over existing methods. On CIFAR-10, DEB achieves a T1F of 60.3%, significantly outperforming the baseline SimA (35.9%). Similar improvements are observed on CIFAR-100 and TinyImageNet. It is important to acknowledge that DEB utilizes a higher query budget (180 queries) compared to baselines like PIA or SimA. However, in the context of grey-box MIA, such a query magnitude is practically feasible, making the significant gain in attack performance a worthwhile trade-off.
We further extend our evaluation to the text-to-image domain using Stable Diffusion on the Pokemon dataset, as detailed in Table 8. Following the experiment setting established in CLiD [27], we assess two distinct training scenarios: a “weak overfitting” setting trained for 150,000 steps, and a “realistic finetuning” setting trained for 7500 steps.
In the weak overfitting scenario, DEB remains highly competitive. While CLiD achieves the highest performance (97.8% T1F), it is subject to severe constraints: it is exclusively applicable to text-to-image models and necessitates access to the groundtruth text prompts. In contrast, DEB is a modality-agnostic approach. Notably, even when we remove the text condition entirely—denoted as DEB (none)—our method still delivers robust performance. In the realistic fine-tuning setting, where overfitting is minimal, DEB (none) achieves a T1F of 31.0%, which is comparable to the supervised DEB (30.0%) and significantly higher than standard baselines. This highlights the ability of DEB, proving its effectiveness even in unconditional settings where specialized methods like CLiD are inapplicable.

4.3. Necessity of the Codebook Strategy

When initializing the diffusion process with the Equation (29), we observe that if the time step t is set to a small value, the noised samples retain a significant portion of the original semantic information. This observation raises a question: Can we simply rely on adding random Gaussian noise around the noised samples to consistently recover the target, thereby obviating the need for a codebook-based noise selection mechanism? To address this question and demonstrate the necessity of the codebook strategy, we conduct the following comparative experiments by injecting random noise:
  • Type-1, Continuous Random Perturbation: We initialize the sample x t by sampling from the distribution x t p t ( x t | x 0 ) p d a t a ( x 0 ) (i.e., adding noise to the original sample). In each iteration, we inject random Gaussian noise, perform a denoising step via the model, and then re-inject new noise for the subsequent step. Throughout this process, we record the model outputs and the reconstructed samples at each step.
  • Type-2, Perturbation with Re-initialization: This setup shares the same initialization as the first method. However, to prevent the sample trajectory from deviating significantly from the original data point due to cumulative noise injection, we explicitly re-initialize the sample to the starting state x t after each denoising step. We similarly record the model outputs for each iteration.
Following the iterative perturbation phase described above, both methods proceed to execute a DDIM process. We record the intermediate results of this final denoising phase and incorporate them into the calculation of the AUC.
The quantitative results of these ablation studies are summarized in Table 9. We observe that Type-1 (Continuous Random Perturbation) consistently outperforms Type-2 (Perturbation with Re-initialization) across all tested datasets. For instance, on CIFAR-10, Type-1 achieves an AUC of 85.4%, surpassing Type-2 by 3.1%. This suggests that allowing the sample to drift and explore the local manifold via continuous noise injection provides a more informative signal than the constrained re-initialization approach.
However, a substantial performance gap becomes evident when comparing these random noise strategies with our proposed DEB method. Despite Type-1 representing the optimal random perturbation baseline, it falls significantly short of the performance achieved by DEB. Referring back to the main results in Table 7, DEB attains an AUC of 93.4% on CIFAR-10, outperforming the random noise approach (Type-1) by a remarkable margin of 8.0%. Similar performance deficits are observed on CIFAR-100 and TinyImageNet. This empirical evidence underscores the limitation of unguided Gaussian noise: while it can perturb the sample, it lacks the directional specificity required to fully exploit the model’s memory. Consequently, the codebook-based strategy, which selects noise vectors that maximize alignment with the residuals, is proven to be strictly necessary for achieving better inference performance.

4.4. Parameters’ Sensitivity Analysis

Given the stability of the parameters observed across modalities, we utilized natural images as the primary testbed. To thoroughly evaluate the robustness of DEB and identify the optimal hyperparameter configuration, we conducted a sensitivity analysis on the CIFAR-10, CIFAR-100, and TinyImageNet datasets. In these experiments, we adopted a control variable approach: when analyzing specific parameters, all other hyperparameters were held constant. To expedite the evaluation process while ensuring statistical significance, we utilized a randomly sampled subset of 1024 samples (512 members and 512 non-members) rather than the full validation set for these ablation studies.
Impact of Noise Scheduling ( ρ , σ m a x , r m a x , r m i n ). We examined the parameters governing the noise allocation function r ( · ) defined in Equation (31). As shown in Figure 4, the attack performance is sensitive to the time ratio range determined by r m a x . Generally, a larger r m a x yields higher AUC, implying that aggregating information across a larger noise level enhances robustness. In contrast, the parameters ρ and σ m a x exhibit high stability. As visualized in Figure 5, varying these parameters results in minimal fluctuations in AUC. We attribute this to the design of our iteration allocation function (Equation (31)): within the loop from Δ m a x to Δ m i n , the function ensures that at least one iteration is performed for each step. This mechanism effectively mitigates the sensitivity to ρ and σ m a x , particularly when r m a x is sufficiently large.
Impact of Codebook Hyperparameters ( K , g ). The parameters of the codebook play a crucial role in noise injection. Figure 6a demonstrates that increasing the codebook size K improves performance up to a saturation point (around K = 64 , K = 128 or 256), after which the gains diminish. Regarding the grid size g, Figure 6b shows that for low-resolution datasets like CIFAR ( 32 × 32 ), g = 2 yields the optimal performance. Notably, in our experiments with the Stable Diffusion model (resolution 512 × 512 ), we observed that a larger grid size ( g = 4 ) outperforms g = 2 . This indicates a positive correlation between the optimal grid size and the image resolution: larger images require a larger grid to effectively capture the discriminative information during noise selection.
Impact of Time Configuration ( T s , T e ). First, regarding the start ( T s ) and end ( T e ) time steps of the attack, our preliminary experiments on CIFAR-10 revealed that the performance difference between the setting T s = T e and T s T e is negligible. Consequently, we adopted the simplified configuration T s = T e for all subsequent experiments. We further investigated the impact of the specific choice of T s , as illustrated in Figure 7a. The results indicate an inverted U-shaped trend: performance peaks when T s is set within the range of [ 100 , 200 ] and degrades significantly as T s approaches either 0 or the maximum timestep T. This suggests that the membership signal is most prominent in the early-to-intermediate stages of the reverse diffusion process, whereas pure noise ( T 1000 ) or near-clean data ( T 0 ) contain less discriminative information.
Impact of Window Size (W). Finally, we analyze the effect of the window size W used for averaging the outputs. As shown in Figure 7b, the AUC increases rapidly as W grows from 1 to approximately 100, validating our hypothesis that accumulating statistical information over multiple steps significantly reduces variance compared to single-step attacks. Beyond this point, the performance plateaus, suggesting that a window size covering the most signal-rich temporal region is sufficient for effective membership inference.
Our sensitivity analysis reveals consistent behavioral patterns across all three datasets, demonstrating the stability of the proposed method. The performance of DEB is primarily governed by four key hyperparameters: the start time T s , the maximum time ratio r m a x , the window size W, and the codebook grid size g. Importantly, these parameters exhibit distinct and predictable regularities: T s should be selected to target the early-to-intermediate diffusion stages where membership signals are strongest; r m a x and W should be sufficiently large to maximize the accumulation of trajectory information; and g must be scaled in accordance with the image resolution. Conversely, other parameters such as ρ and σ m a x show minimal impact on the final results, further attesting to the robustness of DEB and its ease of deployment.

4.5. Settings of Hyperparameters

In evaluating our proposed DEB method, we established two sets of hyperparameters based on the target model architecture, as detailed in Table 10. Specifically, we applied one unified parameter configuration across all experiments involving the DDPM architecture (encompassing both natural and medical datasets at 32 × 32 and 64 × 64 resolutions). Similarly, we employed a second, unified set of parameters for all experiments utilizing the Stable Diffusion model. The only exception to these fixed configurations is the attack target time, t a . To determine the optimal t a , we utilized a validation split consisting of 256 member samples and 256 non-member samples, maintaining similar evaluation protocols described in [33,35]. To ensure a strictly fair comparison, the hyperparameter tuning for all baseline methods was conducted using this identical sample size.
Furthermore, we detail the model training hyperparameters and the associated computational overhead for the DDPM architecture in Table 11. We report the specific model configurations, GPU memory allocation, and total training time consumption for both 32 × 32 and 64 × 64 image resolutions. Alongside the training costs, we also record the resource consumption required to execute our attack method. Although DEB intrinsically requires a higher number of query iterations compared to standard baseline methods, the empirical results demonstrate that the overall attack duration and GPU memory requirements (e.g., 40 s and 5 GB RAM for a batch size of 128 at the 32 × 32 resolution) remain highly manageable and computationally tractable for practical execution.

5. Discussion and Conclusions

In this paper, we presented a comprehensive evaluation of the membership inference privacy vulnerabilities of diffusion models across both natural and medical imaging domains. To address the limitations of existing grey-box attacks, we proposed the Discrete Encoding-Based membership inference attack (DEB). Our extensive evaluation—spanning standard natural image benchmarks, text-to-image models, and a refined subset of the MedMNIST benchmark—reveals that the susceptibility of diffusion models to membership inference is highly dependent on the specific data modality. We hypothesize that this variance in vulnerability arises from the distinct semantic variability and unique visual patterns inherent to different imaging distributions. Crucially, DEB significantly outperforms existing baselines by leveraging codebook-based noise injection to exploit the stability of samples. This capability is particularly evident on challenging datasets and in unconditional text-to-image settings where conventional methods severely struggle, demonstrating DEB’s effectiveness. Furthermore, because the attack frameworks in this paper actively exploit the intermediate states of the generation process, we strongly advise diffusion model providers to carefully evaluate the privacy risks associated with their API designs. Whenever feasible, providers should restrict access to intermediate generation steps to mitigate the threat of advanced membership inference attacks. Collectively, this study proposes a highly effective new MIA method and highlights the urgent need for robust, modality-aware defense mechanisms for diffusion models across diverse applications.
Limitations and Future Work. Despite its effectiveness, DEB requires a relatively higher query budget compared to single-step methods like SimA, primarily due to the need for computing statistical averages over the outputs. While this overhead is acceptable in typical grey-box auditing scenarios, it may constrain real-time applications. Future work will focus on optimizing the sampling efficiency of DEB, potentially by developing adaptive windowing strategies and new noise injection scheduler to reduce the query count without compromising inference accuracy. Additionally, extending the evaluation to 3D medical diffusion models is also a valuable field.

Author Contributions

F.K. designed the methodology and performed analysis, writing, review and editing. H.C. performed analysis, writing, review and editing. T.C. performed analysis, writing, review and editing. X.S. performed analysis, writing, review and editing. C.Y. performed analysis, writing, review and editing. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

All datasets are public. MedMNIST is available on https://medmnist.com/ (accessed on 24 January 2026). CIFAR10 and CIFAR100 are available on https://www.cs.toronto.edu/~kriz/cifar.html (accessed on 24 January 2026). TinyImageNet is available on https://www.image-net.org/ (accessed on 24 January 2026). Pokemon is available on https://github.com/jinhaoduan/SecMI-LDM (accessed on 24 January 2026).

DURC Statement

Current research is limited to the field of deep learning security and medical image privacy, which is beneficial for evaluating the membership inference privacy vulnerabilities of diffusion models and facilitating the development of robust privacy-preserving mechanisms for sensitive healthcare data, and does not pose a threat to public health or national security. Authors acknowledge the dual-use potential of the research involving membership inference attacks against diffusion models and confirm that all necessary precautions have been taken to prevent potential misuse. As an ethical responsibility, authors strictly adhere to relevant national and international laws about DURC. Authors advocate for responsible deployment, ethical considerations, regulatory compliance, and transparent reporting to mitigate misuse risks and foster beneficial outcomes.

Acknowledgments

Gemini3-pro is used only for writing.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
DDPMDenoising Diffusion Probabilistic Model
T1F True Positive Rate (TPR) at a fixed False Positive Rate (FPR) of 1% (TPR @ 1% FPR)
MIAMembership Inference Attack

References

  1. Ho, J.; Jain, A.; Abbeel, P. Denoising diffusion probabilistic models. In Proceedings of the 34th Conference on Neural Information Processing Systems (NeurIPS 2020), Vancouver, Canada, 6–12 December 2020; pp. 6840–6851. [Google Scholar]
  2. Rombach, R.; Blattmann, A.; Lorenz, D.; Esser, P.; Ommer, B. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, Denver, CO, USA, 2–6 June 2022; pp. 10684–10695. [Google Scholar]
  3. Ramesh, A.; Dhariwal, P.; Nichol, A.; Chu, C.; Chen, M. Hierarchical text-conditional image generation with clip latents. arXiv 2022, arXiv:2204.06125. [Google Scholar] [CrossRef] [Scilit]
  4. Saharia, C.; Chan, W.; Saxena, S.; Li, L.; Whang, J.; Denton, E.L.; Ghasemipour, K.; Gontijo Lopes, R.; Karagol Ayan, B.; Salimans, T.; et al. Photorealistic text-to-image diffusion models with deep language understanding. In Proceedings of the 36th Conference on Neural Information Processing Systems (NeurIPS 2022), New Orleans, LA, USA, 28 November–9 December 2022; pp. 36479–36494. [Google Scholar]
  5. Goodfellow, I.; Pouget-Abadie, J.; Mirza, M.; Xu, B.; Warde-Farley, D.; Ozair, S.; Courville, A.; Bengio, Y. Generative adversarial networks. Commun. ACM 2020, 63, 139–144. [Google Scholar] [CrossRef] [Scilit]
  6. Brock, A.; Donahue, J.; Simonyan, K. Large Scale GAN Training for High Fidelity Natural Image Synthesis. In Proceedings of the International Conference on Learning Representations, New Orleans, LA, USA, 6–9 May 2019. [Google Scholar]
  7. Zhang, H.; Zhang, Z.; Odena, A.; Lee, H. Consistency Regularization for Generative Adversarial Networks. In Proceedings of the International Conference on Learning Representations, Addis Ababa, Ethiopia, 26–30 April 2020. [Google Scholar]
  8. Gulrajani, I.; Ahmed, F.; Arjovsky, M.; Dumoulin, V.; Courville, A.C. Improved training of wasserstein gans. In Proceedings of the 31st Annual Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, California, USA, 4–9 December 2017; Volume 30. [Google Scholar]
  9. Kingma, D.P.; Welling, M. Auto-encoding variational bayes. arXiv 2013, arXiv:1312.6114. [Google Scholar]
  10. Bieder, F.; Wolleb, J.; Durrer, A.; Sandkühler, R.; Cattin, P.C. Diffusion models for memory-efficient processing of 3d medical images. arXiv 2023, arXiv:2303.15288. [Google Scholar] [CrossRef] [Scilit]
  11. Kim, B.; Oh, Y.; Ye, J.C. Diffusion Adversarial Representation Learning for Self-supervised Vessel Segmentation. In Proceedings of the International Conference on Learning Representations, Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
  12. Rahman, A.; Valanarasu, J.M.J.; Hacihaliloglu, I.; Patel, V.M. Ambiguous medical image segmentation using diffusion models. In Proceedings of the IEEE/CVF conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 18–22 June 2023; pp. 11536–11546. [Google Scholar]
  13. Wang, X.; Shen, Z.; Song, Z.; Wang, S.; Liu, M.; Zhang, L.; Xuan, K.; Wang, Q. Arbitrary reduction of MRI inter-slice spacing using hierarchical feature conditional diffusion. In Machine Learning in Medical Imaging, Proceedings of the 14th International Workshop, MLMI 2023, Held in Conjunction with MICCAI 2023, Vancouver, BC, Canada, 8 October 2023, Proceedings, Part I; Springer: Cham, Switzerland, 2023; pp. 23–32. [Google Scholar]
  14. Chung, H.; Lee, E.S.; Ye, J.C. MR image denoising and super-resolution using regularized reverse diffusion. IEEE Trans. Med Imaging 2022, 42, 922–934. [Google Scholar] [CrossRef] [Scilit]
  15. Levac, B.; Jalal, A.; Tamir, J.I. Accelerated motion correction for MRI using score-based generative models. In Proceedings of the IEEE International Symposium on Biomedical Imaging, Cartagena, Colombia, 18-21 April 2023; IEEE: New York, NY, USA, 2023; pp. 1–5. [Google Scholar]
  16. Chung, H.; Ye, J.C. Score-based diffusion models for accelerated MRI. Med. Image Anal. 2022, 80, 102479. [Google Scholar] [CrossRef] [Scilit]
  17. Li, H.; Ditzler, G.; Roveda, J.; Li, A. Descod-ecg: Deep score-based diffusion model for ecg baseline wander and noise removal. IEEE J. Biomed. Health Inform. 2023, 28, 5081–5091. [Google Scholar] [CrossRef] [Scilit]
  18. Lyu, Q.; Wang, G. Conversion between CT and MRI images using diffusion and score-matching models. arXiv 2022, arXiv:2209.12104. [Google Scholar] [CrossRef] [Scilit]
  19. Li, Y.; Shao, H.C.; Liang, X.; Chen, L.; Li, R.; Jiang, S.; Wang, J.; Zhang, Y. Zero-shot medical image translation via frequency-guided diffusion models. IEEE Trans. Med Imaging 2023, 43, 980–993. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  20. Liu, J.; Anirudh, R.; Thiagarajan, J.J.; He, S.; Mohan, K.A.; Kamilov, U.S.; Kim, H. Dolce: A model-based probabilistic diffusion framework for limited-angle ct reconstruction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Paris, France, 2–6 October 2023; pp. 10498–10508. [Google Scholar]
  21. Wiggins, W.F.; Tejani, A.S. On the opportunities and risks of foundation models for natural language processing in radiology. Radiol. Artif. Intell. 2022, 4, e220119. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  22. Ihalainen, J. Computer creativity: Artificial intelligence and copyright. J. Intellect. Prop. Law Pract. 2018, 13, 724–728. [Google Scholar] [CrossRef] [Scilit]
  23. Usynin, D.; Rueckert, D.; Kaissis, G. Beyond gradients: Exploiting adversarial priors in model inversion attacks. ACM Trans. Priv. Secur. 2023, 26, 1–30. [Google Scholar] [CrossRef] [Scilit]
  24. Wu, M.; Zhang, X.; Ding, J.; Nguyen, H.; Yu, R.; Pan, M.; Wong, S.T. Evaluation of inference attack models for deep learning on medical data. arXiv 2020, arXiv:2011.00177. [Google Scholar] [CrossRef] [Scilit]
  25. Gupta, U.; Stripelis, D.; Lam, P.K.; Thompson, P.; Ambite, J.L.; Ver Steeg, G. Membership inference attacks on deep regression models for neuroimaging. In Proceedings of the Medical Imaging with Deep Learning, Lübeck, Germany, 7-9 July 2021; PMLR: New York, NY, USA, 2021; pp. 228–251. [Google Scholar]
  26. Shokri, R.; Stronati, M.; Song, C.; Shmatikov, V. Membership inference attacks against machine learning models. In Proceedings of the IEEE Symposium on Security and Privacy, San Jose, CA, USA, 22-26 May 2017; IEEE: New York, NY, USA, 2017; pp. 3–18. [Google Scholar]
  27. Zhai, S.; Chen, H.; Dong, Y.; Li, J.; Shen, Q.; Gao, Y.; Su, H.; Liu, Y. Membership inference on text-to-image diffusion models via conditional likelihood discrepancy. In Proceedings of the 38th Conference on Neural Information Processing Systems (NeurIPS 2024), Vancouver, BC, Canada, 9–15 December 2024; Volume 37, pp. 74122–74146. [Google Scholar]
  28. Carlini, N.; Hayes, J.; Nasr, M.; Jagielski, M.; Sehwag, V.; Tramer, F.; Balle, B.; Ippolito, D.; Wallace, E. Extracting training data from diffusion models. In Proceedings of the 32nd USENIX Security Symposium (USENIX Security 23), Anaheim, CA, USA, 9–11 August 2023; pp. 5253–5270. [Google Scholar]
  29. Lugmayr, A.; Danelljan, M.; Romero, A.; Yu, F.; Timofte, R.; Van Gool, L. Repaint: Inpainting using denoising diffusion probabilistic models. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 11461–11471. [Google Scholar]
  30. Yeom, S.; Giacomelli, I.; Fredrikson, M.; Jha, S. Privacy risk in machine learning: Analyzing the connection to overfitting. In Proceedings of the IEEE Computer Security Foundations Symposium, Oxford, UK, 9-12 July 2018; IEEE: New York, NY, USA, 2018; pp. 268–282. [Google Scholar]
  31. Matsumoto, T.; Miura, T.; Yanai, N. Membership inference attacks against diffusion models. In Proceedings of the IEEE Security and Privacy Workshops, San Francisco, CA, USA, 25 May 2023; IEEE: New York, NY, USA, 2023; pp. 77–83. [Google Scholar]
  32. Hu, H.; Pang, J. Membership inference of diffusion models. arXiv 2023, arXiv:2301.09956. [Google Scholar]
  33. Duan, J.; Kong, F.; Wang, S.; Shi, X.; Xu, K. Are diffusion models vulnerable to membership inference attacks? In Proceedings of the 40th International Conference on Machine Learning, Honolulu, HI, USA, 23-29 July 2023; PMLR: New York, NY, USA, 2023; pp. 8717–8730. [Google Scholar]
  34. Song, J.; Meng, C.; Ermon, S. Denoising Diffusion Implicit Models. In Proceedings of the 9th International Conference on Learning Representations, Virtual Event, Austria, 3–7 May 2021. [Google Scholar]
  35. Kong, F.; Duan, J.; Ma, R.; Shen, H.T.; Shi, X.; Zhu, X.; Xu, K. An Efficient Membership Inference Attack for the Diffusion Model by Proximal Initialization. In Proceedings of the 12th International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024. [Google Scholar]
  36. Rao, M.; Qu, B.; Moyer, D. Score-based Membership Inference on Diffusion Models. arXiv 2025, arXiv:2509.25003. [Google Scholar] [CrossRef] [Scilit]
  37. Ohayon, G.; Manor, H.; Michaeli, T.; Elad, M. Compressed Image Generation with Denoising Diffusion Codebook Models. In Proceedings of the 42nd International Conference on Machine Learning, Vancouver, BC, Canada, 13–19 July 2025. [Google Scholar]
  38. Song, Y.; Sohl-Dickstein, J.; Kingma, D.P.; Kumar, A.; Ermon, S.; Poole, B. Score-based generative modeling through stochastic differential equations. arXiv 2020, arXiv:2011.13456. [Google Scholar]
  39. Kaya, Y.; Hong, S.; Dumitras, T. On the effectiveness of regularization against membership inference attacks. arXiv 2020, arXiv:2006.05336. [Google Scholar]
  40. Kaya, Y.; Dumitras, T. When does data augmentation help with membership inference attacks? In Proceedings of the International Conference on Machine Learning, Virtual, 18-24 July 2021; PMLR: New York, NY, USA, 2021; pp. 5345–5355. [Google Scholar]
  41. Yin, Y.; Chen, K.; Shou, L.; Chen, G. Defending privacy against more knowledgeable membership inference attackers. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, Virtual Event Singapore, 14–18 August 2021; Association for Computing Machinery: New York, NY, USA, 2021; pp. 2026–2036. [Google Scholar]
  42. Huang, H. Defense against membership inference attack applying domain adaptation with addictive noise. J. Comput. Commun. 2021, 9, 92–108. [Google Scholar] [CrossRef]
  43. Huang, H.; Luo, W.; Zeng, G.; Weng, J.; Zhang, Y.; Yang, A. DAMIA: Leveraging domain adaptation as a defense against membership inference attacks. IEEE Trans. Dependable Secur. Comput. 2021, 19, 3183–3199. [Google Scholar] [CrossRef] [Scilit]
  44. Mazzone, F.; Van Den Heuvel, L.; Huber, M.; Verdecchia, C.; Everts, M.; Hahn, F.; Peter, A. Repeated knowledge distillation with confidence masking to mitigate membership inference attacks. In Proceedings of the 15th ACM Workshop on Artificial Intelligence and Security, Los Angeles, CA, USA, 11 November 2022; Association for Computing Machinery: New York, NY, USA, 2022; pp. 13–24. [Google Scholar]
  45. Zhang, T.; He, Z.; Lee, R.B. Privacy-preserving machine learning through data obfuscation. arXiv 2018, arXiv:1807.01860. [Google Scholar] [CrossRef] [Scilit]
  46. Wang, C.; Liu, G.; Huang, H.; Feng, W.; Peng, K.; Wang, L. MIASec: Enabling data indistinguishability against membership inference attacks in MLaaS. IEEE Trans. Sustain. Comput. 2019, 5, 365–376. [Google Scholar] [CrossRef] [Scilit]
  47. Webster, R.; Rabin, J.; Simon, L.; Jurie, F. Generating private data surrogates for vision related tasks. In Proceedings of the 2020 25th International Conference on Pattern Recognition (ICPR), Milan, Italy, 10-15 January 2021; IEEE: New York, NY, USA, 2021; pp. 263–269. [Google Scholar]
  48. Yang, R.; Ma, J.; Miao, Y.; Ma, X. Privacy-preserving generative framework for images against membership inference attacks. IET Commun. 2023, 17, 45–62. [Google Scholar] [CrossRef] [Scilit]
  49. Chen, J.; Guo, Y.; Zheng, Q.; Chen, H. Protect privacy of deep classification networks by exploiting their generative power. Mach. Learn. 2021, 110, 651–674. [Google Scholar] [CrossRef] [Scilit]
  50. Yang, J.; Shi, R.; Ni, B. MedMNIST Classification Decathlon: A Lightweight AutoML Benchmark for Medical Image Analysis. In Proceedings of the IEEE 18th International Symposium on Biomedical Imaging, Nice, France, 13-16 April 2021; IEEE: New York, NY, USA, 2021; pp. 191–195. [Google Scholar]
  51. Yang, J.; Shi, R.; Wei, D.; Liu, Z.; Zhao, L.; Ke, B.; Pfister, H.; Ni, B. MedMNIST v2-A large-scale lightweight benchmark for 2D and 3D biomedical image classification. Sci. Data 2023, 10, 41. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  52. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
  53. Krizhevsky, A.; Hinton, G. Learning Multiple Layers of Features from Tiny Images; Technical Report; University of Toronto: Toronto, ON, Canada, 2009. [Google Scholar]
  54. Deng, J.; Dong, W.; Socher, R.; Li, L.J.; Li, K.; Fei-Fei, L. Imagenet: A large-scale hierarchical image database. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Miami, FL, USA, 20-25 June 2009; IEEE: New York, NY, USA, 2009; pp. 248–255. [Google Scholar]
  55. Pinkney, J.N.M. Pokemon BLIP Captions. 2022. Available online: https://huggingface.co/datasets/lambdalabs/pokemon-blip-captions/ (accessed on 24 January 2026).
  56. Carlini, N.; Chien, S.; Nasr, M.; Song, S.; Terzis, A.; Tramer, F. Membership inference attacks from first principles. In Proceedings of the IEEE Symposium on Security and Privacy, San Francisco, CA, USA, 22-26 May 2022; IEEE: New York, NY, USA, 2022; pp. 1897–1914. [Google Scholar]
  57. Karras, T.; Aittala, M.; Aila, T.; Laine, S. Elucidating the Design Space of Diffusion-Based Generative Models. In Proceedings of the 36th Conference on Neural Information Processing Systems (NeurIPS 2022), New Orleans, LA, USA, 28 November–9 December 2022. [Google Scholar]
  58. Li, A.C.; Prabhudesai, M.; Duggal, S.; Brown, E.; Pathak, D. Your diffusion model is secretly a zero-shot classifier. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Paris, France, 2–6 October 2023; pp. 2206–2217. [Google Scholar]
Figure 1. Samples of different datasets in MedMNIST.
Figure 1. Samples of different datasets in MedMNIST.
Applsci 16 03140 g001
Figure 2. An overview of DEB.
Figure 2. An overview of DEB.
Applsci 16 03140 g002
Figure 3. The relationship between MIA performance metrics (AUC and T1F) and training loss.
Figure 3. The relationship between MIA performance metrics (AUC and T1F) and training loss.
Applsci 16 03140 g003
Figure 4. AUC performance with varying r m i n and r m a x .
Figure 4. AUC performance with varying r m i n and r m a x .
Applsci 16 03140 g004
Figure 5. AUC performance with varying ρ and σ m a x .
Figure 5. AUC performance with varying ρ and σ m a x .
Applsci 16 03140 g005
Figure 6. AUC performance with varying codebook size K and codebook grid g.
Figure 6. AUC performance with varying codebook size K and codebook grid g.
Applsci 16 03140 g006
Figure 7. AUC performance with varying start time T s and window size W.
Figure 7. AUC performance with varying start time T s and window size W.
Applsci 16 03140 g007
Table 1. Comparison between MedMNIST2D size 28 × 28 and 224 × 224 in metrics of AUC and ACC [50,51].
Table 1. Comparison between MedMNIST2D size 28 × 28 and 224 × 224 in metrics of AUC and ACC [50,51].
MethodsPathMNISTChestMNISTDermaMNISTOCTMNISTPneumoniaMNISTRetinaMNIST
AUC ACC AUC ACC AUC ACC AUC ACC AUC ACC AUC ACC
ResNet-18 (28)0.9830.9070.7680.9470.9170.7350.9430.7430.9440.8540.7170.524
ResNet-18 (224)0.9890.9090.7730.9470.9200.7540.9580.7630.9560.8640.7100.493
ResNet-50 (28)0.9900.9110.7690.9470.9130.7350.9520.7620.9480.8540.7260.528
ResNet-50 (224)0.9890.8920.7730.9480.9120.7310.9580.7760.9620.8840.7160.511
MethodsBreastMNISTBloodMNISTTissueMNISTOrganAMNISTOrganCMNISTOrganSMNIST
AUCACCAUCACCAUCACCAUCACCAUCACCAUCACC
ResNet-18 (28)0.9010.8630.9980.9580.9300.6760.9970.9350.9920.9000.9720.782
ResNet-18 (224)0.8910.8330.9980.9630.9330.6810.9980.9510.9940.9200.9740.778
ResNet-50 (28)0.8570.8120.9970.9560.9310.6800.9970.9350.9920.9050.9720.770
ResNet-50 (224)0.8660.8420.9970.9500.9320.6800.9980.9470.9930.9110.9750.785
Table 2. The data modality and the number of samples of all MedMNIST2D datasets.
Table 2. The data modality and the number of samples of all MedMNIST2D datasets.
NameData Modality# Samples# Training/Validation/Test
PathMNISTColon Pathology107,18089,996/10,004/7180
ChestMNISTChest X-Ray112,12078,468/11,219/22,433
DermaMNISTDermatoscope10,0157007/1003/2005
OCTMNISTRetinal OCT109,30997,477/10,832/1000
PneumoniaMNISTChest X-Ray58564708/524/624
RetinaMNISTFundus Camera16001080/120/400
BreastMNISTBreast Ultrasound780546/78/156
BloodMNISTBlood Cell Microscope17,09211,959/1712/3421
TissueMNISTKidney Cortex Microscope236,386165,466/23,640/47,280
OrganAMNISTAbdominal CT58,85034,581/6491/17,778
OrganCMNISTAbdominal CT23,66013,000/2392/8268
OrganSMNISTAbdominal CT25,22113,940/2452/8829
Table 3. MIA performance on a subset of the MedMNIST2D dataset. The best results are highlighted in bold, and the second-best results are underlined.
Table 3. MIA performance on a subset of the MedMNIST2D dataset. The best results are highlighted in bold, and the second-best results are underlined.
MethodsChestMNISTTissueMNISTOrganAMNISTOCTMNISTPathMNIST
AUC T1F AUC T1F AUC T1F AUC T1F AUC T1F
Loss98.351.457.41.186.415.889.613.053.91.2
SecMI99.793.873.51.989.626.987.113.463.21.1
PIA99.997.574.51.194.036.893.215.454.11.1
SimA99.484.070.41.291.930.693.314.164.91.2
DEB99.695.680.115.885.130.491.919.967.210.2
Table 4. Evaluation of MIA performance across six different data splits of the ChestMNIST dataset. The best results are highlighted in bold, and the second-best results are underlined.
Table 4. Evaluation of MIA performance across six different data splits of the ChestMNIST dataset. The best results are highlighted in bold, and the second-best results are underlined.
MethodsChestMNIST0ChestMNIST1ChestMNIST2
AUC T1F AUC T1F AUC T1F
Loss98.147.798.149.398.151.7
SecMI99.691.299.896.699.689.0
PIA99.794.699.896.899.895.4
SimA99.272.399.172.099.377.5
DEB99.695.999.694.999.594.2
MethodsChestMNIST3ChestMNIST4ChestMNIST5
AUCT1FAUCT1FAUCT1F
Loss98.250.398.252.998.249.8
SecMI99.998.099.792.799.895.0
PIA99.897.299.794.399.896.2
SimA99.377.999.273.899.171.1
DEB99.795.699.594.499.592.6
Table 5. MIA performance on subset of MedMNIST2D dataset (w/o RandomHorizontalFlip). The best results are highlighted in bold, and the second-best results are underlined.
Table 5. MIA performance on subset of MedMNIST2D dataset (w/o RandomHorizontalFlip). The best results are highlighted in bold, and the second-best results are underlined.
MethodsChestMNISTTissueMNISTOrganAMNISTOCTMNISTPathMNIST
AUC T1F AUC T1F AUC T1F AUC T1F AUC T1F
Loss100.0100.096.331.497.563.298.027.280.11.2
SecMI100.0100.097.954.198.271.798.127.937.41.2
PIA100.0100.098.358.199.486.698.126.359.01.7
SimA100.0100.097.322.099.386.098.229.062.11.6
DEB100.099.997.767.097.076.697.732.088.758.2
Table 6. MIA performance on ChestMNIST and PathMNIST at a 64 × 64 resolution (w/o RandomHorizontalFlip). The best results are highlighted in bold, and the second-best results are underlined.
Table 6. MIA performance on ChestMNIST and PathMNIST at a 64 × 64 resolution (w/o RandomHorizontalFlip). The best results are highlighted in bold, and the second-best results are underlined.
MethodsChestMNISTPathMNIST
AUC T1F AUC T1F
Loss100.0100.083.21.5
SecMI100.0100.083.54.3
PIA100.0100.086.212.3
SimA100.0100.085.810.1
DEB100.0100.088.669.6
Table 7. MIA performance on CIFAR-10, CIFAR-100, and TinyImageNet datasets. The best results are highlighted in bold, and the second-best results are underlined.
Table 7. MIA performance on CIFAR-10, CIFAR-100, and TinyImageNet datasets. The best results are highlighted in bold, and the second-best results are underlined.
MethodsCIFAR10CIFAR100TN-INQuery
AUC T1F AUC T1F AUC T1F
GAN-Leaks64.62.845.91.945.71.02000
Loss84.76.982.39.684.910.0 1
SecMI88.19.187.611.189.412.712
PIA88.513.789.419.689.617.12
SimA90.535.989.938.889.821.71
DEB93.460.394.358.195.673.9180
Table 8. MIA performance on the Stable Diffusion model under the Pokemon dataset. (none) means no groundthuth text. The best results are highlighted in bold, and the second-best results are underlined.
Table 8. MIA performance on the Stable Diffusion model under the Pokemon dataset. (none) means no groundthuth text. The best results are highlighted in bold, and the second-best results are underlined.
MethodsWeak OverfittingRealistic FinetuningQuery
AUC T1F AUC T1F
Loss79.66.066.02.821
SecMI89.17.260.00.8412
PIA87.510.060.02.642
SimA93.021.864.33.921
CLiD99.397.893.361.415
DEB97.586.883.230.0140
DEB (none)95.270.080.931.0140
Table 9. MIA performance of different noise injection type.
Table 9. MIA performance of different noise injection type.
CIFAR10CIFAR100TinyImageNet
Type-185.486.385.7
Type-282.383.183.0
Table 10. Summary of MIA hyperparameters for the DDPM and Stable Diffusion architectures.
Table 10. Summary of MIA hyperparameters for the DDPM and Stable Diffusion architectures.
HyperparametersModel
DDPM Stable Diffusion
K128128
g24
W200120
T s 120110
T e 120110
r m i n 0.030.45
r m a x 0.970.97
ρ 2.18
σ m a x 2.14
Table 11. Detailed DDPM training hyperparameters and corresponding computational resource consumption across different image resolutions.
Table 11. Detailed DDPM training hyperparameters and corresponding computational resource consumption across different image resolutions.
Hyperparameters32 × 3264 × 64
Optimizeradamadam
Optimizer-Schedulerconstantcosine
LR2 × 10 4 1 × 10 4
Training Steps800k800k
Batch Size128128
GPRRTX 4090RTX 4090
GPU RAM10.5 G24 G
Training Time1 d 14 h3 d 11 h
Precision32FP32FP
T10001000
ch_mult[1, 2, 2, 2][1, 1, 2, 2, 4, 4]
ch128128
β 1 1 × 10 4 1 × 10 4
β T 0.020.02
num_res_blocks22
attn[1][4]
Attack Time (bs 128)40 s120 s
Attack GPU RAM (bs 128)5 G15 G
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Kong, F.; Cheng, H.; Chen, T.; Shi, X.; Yuan, C. Assessing Membership Inference Privacy Risks in Medical Diffusion Models via Discrete Encoding-Based Inference. Appl. Sci. 2026, 16, 3140. https://doi.org/10.3390/app16073140

AMA Style

Kong F, Cheng H, Chen T, Shi X, Yuan C. Assessing Membership Inference Privacy Risks in Medical Diffusion Models via Discrete Encoding-Based Inference. Applied Sciences. 2026; 16(7):3140. https://doi.org/10.3390/app16073140

Chicago/Turabian Style

Kong, Fei, Hao Cheng, Tianlong Chen, Xiaoshuang Shi, and Chenxi Yuan. 2026. "Assessing Membership Inference Privacy Risks in Medical Diffusion Models via Discrete Encoding-Based Inference" Applied Sciences 16, no. 7: 3140. https://doi.org/10.3390/app16073140

APA Style

Kong, F., Cheng, H., Chen, T., Shi, X., & Yuan, C. (2026). Assessing Membership Inference Privacy Risks in Medical Diffusion Models via Discrete Encoding-Based Inference. Applied Sciences, 16(7), 3140. https://doi.org/10.3390/app16073140

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop