FORA: Fast-Forward Caching in Diffusion Transformer Acceleration

Pratheba Selvaraju, Tianyu Ding, Tianyi Chen, Ilya Zharkov, Luming LiangarXiv 2024 · DOI

Introduction

Diffusion models have fundamentally transformed the landscape of generative AI, enabling high-fidelity image and video synthesis. Recently, the industry has seen a shift from traditional U-Net architectures toward Diffusion Transformers (DiT). These transformer-based models, such as those powering Sora, offer superior scalability and performance. However, this progress comes with a significant computational "speed limit." Generating a single image requires dozens of iterative denoising steps, each necessitating a full forward pass through a massive transformer backbone.

While various caching techniques have been developed to accelerate U-Nets by skipping redundant computations, these methods do not translate directly to the specific block structures of DiTs. To address this, the authors introduce FORA (Fast-Forward Caching), a training-free method designed to make high-end transformer-based generation viable for real-time applications by significantly reducing computational overhead with minimal impact on quality.

The FORA Framework

The core innovation of FORA is its "static caching" mechanism. The method is predicated on the observation that internal feature representations within a transformer do not change drastically between consecutive denoising steps. Instead of recomputing every layer at every step, FORA introduces a cache interval ($N$):

  1. Recomputation: Every $N$ steps, the model performs a full forward pass. It caches the outputs of the most computationally expensive components: the Self-Attention and Multi-Layer Perceptron (MLP) layers.
  2. Feature Reuse: For the subsequent $N-1$ steps, the model "fast-forwards" by retrieving these saved features from the cache rather than recalculating them.
  3. Seamless Integration: As a training-free approach, FORA can be integrated into existing DiT or PIXART-$\alpha$ models as a plug-and-play solution without requiring any fine-tuning.

Technical Insights: Exploiting Redundancy

The success of FORA lies in the inherent redundancy of the diffusion process. By analyzing the similarity of features across different layers and steps, the researchers confirmed that feature maps remain highly stable, particularly in the later stages of denoising.

Heatmaps showing the high similarity of Attention and MLP features across denoising steps in Layer 9.

As shown in the similarity heatmaps, the diagonal represents the high correlation between adjacent steps. This data justifies targeting the Attention and MLP outputs, which consume the vast majority of floating-point operations (FLOPs) in the transformer architecture. By skipping these bottlenecks, FORA achieves substantial speedups without losing the structural integrity of the generated content.

Experimental Evaluation

The researchers evaluated FORA across two primary benchmarks: ImageNet (256x256) for class-conditional generation and MS-COCO for text-to-image (T2I) generation using models like DiT-XL/2 and PIXART-$\alpha$.

Performance and Quality

  • Speedups: On ImageNet, FORA achieved a 2.8x speedup with negligible quality loss. When pushed to an interval of $N=10$, the model reached an 8.07x speedup, though this higher interval introduces more noticeable artifacts.
  • Fidelity: For the recommended $N=3$ configuration, the Fréchet Inception Distance (FID) score—a standard measure of image quality—only slightly increased from 2.27 to 2.82. This trade-off is virtually imperceptible in most practical use cases.
  • Visual Consistency: Qualitative results show that while the model maintains high structural accuracy, increasing the caching interval can lead to a shift where the model treats background elements with the same priority as the main subject, occasionally smoothing out fine-grained details.
Qualitative results of PIXART-α text-to-image generation using FORA, demonstrating high-quality synthesis across various prompts.

Conclusion and Future Directions

FORA demonstrates that significant acceleration is possible in Diffusion Transformers by simply identifying and skipping redundant mathematical operations. Its ability to stack with existing fast samplers like DPM-Solver makes it a versatile tool for the next generation of generative models.

While the current "static" caching interval is highly effective, the authors note that the diffusion process is naturally dynamic—features change more rapidly at the start of the process than at the end. Future work may involve adaptive caching mechanisms that adjust the interval on the fly, triggering recomputation only when a feature has drifted significantly from its cached version. This would further optimize the balance between real-time performance and visual perfection.

Summary updated

BibTeX
@misc{selvaraju2024fora,
  author = {Pratheba Selvaraju and Tianyu Ding and Tianyi Chen and Ilya Zharkov and Luming Liang},
  title = {{FORA: Fast-Forward Caching in Diffusion Transformer Acceleration}},
  year = {2024},
  eprint = {2407.01425},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.01425},
}
Figure