Abstract
Diffusion Transformers (DiT) are powerful generative models but remain computationally intensive due to their iterative structure and deep transformer stacks. To alleviate this inefficiency, we propose FastCache, a hidden-state-level caching and compression framework that accelerates DiT inference by exploiting redundancy within the model's internal representations. FastCache introduces a dual strategy: (1) a spatial-aware token selection mechanism that adaptively filters redundant tokens based on hidden state saliency, and (2) a transformer-level cache that reuses latent activations across timesteps when changes are statistically insignificant. These modules work jointly to reduce unnecessary computation while preserving generation fidelity through learnable linear approximation. Theoretical analysis shows that FastCache maintains bounded approximation error under a hypothesis-testing-based decision rule. Empirical evaluations across multiple DiT variants demonstrate substantial reductions in latency and memory usage, with best generation output quality compared to other cache methods, as measured by FID and t-FID. Code implementation of FastCache is available on GitHub at https://github.com/NoakLiu/FastCache-xDiT.
Introduction
Transformer-based diffusion models (DiTs), such as Sora and Stable Diffusion 3, have set new benchmarks in generative tasks, surpassing traditional U-Net architectures. However, their iterative denoising process—requiring dozens of passes through deep transformer stacks—imposes a significant computational burden.
A critical observation in diffusion inference is the high degree of redundancy across both spatial and temporal dimensions. Hidden states often change minimally between successive timesteps or within static background regions. While previous attempts at acceleration have relied on simple feature caching, these methods often lead to visual artifacts like "frozen" backgrounds or degraded fidelity. FastCache addresses these challenges by introducing a learnable linear approximation that bridges the gap between full computation and static caching.
Methodology: The FastCache Framework
FastCache operates directly on the hidden states of transformer blocks through two primary mechanisms:
1. Spatial-Temporal Token Reduction
The framework adaptively identifies redundant tokens by calculating the difference between a token's current hidden state ($H_{t,l}$) and its state in the previous timestep ($H_{t-1,l}$). Tokens representing static areas are separated from those representing dynamic motion, allowing for targeted computational savings.
2. Transformer-Level Caching with Linear Approximation
For tokens identified as redundant, FastCache employs a statistical hypothesis test (Chi-square test) to decide whether to skip the transformer block. Unlike traditional methods that simply copy previous states, FastCache utilizes a learnable linear layer ($W_c X + b_c$). This lightweight module approximates the output of the skipped block, capturing subtle latent shifts while bypassing expensive self-attention and MLP operations.
Experimental Evaluation
The authors evaluated FastCache across diverse models and datasets, including ImageNet (DiT-XL/2 to S/2), MS-COCO (DeepFloyd, SD 1.5), and video datasets (VD-DiT).
Key Results
- Efficiency: On DiT-XL/2, FastCache achieved a 42.4% speedup, reducing per-step latency from 27.5ms to 15.8ms, while cutting memory usage from 13.2 GB to 11.2 GB.
- Quality: FastCache maintained superior generation quality compared to baselines. It achieved an FID of 4.46 on ImageNet, outperforming FBCache (4.48) and AdaCache (4.64).
- Video Fidelity: In video generation (VD-DiT-B/2), the method provided a 33.1% speedup with negligible impact on FVD (164.5 vs. 162.1 baseline).
Theoretical Insights
The success of FastCache is grounded in Harsanyi interaction theory. The authors demonstrate that in low-motion regions, complex high-order interactions between tokens are negligible. Consequently, a first-order linear approximation is mathematically sufficient to represent these states, whereas full transformer blocks remain necessary only for the complex interactions within dynamic objects.
Conclusion
FastCache provides a robust, statistically grounded framework for accelerating Diffusion Transformers. By replacing "blind" caching with learnable linear approximations and rigorous token selection, it achieves significant gains in inference speed and memory efficiency without sacrificing visual fidelity. Future work aims to extend this approach to the training phase and real-time streaming applications.
Summary updated