D2C: Diffusion-Decoding Models for Few-Shot Conditional Generation

Abhishek Sinha, Jiaming Song, Chenlin Meng, Stefano Ermon

Conditional image generation—such as generating a face with specific attributes like "blond hair"—typically requires massive datasets of paired images and labels. Acquiring these labels is expensive and often impractical for niche tasks.

To address this, researchers have introduced D2C (Diffusion-Decoding with Contrastive representations), a new generative framework that combines the structural benefits of Variational Autoencoders (VAEs) with the high-quality sampling of diffusion models. By learning a diffusion-based prior over a contrastive latent space, D2C enables high-quality image generation and complex image manipulation using as few as 100 labeled examples, while performing significantly faster than GAN-based alternatives.

The Challenge with Existing Models

Existing generative models often come with significant trade-offs:

  • VAEs (Variational Autoencoders): While easy to train and capable of providing a direct mapping from images to a latent "code," VAEs often suffer from poor sample quality. This is largely due to the "prior hole" problem: a mismatch between the simple distribution used during training (the prior) and the actual distribution of encoded data (the aggregate posterior).
  • GANs (Generative Adversarial Networks): GANs produce high-quality images but are notoriously unstable to train and difficult to "invert" (finding the latent code for an existing image to manipulate it).
  • Diffusion Models: These models produce state-of-the-art results but are computationally expensive because they typically operate directly on high-dimensional pixels.

D2C aims to bridge these gaps, providing a model that is stable, easy to invert, fast to sample, and capable of learning from very little labeled data.

The D2C Approach

D2C introduces a three-part architecture designed to maximize both representation quality and generation speed:

  1. Contrastive Encoder: The encoder is trained using self-supervised contrastive learning (similar to MoCo). This ensures the latent space ($z$) is semantically meaningful and transferable, making it easier to learn new tasks with few labels.
  2. Latent Diffusion Prior: Instead of forcing the latent space to fit a simple Gaussian distribution (as in standard VAEs), D2C learns a diffusion model over the latent space. This "fills the prior holes" by ensuring the distribution sampled during generation perfectly matches the distribution of encoded training data.
  3. Standard Decoder: A decoder maps the refined latent variables back into high-resolution images.
D2C Framework Overview

Few-Shot Conditioning: Because the latent space is semantically rich, the authors can train a simple classifier on the latents using only 100 labels. During generation, they use this classifier to guide the latent diffusion process, "nudging" the latent code toward the desired attribute (like "blond hair" or "red lipstick") before decoding it into an image.

Key Insights

  • Solving the "Prior Hole": The paper provides a formal argument showing that even if a VAE has a low KL-divergence, it can still have massive "holes" in its latent space where no training data lives. By using a diffusion model as the prior, D2C effectively "learns" the shape of the data in latent space, eliminating these gaps.
  • Latent vs. Pixel Diffusion: Most diffusion models work on pixels, which is slow. D2C performs the expensive diffusion process in a low-dimensional latent space and uses a fast, single-pass decoder for the final image. This makes it two orders of magnitude faster than pixel-based diffusion or GAN inversion.
  • SSL as a Generative Engine: While contrastive self-supervised learning (SSL) is usually used for classification, this paper shows it is incredibly powerful for generation. It creates a "structured" latent space where semantic attributes are easily separable, even with minimal supervision.

Performance and Results

The authors evaluated D2C across several diverse benchmarks, including CIFAR-10/100, fMoW (satellite imagery), and high-resolution face datasets (CelebA-HQ-256, FFHQ-256).

  • Superior Few-Shot Performance: On conditional generation with only 100 labels, D2C significantly outperformed state-of-the-art VAEs (NVAE) and diffusion models (DDIM) in both image quality (FID score) and classification accuracy.
  • Unconditional Quality: D2C achieved an FID of 10.15 on CIFAR-10, a massive improvement over the base NVAE (36.4).
  • Speed: For image manipulation tasks, D2C is roughly 615x faster than StyleGAN2 (0.013 seconds vs. 8 seconds on an Nvidia 1080Ti).
  • Human Preference: In a double-blind study, human evaluators preferred D2C's image manipulations over StyleGAN2's 50%–60% of the time, noting that D2C better preserved the fine-grained details of the original image (like backgrounds and accessories).

Future Directions

D2C currently relies on the NVAE architecture as its backbone. Moving to more modern architectures like Transformers or StyleGAN-based decoders could further improve results. Additionally, while current work focuses on labels and manipulation constraints, extending this framework to text-to-image generation presents a highly promising future direction.

Summary updated

BibTeX
@inproceedings{sinha2021d,
  author = {Abhishek Sinha and Jiaming Song and Chenlin Meng and Stefano Ermon},
  title = {{D2C: Diffusion-Decoding Models for Few-Shot Conditional Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=4vUZPUKZsr5},
}
Figure