Introduction
Diffusion Transformers (DiTs) have emerged as the state-of-the-art architecture for high-fidelity image generation, powering models such as Sora and PixArt-Sigma. However, their computational intensity remains a significant barrier to deployment. This paper introduces DiffCR (Differentiable Token Compression Ratios), a framework designed to optimize DiT efficiency by learning adaptive compression strategies across tokens, layers, and denoising timesteps.
The Computational Bottleneck in DiTs
The primary inefficiency in standard DiTs is their uniformity. Regardless of the image content, the model applies the same amount of computation to every token in every layer at every timestep. This approach ignores the inherent redundancy in visual data: a simple background requires less processing than a complex foreground object. Furthermore, certain layers and denoising stages (particularly early stages where the image is mostly noise) are more tolerant of information loss than others. Existing efficiency methods, such as fixed token merging, often rely on rigid heuristics that fail to adapt to these dynamic requirements.
The DiffCR Framework
DiffCR addresses these limitations through three primary mechanisms that allow the model to learn its own efficiency strategy.
1. Token-level Routing
Inspired by Mixture-of-Depths (MoD) in natural language processing, DiffCR employs a "router" at each layer. This router predicts an importance score for every input token. Only the top-$k$ most critical tokens are processed by the layer's Attention and MLP blocks, while the remaining tokens bypass the computation entirely.
2. Layer-wise and Timestep-wise Differentiable Ratios
Rather than using human-defined compression targets, DiffCR treats the compression ratio as a learnable parameter.
- Layer-wise Adaptation: Each layer learns a specific ratio, identifying which parts of the network are redundant and which are critical.
- Timestep-wise Adaptation: The denoising process is partitioned into stages (e.g., early, middle, late), each learning its own ratio. This allows the model to be aggressive during initial denoising and more precise during final detail refinement.
To enable gradient-based optimization of these discrete ratios, the authors utilize a "binning" proxy. During training, the model computes two paths—a "lower bin" and an "upper bin"—and interpolates between them based on proximity coefficients. This ensures the compression strategy is fully differentiable.
Experimental Setup
The researchers evaluated DiffCR across multiple tasks and architectures:
- Text-to-Image (T2I): Integrated into PixArt-Σ and trained on the LAION-5B dataset, filtered for high aesthetic quality.
- Image Inpainting: Integrated into LazyDiffusion and trained on a large-scale internal dataset, with evaluation on LAION-400M.
- Optimization: A Mean Squared Error (MSE) loss was used to guide the model toward a user-defined global computational budget (e.g., 30% total compression).
Analysis: Semantic Awareness and Redundancy
Qualitative analysis reveals that the learned routers are highly semantically aware.
As shown in Figure 4, the routers naturally prioritize tokens that constitute the primary subject (the apple) while skipping background tokens. Key findings from this analysis include:
- Noisy Timestep Redundancy: The model learns to compress more aggressively at the start of the generation process when the image is predominantly noise.
- Middle-Layer Sensitivity: Middle layers in DiTs often exhibit the highest redundancy, whereas early and late layers are more sensitive to token removal.
Key Results
DiffCR demonstrates a superior Pareto frontier between image quality and generation speed compared to existing baselines:
- Quality Improvements: In Text-to-Image tasks, DiffCR reduced the Fréchet Inception Distance (FID) by 57.83 to 241.11 points compared to Token Merging (ToMe) at equivalent speeds.
- Efficiency: The framework achieved approximately 20% savings in latency and memory with negligible impact on visual quality.
- Human Preference: Evaluation using the HPSv2 metric showed that DiffCR consistently outperformed other compression methods in terms of human visual preference.
Limitations and Future Work
While highly effective at inference, the differentiable ratio mechanism introduces training overhead. Calculating two paths during the fine-tuning phase roughly doubles the forward pass cost. Additionally, while the model learns the distribution of compression, the user must still define the target global ratio. Future research may explore combining DiffCR with few-step distillation techniques to further accelerate the diffusion process.
Summary updated