TL;DR
This paper introduces Linear Diffusion Transformers (LiT), a method to convert powerful Diffusion Transformers (DiT) into more efficient linear attention-based models without sacrificing image generation quality. By proposing five practical guidelines for architectural design and training, LiT achieves comparable or even superior performance to its full-attention counterparts, while significantly reducing training time and computational cost.
What Problem Does This Paper Address?
Diffusion models, particularly those based on Transformers (DiTs), have shown remarkable success in image generation. However, their core self-attention mechanism exhibits quadratic complexity with respect to sequence length, leading to significant latency and high GPU memory requirements, especially for high-resolution images. This makes them challenging to deploy on resource-constrained devices. The paper addresses the need for more efficient diffusion models by exploring how to adapt existing, well-trained DiTs into linear attention-based models, which offer sub-quadratic complexity, without compromising their generative capabilities.
Methods
The authors propose a set of five practical guidelines for converting a pre-trained DiT into a linear DiT, which they call LiT:
- Simplified Linear Attention with Depth-wise Convolution: They found that incorporating a simple depth-wise convolution within the linear attention mechanism is sufficient to enable effective image generation. This addresses the potential issue of linear attention producing "smooth" attention distributions that might miss fine-grained details.
- Few Heads in Linear Attention: Surprisingly, using fewer attention heads in linear attention (e.g., 2-4) leads to improved performance without increasing latency. This is termed a "free lunch" effect, as it boosts quality with no computational penalty.
- Weight Inheritance from Converged DiT: LiT models are initialized with weights from a fully converged, pre-trained DiT. This leverages the existing knowledge learned by the teacher model.
- Selective Parameter Loading: When inheriting weights, all parameters are loaded except those directly related to the self-attention mechanism, which are replaced by the new linear attention layers. This allows for cost-effective training.
- Hybrid Knowledge Distillation: A novel distillation strategy is employed where the student LiT model is trained to mimic not only the noise predictions of the teacher DiT but also the variances of the reverse diffusion process. This provides a more comprehensive supervision signal.
These guidelines are integrated into the LiT framework, which maintains the macro and micro-level architecture of the original DiT but replaces all self-attention modules with efficient linear attention.
Datasets
The paper uses the following datasets for training and evaluation:
- ImageNet (256x256 and 512x512): Used for class-conditional image generation experiments.
- Internal datasets: Used for text-to-image generation experiments, with a mixture of long (sharegpt captions) and short (original captions).
Key Insights and Ideas
- Linear Attention is Viable for Image Generation: Contrary to some assumptions, linear attention, when properly adapted, can be highly effective for image generation tasks, not just recognition.
- Depth-wise Convolution is Key: The addition of a simple depth-wise convolution is crucial for making linear attention perform well in image generation, likely by reintroducing local inductive biases.
- The "Free Lunch" of Few Heads: The counter-intuitive finding that fewer attention heads in linear attention improve performance without increasing latency is a significant efficiency gain.
- Leveraging Pre-trained Models is Highly Effective: Inheriting weights from well-trained DiTs drastically reduces the training burden for LiT, making it a much more accessible approach.
- Distilling Variance Matters: Beyond just noise prediction, distilling the variance of the reverse diffusion process from a teacher model provides additional benefits for training the student LiT.
Key Results
- ImageNet Generation: LiT models (S/2, B/2, L/2, XL/2) trained for significantly fewer steps (e.g., 100K or 400K) achieved comparable or better FID scores than their corresponding DiT counterparts trained for much longer (e.g., 400K or 7M steps). For instance, LiT-XL/2 achieved an FID of 2.32 with only 20% of DiT-XL/2's training steps.
- Text-to-Image Generation: LiT, converted from PixArt-Σ, generated high-quality, photorealistic images and achieved comparable GenEval scores to its baseline.
- Efficiency Gains: LiT demonstrated significant speedups. For 1K resolution images, LiT was ~10% faster than PixArt-Σ, and for 2K resolution, it was ~55% faster, even when PixArt-Σ used key-value compression.
- On-Device Deployment: LiT models were successfully deployed offline on a laptop for 1K resolution image generation, showcasing their efficiency.
Limitations and Future Work
- Limitations: The paper acknowledges that while LiT achieves comparable performance, the "free lunch" effect of few heads might not hold for all architectures or tasks. The exact reasons for the effectiveness of weight inheritance from converged DiTs are still under investigation, though functional decoupling of modules is hypothesized.
- Future Work: The authors express interest in exploring scalability and higher resolutions (e.g., 4K) for LiT generation. They also suggest further investigation into the optimal settings for hybrid knowledge distillation.
Summary updated