Learning-to-Cache: Accelerating Diffusion Transformer via Layer Caching
Xinyin Ma, Gongfan Fang, Michael Bi Mi, Xinchao Wang
Abstract
Diffusion Transformers have recently demonstrated unprecedented generative capabilities for various tasks. The encouraging results, however, come with the cost of slow inference, since each denoising step requires inference on a transformer model with a large scale of parameters. In this study, we make an interesting and somehow surprising observation: the computation of a large proportion of layers in the diffusion transformer, through introducing a caching mechanism, can be readily removed even without updating the model parameters. In the case of U-ViT-H/2, for example, we may remove up to 93.68% of the computation in the cache steps (46.84% for all steps), with less than 0.01 drop in FID. To achieve this, we introduce a novel scheme, named Learning-to-Cache (L2C), that learns to conduct caching in a dynamic manner for diffusion transformers. Specifically, by leveraging the identical structure of layers in transformers and the sequential nature of diffusion, we explore redundant computations between timesteps by treating each layer as the fundamental unit for caching. To address the challenge of the exponential search space in deep models for identifying layers to cache and remove, we propose a novel differentiable optimization objective. An input-invariant yet timestep-variant router is then optimized, which can finally produce a static computation graph. Experimental results show that L2C largely outperforms samplers such as DDIM and DPM-Solver, alongside prior cache-based methods at the same inference speed. Code is available at https://github.com/horseee/learning-to-cache
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 7cddcec1-eeeb-448d-b335-32f265e81e40Cited by top-tier papers75
- dKV-Cache: The Cache for Diffusion Language ModelsXinyin Ma, Runpeng Yu, Gongfan Fang, Xinchao WangNeurIPS 2025 · 145 citations
- Autoregressive Adversarial Post-Training for Real-Time Interactive Video GenerationShanchuan Lin, Ceyuan Yang, Hao He, Jianwen Jiang et al.NeurIPS 2025 · 89 citations
- SP-VLA: A Joint Model Scheduling and Token Pruning Approach for VLA Model AccelerationYe Li, Yuan Meng, Zewen Sun, Kangye Ji et al.ICLR 2026 · 60 citations
- MagCache: Fast Video Generation with Magnitude-Aware CacheZehong Ma, Longhui Wei, Feng Wang, Shiliang Zhang et al.NeurIPS 2025 · 41 citations
- LazyDiT: Lazy Learning for the Acceleration of Diffusion TransformersXuan Shen, Zhao Song, Yufa Zhou, Bo Chen et al.AAAI 2025 · 40 citations
Builds on39
- Denoising Diffusion Probabilistic ModelsJonathan Ho, Ajay Jain, Pieter AbbeelNeurIPS 2020 · 35,902 citations
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
- Diffusion Models Beat GANs on Image SynthesisPrafulla Dhariwal, Alexander Quinn NicholNeurIPS 2021 · 13,211 citations
- High-Resolution Image Synthesis with Latent Diffusion ModelsRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser et al.CVPR 2022 · 13,123 citations
- Denoising Diffusion Implicit ModelsJiaming Song, Chenlin Meng, Stefano ErmonICLR 2021 · 11,743 citations
Related papers
- Cache Me if You Can: Accelerating Diffusion Models through Block CachingFelix Wimbauer, Bichen Wu, Edgar Schönfeld, Xiaoliang Dai et al.CVPR 2024 · 25 citations
- Beyond Fixed Formulas: Data-Driven Linear Predictor for Efficient Diffusion ModelsZhirong Shen, Rui Huang, Jiacheng Liu, Chang Zou et al.CVPR 2026 · 1 citation
- DiffSparse: Accelerating Diffusion Transformers with Learned Token SparsityHaowei Zhu, Ji Liu, Ziqiong Liu, Dong Li et al.ICLR 2026 · 2 citations
- DeepCache: Accelerating Diffusion Models for FreeXinyin Ma, Gongfan Fang, Xinchao WangCVPR 2024 · 87 citations
- Diffusion on Demand: Selective Caching and Modulation for Efficient GenerationHee Min Choi, Hyoa Kang, Dokwan Oh, Nam Ik ChoNeurIPS 2025 · 2 citations
