FastCache: Fast Caching for Diffusion Transformer Through Learnable Linear Approximation

Dong Liu, Yanxuan Yu, Jiayi Zhang, Yifan Li, Ben Lengerich +1 more
5/26/2025
27 citations
cs.LGcs.AIcs.CV
diffusion-flowtransformer-attention

Official code: NoakLiu/FastCache-xDiT (53 stars, Python, Apache-2.0, last commit 2026-08-02).

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 \textbf{FastCache}, a hidden-state-level caching and compression framework that accelerates DiT inference by exploiting redundancy within the model's internal representations.

Show full abstract

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 fall below a predefined threshold. 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, achieving the best generation quality among existing cache methods, as measured by FID and t-FID. To further improve the speedup of FastCache, we also introduce a token merging module that merges redundant tokens based on k-NN density. Code is available at \href{https://github.com/NoakLiu/FastCache-xDiT}{https://github.com/NoakLiu/FastCache-xDiT}.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

FastCache: Fast Caching for Diffusion Transformer Through Learnable Linear Approximation [Efficient ML Model]

537Python, ShellMay 14, 20254 months agoApache-2.0
cachediffusiondiffusion-transformersefficient-deep-learningefficientml+2 more

Similar Papers

Cite this paper

@article{liu2025fastcache,
  title  = {FastCache: Fast Caching for Diffusion Transformer Through Learnable Linear Approximation},
  author = {Dong Liu and Yanxuan Yu and Jiayi Zhang and Yifan Li and Ben Lengerich and Ying Nian Wu},
  year   = {2025},
  eprint = {2505.20353},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.20353v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.20353.svg)](https://codeofpaper.com/paper/2505.20353)

Discussion