BitsFusion: 1.99 bits Weight Quantization of Diffusion Model

Yang Sui, Yanyu Li, Anil Kag, Yerlan Idelbayev, Junli Cao, Ju Hu, Dhritiman Sagar, Bo Yuan, Sergey Tulyakov, Jian Ren

Abstract

Large-scale diffusion models like Stable Diffusion have transformed the landscape of generative AI, yet their substantial memory and storage requirements pose significant barriers to deployment on resource-constrained edge devices. While quantization is a standard approach to model compression, reducing weights below 4 bits typically results in "semantic collapse," where the model fails to maintain image quality and prompt alignment. This paper introduces BitsFusion, a novel quantization framework that compresses the UNet weights of Stable Diffusion v1.5 to an average of 1.99 bits. By employing a mixed-precision strategy, symmetry-aware initialization, and a specialized two-stage distillation process, BitsFusion achieves a 7.9× reduction in storage (from 1.72 GB to 219 MB) while maintaining—and in some cases exceeding—the performance of the full-precision original.

Introduction

Diffusion models have revolutionized high-fidelity image synthesis, but their multi-gigabyte footprints make them difficult to run on mobile or wearable hardware. Standard quantization techniques, which convert high-precision floating-point weights into low-bit integers, often hit a "quality wall" at extremely low bit-widths. At 1 or 2 bits, models frequently lose the ability to follow complex prompts or generate realistic textures. BitsFusion aims to break this wall by treating quantization not just as a numerical compression task, but as a process that must preserve the semantic integrity of the generative process.

Methodology

BitsFusion achieves high-fidelity 1.99-bit generation through a multi-pronged strategy designed to address the specific sensitivities of diffusion architectures.

1. Mixed-Precision Strategy

Not all layers in a neural network contribute equally to the final output. BitsFusion utilizes a sensitivity-aware approach to assign bit-widths. The authors analyzed every layer using two distinct metrics:

  • Mean Squared Error (MSE): To measure pixel-level visual accuracy.
  • CLIP Score: To measure the preservation of semantic meaning and prompt alignment. By assigning higher precision (up to 4 bits) to sensitive layers and lower precision (as low as 1 bit) to robust ones, the model achieves an average of 1.99 bits across the UNet without sacrificing the "soul" of the model.

2. Symmetry-Aware Initialization

Most weights in diffusion models are naturally symmetric around zero. Standard quantization often disrupts this symmetry, leading to initialization errors. BitsFusion introduces a "balance integer" approach (e.g., mapping 1-bit sets to {-1, 0, 1}) and utilizes alternating optimization to find optimal starting scaling factors, ensuring the quantized model begins training from a mathematically sound state.

3. Time Embedding Caching

The authors observed that time embeddings remain constant for each specific step in the diffusion process. By pre-computing and caching these embeddings, BitsFusion removes the need for projection layers entirely, saving significant storage space with zero impact on accuracy.

4. Two-Stage Training Pipeline

To bridge the gap between the full-precision teacher and the low-bit student, BitsFusion employs a two-stage training regime:

  • Stage I (Distillation): The student model learns from the full-precision teacher using a specialized loss function that accounts for Classifier-Free Guidance (CFG). To address the fact that quantization error is higher at specific time steps (particularly near $t=999$), the authors used a Beta distribution to sample these difficult time steps more frequently during training.
  • Stage II (Fine-tuning): A final round of fine-tuning using standard noise prediction stabilizes the model and ensures high-quality image generation.

Evaluation and Results

The model was evaluated using industry-standard benchmarks, including MS-COCO 2014, TIFA, GenEval, and PartiPrompts.

Compression and Performance

BitsFusion compressed the UNet from 1.72 GB (FP16) to 219 MB, a 7.9× reduction. Despite this massive compression, the model demonstrated superior performance:

  • Benchmark Scores: On TIFA and GenEval, BitsFusion consistently scored higher than the original Stable Diffusion v1.5 across various CFG scales.
  • Human Evaluation: In a blind comparison, human evaluators preferred BitsFusion-generated images 54.4% of the time over those from the original model.
  • State-of-the-Art Comparison: BitsFusion outperformed existing quantization methods such as LSQ, Q-Diffusion, and EfficientDM in CLIP score comparisons at similar bit-widths.

Discussion and Limitations

A key insight of this research is that the distillation process acts as a form of regularization. By forcing the model to represent information in a highly compressed format, it learns to focus on the most critical features, which explains why the 1.99-bit model can outperform its full-precision counterpart.

However, some limitations remain:

  • Weight-Only Quantization: The current work focuses on storage (weights). It does not address activation quantization, which is necessary for maximizing inference speed on many hardware backends.
  • Scope: The study focused on the UNet. The VAE and CLIP text encoder remain in higher precision, representing an opportunity for future optimization.
  • Hardware Kernels: Realizing the full speedup potential of mixed-precision models requires the development of specialized hardware kernels for mobile devices.

Conclusion

BitsFusion demonstrates that it is possible to shrink Stable Diffusion to the 2-bit limit while actually improving image quality. By combining semantic-aware bit-width assignment with a robust distillation pipeline, BitsFusion paves the way for high-quality, on-device generative AI.

Summary updated

BibTeX
@inproceedings{sui2024bitsfusion,
  author = {Yang Sui and Yanyu Li and Anil Kag and Yerlan Idelbayev and Junli Cao and Ju Hu and Dhritiman Sagar and Bo Yuan and Sergey Tulyakov and Jian Ren},
  title = {{BitsFusion: 1.99 bits Weight Quantization of Diffusion Model}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=0m19blQT6y},
}
Figure