Sample what you cant compress

Vighnesh Birodkar, Gabriel Barcik, James Lyon, Sergey Ioffe, David Minnen, Joshua V. Dillon

TL;DR

SWYCC ("Sample What You Can’t Compress") is a novel autoencoder framework that replaces traditional deterministic decoders with a stochastic diffusion-based refinement stage. By jointly training a continuous encoder and a diffusion decoder, the authors achieve superior image reconstruction quality and more robust latent representations than state-of-the-art GAN-based models, particularly at high compression ratios.

What Problem Does This Paper Address?

In the world of learned image representations, basic autoencoders suffer from a "blurry" problem. When trained with standard Mean Squared Error (MSE), models tend to favor low-frequency information, resulting in soft, unrealistic reconstructions.

To fix this, researchers typically turn to Generative Adversarial Networks (GANs) or perceptual losses. However, GANs are notoriously difficult to train, hard to scale, and produce deterministic outputs—meaning one compressed latent vector can only ever map to one specific (and often flawed) reconstruction. The authors argue that these methods lack a principled theoretical interpretation and fail to capture the high-frequency "texture" that makes an image look real.

Methods

The core innovation of SWYCC is the marriage of autoencoder representation learning with a diffusion-based loss. The architecture consists of three main components:

  1. Encoder ($E$): A fully convolutional network that maps an image into a continuous latent space.
  2. Initial Decoder ($D_{Initial}$): A standard convolutional decoder that maps the latent back to a "pseudo-reconstruction." This output is often blurry but provides a strong spatial anchor.
  3. Refinement Decoder ($D_{Refine}$): A U-Net diffusion model. It takes the corrupted image, the noise level, and the output of $D_{Initial}$ to iteratively "sample" the missing high-frequency details.
Figure 4: A block diagram of our auto-encoder architecture. Our ”Diffusion Model” is a U-Net as defined by Hoogeboom et al. (2023b). During inference, the diffusion model is run in a loop to iteratively sample an image. All of these parameters jointly after being initialized from scratch, except for the weights of the network used in the perceptual loss.

Unlike previous works that train these pieces separately, SWYCC learns the encoder and both decoder stages jointly under a composite loss function: $$\ell_{Total} = \ell_{Diffusion} + \lambda_p\ell_{Perceptual} + \lambda_m\ell_{MSE}$$ This ensures the encoder learns a representation specifically optimized for the diffusion process.

Datasets

The models were primarily trained and evaluated on:

  • ImageNet: Resized to $256 \times 256$. This served as the primary benchmark for reconstruction quality and class-conditional generation.
  • COCO: Used as a secondary evaluation set to compare against other established models like SD-VAE 2.x.

Key Insights and Ideas

  • Stochasticity as a Feature: Because the decoder is a diffusion model, it is stochastic. If the latent representation doesn't contain enough information to reconstruct a specific blade of grass, the model samples a plausible one instead of producing a blurry smudge. This is the essence of "sampling what you can't compress."
  • The Power of $D_{Initial}$: The authors found that splitting the decoder into two parts—a coarse initial pass and a diffusion refinement—was crucial. $D_{Initial}$ provides a "warm start" for the diffusion process, significantly improving training dynamics and reconstruction accuracy.
  • Superior Latent Spaces: Interestingly, the latents produced by SWYCC are "easier" for downstream generative models to work with. When training a separate Latent Diffusion Model (LDM) on top of these representations, SWYCC outperformed GAN-based latents in FID scores.

Key Results

SWYCC consistently outperformed GAN-based autoencoders across multiple metrics:

  • Lower Distortion: As measured by the CMMD metric (which correlates well with human perception), SWYCC achieved lower distortion at all tested compression levels. The performance gap actually widens as the compression ratio increases.
Reconstruction distortion (CMMD) vs. Relative Compression ratio. SWYCC maintains much lower distortion than GANs as compression increases.
  • Visual Fidelity: Qualitative comparisons show that SWYCC preserves intricate textures (like the mesh of a basket or the scales of a lizard) that GANs often turn into mush.
Figure 3: Comparison of GAN versus SWYCC reconstructions at 8× relative compression level. You can see that the GAN based autoencoder loses a significant amount of detail in the highlighted portions, which SWYCC is able to sample effectively.
  • Generative Quality: In class-conditional generation tasks, SWYCC led to a 5% lower FID than the GAN baseline at the optimal 4x compression ratio.

Limitations and Future Work

The primary drawback of SWYCC is inference cost. Because diffusion requires multiple iterative steps to decode an image, it is inherently slower than a single forward pass of a GAN decoder. While the authors show that even 5 steps can produce decent results (see Figure 6), it remains a bottleneck for real-time applications.

Future work suggested by the authors includes:

  • Applying Progressive Distillation to reduce the number of sampling steps required for high-quality decoding.
  • Extending the framework to other modalities like audio, video, or 3D point clouds, where the "blurry" reconstruction problem is equally prevalent.

Summary updated

BibTeX
@misc{birodkar2024sample,
  author = {Vighnesh Birodkar and Gabriel Barcik and James Lyon and Sergey Ioffe and David Minnen and Joshua V. Dillon},
  title = {{Sample what you cant compress}},
  year = {2024},
  eprint = {2409.02529},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.02529},
}
Figure