NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

CipherDM: Secure Three-Party Inference for Diffusion Model Sampling

Xin Zhao, Xiaojun Chen, Xudong Chen, He Li, Tingyu Fan, Zhendong Zhao

Introduction

Diffusion Models (DMs), such as Stable Diffusion, have set new benchmarks in high-fidelity image generation. However, their deployment in Deep Learning as a Service (DLaaS) environments introduces significant privacy concerns. Users are often required to share sensitive prompts or images with service providers, while providers risk exposing proprietary model weights. While Secure Multi-Party Computation (MPC) offers a theoretical solution by allowing computations on encrypted data, its application to DMs is hindered by the models' iterative nature and reliance on complex nonlinear functions.

CipherDM is the first framework designed to enable practical, secure three-party inference for Diffusion Models. By introducing targeted optimizations for computationally expensive operations, CipherDM achieves significant speedups and communication efficiency over standard MPC baselines.

System Architecture

CipherDM utilizes a three-party computation (3PC) framework based on replicated secret sharing (specifically the ABY3 protocol). In this architecture, the model weights from the provider and the private input from the client are distributed among three non-colluding servers. These servers perform the sampling process collaboratively without ever reconstructing the original private data.

The CipherDM system architecture illustrating the secure three-party computation (3PC) workflow between the Model Provider, Client, and MPC Engine.

The workflow involves several key stages:

  1. Preprocessing: Private model parameters and user inputs are secret-shared.
  2. MPC Inference: The servers execute the diffusion sampling loop, performing iterative denoising.
  3. Resharing and Postprocessing: The final result is reconstructed and returned to the client.

Addressing the Nonlinear Bottleneck

A critical insight of this work is the shift in computational bottlenecks when moving from plaintext to ciphertext environments. In standard execution, residual blocks are the primary time consumers. However, in MPC, nonlinear activation functions like SoftMax, SiLU, and Mish become the dominant source of latency due to the high communication rounds required for exact mathematical functions.

Latency breakdown for different activation functions, demonstrating that exponential and other nonlinear operations constitute the majority of the computational overhead in MPC.

To mitigate this, CipherDM employs high-fidelity polynomial approximations:

  • Secure SoftMax: Replaces the expensive exponential function with a 7th-order Chebyshev polynomial, significantly reducing interactive rounds.
  • Piecewise Linear Fitting: For SiLU and Mish activations, the framework divides the input range into segments and applies specific low-degree polynomials to each, balancing accuracy and speed.
  • Optimized Time Embeddings: The Time-MLP module, essential for DMs, is optimized by replacing internal exponentiation with Chebyshev fitting.

Evaluation and Results

The framework was evaluated on MNIST (using DDPM and DDIM) and the U-Net component of Stable Diffusion. Experimental results demonstrate that CipherDM provides a substantial performance boost over the state-of-the-art SPU platform:

  • Latency: Achieved a speedup of 1.08x to 2.33x. Notably, DDPM on MNIST can generate images in under 10 minutes in secure mode.
  • Communication: Reduced data transfer requirements by 1.21x to 1.79x.
  • Generative Quality: Despite using approximations, the visual quality remains high, with only marginal increases in Fréchet Inception Distance (FID) scores compared to plaintext baselines.

Conclusion and Future Work

CipherDM represents a significant step toward making privacy-preserving generative AI practical. By identifying and optimizing the specific bottlenecks of DMs in MPC, it demonstrates that secure image generation is feasible, albeit still slower than plaintext alternatives. Future research will focus on expanding the framework to cover the entire Stable Diffusion pipeline and leveraging hardware acceleration to further reduce latency toward real-time requirements.

Summary updated

BibTeX
@inproceedings{zhao2024cipherdm,
  author = {Xin Zhao and Xiaojun Chen and Xudong Chen and He Li and Tingyu Fan and Zhendong Zhao},
  title = {{CipherDM: Secure Three-Party Inference for Diffusion Model Sampling}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-73209-6\_17},
}
Figure