Scaling diffusion transformers to 16 billion parameters

Changqian Yu, Zhengcong Fei, Mingyuan Fan, Debang Li, Junshi Huang

TL;DR

DiT-MoE scales Diffusion Transformers to a massive 16.5 billion parameters by replacing dense layers with a sparse Mixture-of-Experts (MoE) architecture. By activating only a fraction of its parameters (3.1B) for any given task, it achieves a new state-of-the-art FID score of 1.80 on ImageNet 512×512 while maintaining high inference efficiency.

What Problem Does This Paper Address?

As generative AI moves toward higher resolutions and more complex scenes, diffusion models are hitting a "scaling wall." Increasing model capacity—adding more parameters—consistently improves image quality, but in standard dense architectures, every parameter is used for every calculation. This makes training and serving large-scale models like Stable Diffusion 3 prohibitively expensive.

The authors address this by bringing conditional computation to Diffusion Transformers (DiT). The goal is to decouple a model's total capacity from its computational cost, allowing for a "giant" model that only uses a "smart" subset of its brain for each specific image patch it generates.

Methods

The researchers introduce DiT-MoE, which adapts the Mixture-of-Experts framework specifically for the diffusion process.

  1. Sparse MoE Blocks: They replace the standard Feed-Forward Network (FFN) layers in DiT blocks with MoE layers. Each layer contains multiple "experts" (MLP sub-networks). A router decides which experts should process a given image patch token.
  2. Shared Expert Routing: To prevent parameter redundancy, they designate specific "shared experts" that process every token. This allows these experts to capture common, fundamental knowledge, while the routed experts specialize in niche features.
  3. Expert-Level Balance Loss: A common pitfall in MoE is "expert collapse," where the router favors a few experts, leaving others untrained. The authors implement a specialized balance loss to ensure even workload distribution across all experts.
Overview of the DiT-MoE architecture, showing the integration of shared experts and the routing mechanism.

Datasets

  • ImageNet: Used for standard class-conditional image generation at 256×256 and 512×512 resolutions.
  • Synthesized Data: To push the model to 16.5B parameters, the authors augmented their training set with 5 million high-quality synthetic images generated by SDXL and SD3-Medium, using a 1:5 real-to-synthetic ratio.

Key Insights and Ideas

  • Routing is Spatio-Temporal, Not Semantic: Interestingly, the model chooses experts based on a patch's spatial position and the current denoising timestep, rather than the class of the object (e.g., "dog" vs. "boat").
  • Shallow Specialization vs. Deep Balance: In shallow layers, experts are highly specialized to specific spatial regions. As the network gets deeper, expert selection becomes more uniform and balanced.
  • The Frequency Shift: Expert selection is highly concentrated during early denoising steps (when the model is forming low-frequency global structures) and becomes more uniform in later steps (when it is refining high-frequency details).
  • Deep MoE is Better: The authors found that replacing dense layers with MoE in the latter half of the network yields better performance than doing so in the shallow layers.

Key Results

DiT-MoE demonstrates that sparsity is a "free lunch" for scaling diffusion models:

  • State-of-the-Art Quality: The 16.5B parameter model (DiT-MoE-G) achieved a record-breaking FID-50K score of 1.80 on ImageNet 512×512.
  • Efficiency Gains: The DiT-MoE-XL model, which activates only 1.5B parameters, significantly outperforms dense competitors like Large-DiT-7B and LlamaGen-3B while requiring much less computational load during inference.
  • Scalability: The architecture scales predictably; as total parameters increase from 199M to 16.5B, performance continues to improve without the training instability often seen in massive dense models.
Selected samples from the DiT-MoE models showing high-fidelity generation across various classes.

Limitations and Future Work

  • Memory Footprint: While MoE reduces the FLOPs (computation) required, the total parameter count still dictates the VRAM needed to store the model. A 16.5B parameter model remains a heavyweight for consumer hardware.
  • Routing Refinement: The authors suggest that future work could explore more dynamic ways to adjust the balance loss or experiment with heterogeneous expert architectures (experts with different internal structures) to further enhance specialization.
  • Beyond Images: The success of DiT-MoE in 2D image generation paves the way for applying similar sparse scaling to video and 3D generative tasks.

Summary updated

BibTeX
@misc{yu2024scaling,
  author = {Changqian Yu and Zhengcong Fei and Mingyuan Fan and Debang Li and Junshi Huang},
  title = {{Scaling diffusion transformers to 16 billion parameters}},
  year = {2024},
  eprint = {2407.11633},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.11633},
}
Figure