This paper introduces ToCa (Token-wise Feature Caching), a training-free method designed to significantly speed up Diffusion Transformers (DiTs). By recognizing that not all pixels (or tokens) are equally important during the image generation process, the authors achieve up to a 2.36× speedup on state-of-the-art models like OpenSora and PixArt-α with virtually no loss in visual quality.
TL;DR
ToCa accelerates Diffusion Transformers by adaptively caching and reusing hidden features for "redundant" tokens across timesteps. Unlike previous methods that cache entire layers uniformly, ToCa uses a multi-factor scoring system to identify which specific tokens are sensitive to errors. This allows for fine-grained, training-free acceleration that maintains high generation fidelity.
What Problem Does This Paper Address?
Diffusion models generate images and videos through an iterative denoising process that is computationally expensive. Diffusion Transformers (DiTs)—the architecture behind powerful models like Sora and FLUX—are particularly heavy because their self-attention mechanism scales quadratically with the number of tokens.
Existing acceleration methods often use feature caching: they compute features at one timestep and reuse them for the next. However, these methods typically treat the entire image or entire layers as a single unit. The authors discovered two critical flaws in this "naive" approach:
- Temporal Redundancy varies by token: Some tokens (like static backgrounds) change very little between steps, while others (moving subjects or intricate details) change rapidly.
- Error Propagation: Errors introduced by caching a single "influential" token can propagate through the self-attention mechanism, causing a 10× greater drop in quality compared to caching a less influential token.
Methods
The core of the paper is the ToCa framework, which introduces a "token-wise" selection strategy. Instead of caching everything, it calculates a Caching Score $S(x_i)$ for every token to decide whether to recompute it or fetch it from the cache.
The scoring function is composed of four sub-scores:
- Influence to Other Tokens ($s_1$): Uses self-attention maps to identify tokens that "talk" to many others. These influential tokens are recomputed to avoid spreading errors.
- Control Ability ($s_2$): Uses cross-attention entropy to see which tokens are most influenced by the text prompt. Tokens critical for text-alignment are kept "fresh."
- Cache Frequency ($s_3$): Tracks how often a token has been cached. If a token is cached too many times in a row, the error accumulates exponentially, so $s_3$ forces a refresh.
- Uniform Spatial Distribution ($s_4$): A "spatial bonus" that ensures cached tokens are distributed evenly across the image, preventing localized artifacts or "image collapse."
Additionally, ToCa employs a Layer-wise Strategy:
- Depth: Deeper layers (closer to the output) have higher temporal redundancy and can tolerate higher caching ratios.
- Type: MLP and cross-attention layers are cached more aggressively than self-attention layers, as the latter are more sensitive to error propagation.
Datasets and Evaluation
The authors evaluated ToCa across a variety of generative tasks and architectures:
- PixArt-α: For high-resolution text-to-image generation.
- OpenSora: For text-to-video generation.
- DiT-XL/2: For class-conditional image generation on ImageNet.
- FLUX.1 (dev/schnell): For state-of-the-art high-resolution image synthesis.
- Benchmarks: Evaluated using MS-COCO 2017, PartiPrompts, and VBench (for video).
Key Insights and Ideas
- The "Aha!" Moment on Error Sensitivity: The authors found that applying the same amount of noise to different tokens results in vastly different final errors. Caching a token in the first layer can be 10× more destructive than caching one in a later layer.
- Attention as a Proxy for Importance: You don't need a separate neural network to find "important" tokens. The attention weights already inside the transformer are excellent indicators of which tokens are driving the generation and which are just background.
- Training-Free is Key: Because ToCa relies on the inherent properties of the transformer (attention maps and feature distances), it requires zero fine-tuning. It is a "plug-and-play" module for existing pre-trained models.
Key Results
- OpenSora: Achieved a 2.36× speedup with a VBench score of 78.34% (nearly identical to the 79.13% of the non-accelerated model). It significantly outperformed the previous state-of-the-art, FORA.
- PixArt-α: Achieved a 1.93× speedup with almost no drop in FID (a measure of image quality). On the PartiPrompts benchmark, it actually improved the CLIP score (text alignment) by 1.13 points.
- FLUX.1: On the 4-step FLUX.1-schnell model, ToCa provided a 1.53× speedup while maintaining an Image Reward score nearly identical to the original.
- Qualitative Superiority: In side-by-side comparisons, ToCa avoids the "blurring" or "content drifting" seen in other caching methods, especially in complex areas like text rendering or fine textures.
Limitations and Future Work
- Hyperparameter Sensitivity: While the method is training-free, it does require setting weights ($\lambda$) for the four sub-scores. The authors note that while these are relatively stable within a model family (like DiT), they may need slight adjustments when moving between very different architectures.
- Hardware Overhead: Calculating the scores adds a tiny amount of overhead (less than 1% of total computation). However, the real-world speedup depends on how efficiently the underlying deep learning framework handles the sparse updates to the feature cache.
- Future Directions: The authors suggest combining ToCa with other orthogonal acceleration techniques, such as Quantization (reducing bit-precision) or Step Distillation, to push inference speeds even further toward real-time performance.
Summary updated