Binary Latent Diffusion

Ze Wang, Jiang Wang, Zicheng Liu, Qiang Qiu · DOI

Abstract

In this paper, we show that a binary latent space can be explored for compact yet expressive image representations. We model the bi-directional mappings between an image and the corresponding latent binary representation by training an auto-encoder with a Bernoulli encoding distribution. On the one hand, the binary latent space provides a compact discrete image representation of which the distribution can be modeled more efficiently than pixels or continuous latent representations. On the other hand, we now represent each image patch as a binary vector instead of an index of a learned cookbook as in discrete image representations with vector quantization. In this way, we obtain binary latent representations that allow for better image quality and high-resolution image representations without any multi-stage hierarchy in the latent space. In this binary latent space, images can now be generated effectively using a binary latent diffusion model tailored specifically for modeling the prior over the binary image representations. We present both conditional and unconditional image generation experiments with multiple datasets, and show that the proposed method performs comparably to state-of-the-art methods while dramatically improving the sampling efficiency to as few as 16 steps without using any test-time acceleration. The proposed framework can also be seamlessly scaled to $1024 \times 1024$ high-resolution image generation without resorting to latent hierarchy or multi-stage refinements.

Introduction

Generative modeling has long faced a trade-off between image quality and computational efficiency. While Generative Adversarial Networks (GANs) offer rapid sampling, they are prone to training instability and mode collapse. Conversely, Diffusion Models have set new benchmarks for quality and diversity but require hundreds of iterative denoising steps in high-dimensional space, making them computationally prohibitive for many applications.

Latent Diffusion Models (LDMs) attempted to mitigate this by operating in a compressed continuous latent space. However, regressing real-valued latents remains complex. Alternative Vector-Quantized (VQ) models use discrete codebooks, but these face a rigid trade-off: small codebooks lose fine detail, while large codebooks become computationally heavy to navigate. Binary Latent Diffusion (BLD) introduces a novel framework that operates in a compact, binary latent space, offering the efficiency of discrete representations with the expressiveness required for high-fidelity synthesis.

Methodology

The BLD framework utilizes a two-stage approach to bridge the gap between discrete efficiency and continuous quality:

  1. Binary Auto-Encoder (BAE): The BAE maps image patches to binary vectors rather than continuous vectors or single codebook indices. By employing a Bernoulli distribution to represent bit probabilities and utilizing a straight-through gradient estimator during training, the model learns to compress images into a highly efficient binary format.
  2. Bernoulli Diffusion Process: The core innovation is a diffusion process specifically designed for binary data. In this regime, "noise" is defined as bit-flipping. The process continues until every bit reaches maximum entropy (a 50% chance of being 0 or 1).
  3. Flipping Probability Reparameterization: Unlike standard models that predict added noise, BLD predicts the "flipping probability"—the likelihood that a specific bit in the noisy state must be inverted to reach the clean target. This reparameterization treats denoising as a sparse residual task, which significantly simplifies the learning objective for the model.

Key Insights

Combinatorial Expressiveness

A primary advantage of the binary approach is its inherent expressiveness. A 32-bit binary vector can represent over 4 billion unique patterns ($2^{32}$), far exceeding the 1,024 or 8,192 patterns typically found in VQ-VAE codebooks. This allows BLD to capture intricate details even at high compression ratios.

One-Shot High Resolution

Traditional discrete models often require complex multi-stage hierarchies to generate high-resolution images (e.g., $1024 \times 1024$). Because the binary latent space is exceptionally compact, BLD can model high-resolution priors in a single stage using a standard transformer architecture, avoiding the need for multi-stage refinements.

Experimental Results

The model was evaluated on standard benchmarks including LSUN Bedrooms & Churches, FFHQ, CelebA-HQ, and ImageNet-1K.

Qualitative results of Binary Latent Diffusion across various datasets and resolutions, including 1024x1024 high-resolution face generation.

Sampling Efficiency and Speed

BLD demonstrates remarkable sampling efficiency. It achieves high-quality results in as few as 16 to 64 steps. On identical hardware, BLD recorded a sampling speed of 0.20 seconds per image (at 16 steps), a massive improvement over the 15.68 seconds required by standard LDMs.

Representation Compactness

The binary representation is significantly more efficient than its continuous counterparts. An image in BLD is represented by an 8k-bit tensor, compared to the 131k-bit representation used in standard LDMs. Despite this 16x reduction in size, BLD maintains comparable image quality (FID scores) and superior reconstruction metrics (PSNR and SSIM) against VQ-based methods, particularly at high downsampling ratios.

Conclusion and Future Work

Binary Latent Diffusion proves that binary latent spaces are a viable and highly efficient alternative for generative modeling. While the model is sensitive to the balance between diffusion loss and the variational lower bound, it offers a scalable path toward high-resolution synthesis without hierarchical complexity. Future work may involve exploring specialized transformer architectures to further optimize the modeling of binary priors and addressing the potential social impacts of high-fidelity synthetic media.

Summary updated

BibTeX
@inproceedings{wang2023binary,
  author = {Ze Wang and Jiang Wang and Zicheng Liu and Qiang Qiu},
  title = {{Binary Latent Diffusion}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
  doi = {10.1109/cvpr52729.2023.02162},
}
Figure