Introduction
Diffusion models generate high-fidelity images by iteratively reversing a noise process. Traditionally, these models utilize a single neural network to handle every stage of the denoising trajectory—from the initial generation of global structures at high noise levels to the refinement of fine textures at low noise levels. However, recent research suggests that these stages represent distinct and often conflicting tasks. This leads to "negative transfer," where gradients from different noise levels interfere with one another, slowing convergence and limiting the model's final performance.
To address this, we present the Switch Diffusion Transformer (Switch-DiT). By reframing the diffusion process as a multi-task learning problem, Switch-DiT utilizes a Sparse Mixture-of-Experts (SMoE) architecture to allow for both parameter sharing and task-specific specialization across the denoising timeline.
Methodology
Sparse Mixture-of-Experts (SMoE) Integration
Switch-DiT replaces the standard feed-forward layers within a Transformer block with an SMoE layer. Each block contains multiple "experts" (small MLP networks). For any given denoising step, a gating network selects the most relevant experts to process the data.
The authors identify an optimal configuration of $M=3$ experts with the top $k=2$ experts selected per step. This "synergy" configuration ensures that the model maintains a common denoising path (via a shared expert) while allowing specialized experts to handle the unique requirements of specific noise regimes.
Timestep-based Gating and Prior Loss
Unlike standard MoEs that route based on individual image tokens, Switch-DiT routes based on the timestep embedding. This focuses the model’s capacity on isolating parameters specifically for different stages of the denoising process.
A significant challenge in applying MoEs to diffusion is the instability of the Exponential Moving Average (EMA) model, which is critical for image quality. Standard stochastic load-balancing losses often prevent EMA convergence. Switch-DiT solves this by introducing a Diffusion Prior Loss. This loss uses bipartite matching to encourage the gating network to follow a deterministic, optimized task-sharing schedule (inspired by the DTR method), stabilizing the training process.
Information Preservation
To avoid the risks associated with hard-masking channels—which can lead to the loss of vital semantic information—Switch-DiT employs a residual skip-connection design. The input is multiplied by the gating output, ensuring that even the paths not explicitly selected by the gating network can still contribute to the final output via residual connections.
Experimental Results
The model was benchmarked on FFHQ (unconditional human faces) and ImageNet (class-conditional generation) across multiple resolutions and model scales (Small, Base, and XL).
Superior Image Quality and Convergence
Switch-DiT consistently outperformed standard Diffusion Transformers (DiT) and existing multi-task learning (MTL) strategies:
- ImageNet 256x256: Switch-DiT-XL achieved an FID of 8.76, significantly better than the original DiT-XL (9.40) and the previous state-of-the-art multi-task method, DTR-XL (10.85).
- FFHQ 512x512: The Small variant (Switch-DiT-S) achieved an FID of 34.39, a massive improvement over the baseline DiT-S (92.07).
- Efficiency: Across all scales, Switch-DiT reached lower FID scores earlier in the training process, demonstrating superior convergence speed and scaling efficiency compared to simply increasing the parameter count of a standard DiT.
Discussion and Future Work
Switch-DiT demonstrates that the "one-size-fits-all" approach to diffusion parameters is suboptimal. By allowing the model to specialize across the denoising trajectory, we achieve a better balance between global structure and local detail.
While the current implementation relies on a fixed routing prior, future iterations could explore dynamic routing policies that adapt to specific datasets or more complex generation tasks, such as text-to-video or 3D synthesis. Furthermore, scaling the number of experts beyond $M=3$ may unlock even greater performance gains, mirroring the success of MoE in Large Language Models.
Summary updated