TL;DR
CLEAR (Conv-Like Linearization) is a novel local attention strategy that successfully converts pre-trained Diffusion Transformers (DiTs) from quadratic to linear complexity. By restricting image token interactions to a local circular window and fine-tuning on just 10K synthetic images, CLEAR reduces attention computations by 99.5% and accelerates 8K image generation by 6.3× while maintaining high image quality and zero-shot compatibility with downstream plugins.
What Problem Does This Paper Address?
Diffusion Transformers (DiTs), such as the FLUX.1 architecture, have set new benchmarks in high-quality text-to-image generation. However, their reliance on standard self-attention mechanisms introduces a major bottleneck: quadratic computational and memory complexity ($O(N^2)$) relative to the number of tokens (pixels). When generating ultra-high-resolution images (e.g., 4K or 8K), this quadratic scaling leads to extreme latency and massive hardware demands—generating an 8K image can take over 30 minutes even on an enterprise-grade H100 GPU.
While many efficient attention alternatives exist (e.g., linear attention, key-value compression, or strided sampling), the authors discover that simply swapping them into pre-trained DiTs causes severe image distortion or training divergence. This paper addresses the challenge of successfully linearizing a powerful, pre-trained DiT without destroying its generative capabilities.
Methods
The authors introduce CLEAR, a convolution-like local attention mechanism tailored specifically for pre-trained DiTs.
- Circular Local Windows: For text-image joint attention, text queries still attend globally to all tokens. However, each image query token is restricted to interacting only with text tokens and image key-value tokens that fall within a predefined circular local window of radius $r$. The circular shape reduces computational overhead by approximately $\sim\pi/4$ compared to standard square sliding windows.
- Knowledge Distillation: To transition the pre-trained "teacher" DiT into the linear "student" model, the authors freeze the core weights and fine-tune only the attention layers. They utilize a distillation loss function combining standard flow matching loss with direct mean-squared-error (MSE) penalties on the model's final predictions and intermediate attention outputs.
- Multi-GPU Patch Parallelism: Because token interactions are localized, CLEAR naturally lends itself to patch-parallel multi-GPU inference. To avoid heavy communication overhead for text tokens (which technically require global image context), the authors introduce a patch-wise averaging approximation that allows text queries to aggregate features independently on each GPU before averaging the results.
Datasets
- Training: The model is fine-tuned on a dataset of 10K synthetic images generated by the FLUX.1-dev model itself, paired with their corresponding text prompts.
- Evaluation: Quantitative benchmarks are performed using 5,000 randomly sampled images and prompts from the COCO2014 validation dataset, evaluated across multiple resolutions (1024×1024, 2048×2048, and 4096×4096).
Key Insights and Ideas
- Locality is Crucial for DiTs: Through diagnostic experiments, the authors show that pre-trained DiTs inherently rely on local token relationships. As illustrated in Figure 5, clipping or perturbing remote spatial features has virtually no impact on final image quality, whereas altering local features completely destroys the structure.
- The Four Pillars of Linearization: The paper identifies four essential criteria that an attention mechanism must satisfy to successfully linearize a pre-trained DiT: locality, formulation consistency (retaining the softmax-based scaled dot-product structure), high-rank attention maps, and feature integrity (avoiding aggressive downsampling or compression of raw query/key/value tokens).
- Synthetic Data Trumps Real Data: Counterintuitively, fine-tuning the model on high-quality real images (from datasets like LAION) yields inferior results compared to using a small set of synthetic images generated by the teacher model. This is because synthetic data minimizes the distribution shift, allowing the student model to focus purely on learning the architectural transition to local attention.
Key Results
- Massive Efficiency Gains: When scaling up to 8K image generation, CLEAR slashes attention layer computations by 99.5% (measured in GFLOPS) and delivers a 6.3× wall-clock speedup on a single H100 GPU.
- High Fidelity: Despite the strict local constraints, CLEAR preserves the overall layout, style, and textual alignment of the original model, achieving an MS-SSIM score of up to 0.9 during resolution extrapolation.
- Zero-Shot Generalization: Once the CLEAR attention layers are trained on FLUX.1-dev, they can be plugged directly into other model variants like FLUX.1-schnell (a 4-step distilled model) or combined with pre-trained downstream tools like ControlNet without any additional training or adaptation.
Limitations and Future Work
The primary limitation of CLEAR is the gap between theoretical FLOPS reduction and practical hardware acceleration. At lower resolutions (sub-1024×1024), the overhead of handling sparse attention masks can actually make CLEAR slower than vanilla full attention optimized with FlashAttention.
The authors note that standard hardware optimizations are heavily biased toward dense matrix multiplications. Consequently, a vital direction for future work is the development of specialized, fused CUDA kernels specifically engineered to optimize CLEAR's circular sparse attention pattern directly on the hardware level.
Summary updated