DreamSampler: Unifying Diffusion Sampling and Score Distillation for Image Manipulation

Jeongsol Kim, Geon Yeong Park, Jong Chul Ye

Abstract

DreamSampler is a novel framework that unifies two previously distinct paradigms in image manipulation: reverse diffusion sampling and score distillation. By reformulating diffusion sampling as a regularized optimization problem, DreamSampler combines the high fidelity of sampling with the flexibility of distillation. This approach enables high-quality image editing, inpainting, and vector graphics (SVG) reconstruction while effectively mitigating the "mode collapse" issues common in traditional score distillation methods.

Introduction

In the context of Latent Diffusion Models (LDMs), image manipulation typically follows one of two paths. Reverse Diffusion Sampling is the standard for high-quality generation but often requires complex architectural modifications (e.g., cross-attention manipulation) for specific editing tasks. Conversely, Score Distillation Sampling (SDS) treats the diffusion model as a teacher to optimize a separate generator. While flexible and model-agnostic, SDS is prone to "mode collapse," resulting in over-saturated or overly simplified images due to a lack of stochasticity.

DreamSampler addresses these limitations by demonstrating that these two approaches are grounded in the same mathematical principles, bridging the gap to create a method that is both model-agnostic and resistant to mode collapse.

Methodology

The DreamSampler framework is built upon two key mathematical insights:

  1. Sampling as Optimization: Standard sampling steps (such as DDIM) can be rewritten as solutions to a proximal optimization problem.
  2. The SDS Connection: The objective function of this optimization is essentially a scaled version of the Score Distillation Sampling (SDS) loss.
The DreamSampler reverse sampling process, incorporating LDM feedback into a regularized optimization loop.

Unlike standard SDS, which selects random noise levels at each step, DreamSampler adheres to the natural reverse diffusion time schedule. At each step, it performs regularized latent optimization. Crucially, instead of injecting fresh Gaussian noise, it incorporates the estimated noise from the preceding step. This keeps the optimization trajectory anchored to the natural image manifold, preventing the "washed out" appearance typical of traditional distillation. This optimization-based structure allows for the integration of various regularizers, such as data consistency terms for inverse problems like deblurring or super-resolution.

Experimental Setup

The framework was evaluated using the following datasets and models:

  • FFHQ (1k validation set): Specifically for face inpainting tasks, such as adding glasses or modifying facial expressions.
  • General Image Domains: Testing editing capabilities across diverse subjects, including animals, human faces, and artistic illustrations.
  • Stable Diffusion v1.5: Utilized as the pre-trained "teacher" model for all experiments.

Results and Applications

DreamSampler demonstrates superior performance across several challenging tasks, as illustrated in the overview below.

Overview of DreamSampler applications: Vectorization, Editing, and Inpainting.

SVG Reconstruction

DreamSampler can reconstruct clean, resolution-independent Scalable Vector Graphics (SVGs) from blurry or low-resolution (64x64) inputs. It outperformed multi-stage baselines like PSLD + LIVE, which often lose semantic detail during vectorization.

Real Image Editing

In comparisons with Delta Denoising Score (DDS), DreamSampler exhibited better "bias preservation." It accurately modifies specific regions requested by text prompts (e.g., "add a crown") while maintaining the integrity of the original background and unrelated subjects.

Inpainting

On the FFHQ dataset, DreamSampler achieved a PSNR of 24.61 for adding glasses to faces, significantly outperforming the TReg method (21.97). This indicates a much higher fidelity in reconstructing the original facial features.

Key Insights

  • Stochasticity as a Regularizer: Re-introducing the stochasticity of reverse diffusion into the distillation process is critical for maintaining image texture and detail, effectively curing mode collapse.
  • Model-Agnostic Flexibility: As an optimization framework, DreamSampler can optimize various generators, including raw pixels, latent vectors, or differentiable rasterizer parameters for SVGs.
  • Unified Language: The framework provides a single mathematical language to handle text-guided editing and inverse problems simultaneously, removing the need for specialized models for every task.

Limitations and Future Work

DreamSampler's performance is intrinsically linked to the quality of the underlying diffusion prior; it inherits any biases or limitations present in the teacher model. Additionally, optimization-based sampling is computationally more intensive than one-pass sampling, though future work on time schedulers may improve efficiency. Finally, the authors emphasize the need for responsible use to mitigate risks associated with deepfakes and misinformation.

Summary updated

BibTeX
@inproceedings{kim2024dreamsampler,
  author = {Jeongsol Kim and Geon Yeong Park and Jong Chul Ye},
  title = {{DreamSampler: Unifying Diffusion Sampling and Score Distillation for Image Manipulation}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  url = {https://openreview.net/forum?id=iYixlV4zyz},
}
Figure