Organizations: Shanghai Jiao Tong University · Southern University of Science and Technology · Alibaba Cloud · Huazhong University of Science and Technology
Diffusion transformers have become the most powerful models for visual generation, but still suffer from massive computation costs. To solve this problem, feature caching has been proposed to cache the features of diffusion models in the previous computation steps and then reuse them in the following caching steps, which brings significant acceleration but also degradation in generation quality. To address this problem, this paper proposes Z-cache as a feature caching method that can maintain high-quality generation through self-reflection. Concretely, we observe that the error from feature caching tends to be sharply reduced after each full computation. Based on this observation, Z-Cache is designed to first predict the features in the future caching steps and then perform a full computation. After that, Z-Cache returns to the caching steps and re-predicts them based on the previous and the current computation steps, which brings correction in features. Experiments demonstrate that with Z-Cache, diffusion transformers achieve comparable generation quality to the original model but with faster inference speed, for instance, 6.22X acceleration on FLUX-dev for text-to-image generation. Our code is released on GitHub.
Figures & tables
Figure 2: Visualization of the per-layer L1 error from feature caching. It is observed that there exists a periodic decline in L1 error, which is caused by the full-computation step in feature caching. The proposed Z-Cache utilizes this phenomenon and derives fewer cumulative errors.
Figure 1: Images sampled by 6.22 × accelerated FLUX.1-dev with Z-Cache .
Figure 3: Pipeline of Z-Cache. The figure uses the reverse-diffusion notation t,t−1,… for visualization, while the text uses a sampling-order index that increases along denoising. Traditional feature caching forecasts an active window from a past full-computation anchor and directly moves to the next window. In contrast, Z-Cache treats the window as provisional: after obtaining the next scheduled full-computation anchor, it revisits the same window, constructs dual-anchor hidden estimates, re-samples the window trajectory, and commits the reflected window-end latent. Z-Cache therefore performs in-loop trajectory correction without adding extra full-computation steps.
Method
Efficient Attention
Latency(s) ↓
FLOPs(T) ↓
F-Speed ↑
FID ↓
sFID ↓
Inception Score ↑
PSNR ↑
SSIM ↑
LPIPS ↓
DDIM-50 steps
✔
0.428
23.74
1.00 ×
2.32
4.32
241.25
∞
1.00
0.000
DDIM-12 steps
✔
0.128
5.70
4.17 ×
7.80
8.03
184.50
22.70
0.742
0.196
L2C(NFE=30)
✔
0.281
11.55
2.05 ×
2.61
-
237.83
-
-
-
SmoothCache ( α=0.22 )
✔
0.251
8.57
2.77 ×
4.15
-
231.71
-
-
-
DDIM-10 steps
✔
0.115
4.75
5.00 ×
12.15
11.33
159.13
21.52
0.687
0.251
FORA ( N=5 )
✔
0.149
5.24
4.53 ×
6.58
11.29
193.01
21.85
0.692
0.235
Table 1: Quantitative comparison on class-to-image generation on ImageNet with DiT-XL/2. F-Speed denotes the FLOPs reduction relative to DDIM with 50 steps. Metrics marked with “-” are left unreported, as they were not provided in the original publications.
Figure 4: The Trajectories of PCA components of hidden features. Z-Cache has the minimum divergence to the ground-truth comparing with other methods.
Method (FLUX.1-dev)
Peak Mem (GiB) ↓
Latency(s) ↓
L-Speed ↑
FLOPs(T) ↓
F-Speed ↑
PSNR ↑
SSIM ↑
LPIPS ↓
IR ↑
Equivalent cache interval N=6
TeaCache (L=.8)
35.77
2.53
3.67 ×
891.97
4.17 ×
28.47
0.6084
0.4691
1.0246
TeaCache + Z-Cache (L=.8)
39.99
5.07
1.83 ×
896.71
4.15 ×
28.65
0.6367
0.4328
1.0147
TaylorSeer
39.96
3.10
3.00 ×
745.54
4.99 ×
28.84
0.6302
0.4359
0.9737
TaylorSeer + Z-Cache
39.96
3.29
2.82 ×
746.47
4.98 ×
29.22
0.6539
0.3914
0.9882
SpeCa (100,1,4,20)
40.02
3.24
2.86 ×
756.87
4.91 ×
28.78
0.6617
0.4034
0.9517
Table 2: Full paired results for cache predictors on FLUX.1-dev with DrawBench. Rows are grouped by the equivalent cache interval N . Bold quality metrics indicate the better value within each Base/ + Z-Cache pair; gray rows identify + Z-Cache. Parameters are abbreviated in parentheses: TeaCache uses (L) , where L=rel_l1_thresh ; SpeCa uses (B,D,m,M)=(base,decay,min,max) ; MagCache uses (T,K,R)=(th,K,retention) .
Figure 5: Semantic stability under increasing cache interval N . As the cache interval increases, TaylorSeer gradually accumulates semantic drift, while Z-Cache maintains more stable object layout and visual identity.
Method
Efficient
Acceleration
VBench ↑
(on HunyuanVideo)
Attention
Latency(s) ↓
L-Speed ↑
FLOPs(T) ↓
F-Speed ↑
Score(%)
Original: 50 steps
✔
145.00
1.00 ×
29773.0
1.00 ×
80.66
22% steps
✔
31.87
4.55 ×
6550.1
4.55 ×
78.74
TeaCache (l=0.4)
✔
26.61
5.45 ×
6550.1
4.55 ×
79.36
FORA(N=5)
✔
34.39
4.22 ×
5960.4
5.00 ×
78.83
ToCa (N=5,R=90%)
✘
38.52
3.76 ×
7006.2
4.25 ×
78.86
Table 3: Quantitative comparison on text-to-video generation with HunyuanVideo on VBench. L-Speed and F-Speed are the latency and FLOPs speedups relative to the original 50-step model. Within each caching block, bold numbers indicate the best values, including ties.
Figure 6: Visualization of videos generated by Hunyuan Video with different feature caching methods. The annotated speedups denote FLOPs reductions relative to 50-step sampling.
Table 4: Additional quantitative results on few-step generation, image editing, U-Net backbones, and non-cache acceleration settings. All Z-Cache variants use the TaylorSeer predictor, and the number in parentheses is the cache interval.
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
N
Metric
TaylorSeer
Z-Cache
6
AUC ↓
0.212977
0.198117
6
Final rel.- L2↓
0.574011
0.546836
6
Final cosine ↑
0.823749
0.841404
8
AUC ↓
0.256287
0.235652
8
Final rel.- L2↓
0.669091
0.630887
8
Final cosine ↑
0.762938
0.792403
Appendix
Table 5: Global latent trajectories relative to the shared Full reference.
N
Metric
TaylorSeer
Z-Cache
6
AUC ↓
0.012688
0.008928
6
Endpoint rel.- L2↓
0.026057
0.016922
6
Endpoint cosine ↑
0.999620
0.999828
8
AUC ↓
0.020822
0.015519
8
Endpoint rel.- L2↓
0.045693
0.031364
8
Endpoint cosine ↑
0.998882
0.999430
Appendix
Table 6: Same-start local trajectories relative to the conditional local Full reference.
Fusion rule
SSIM ↑
LPIPS ↓
IR ↑
Original linear
0.6462
0.3914
0.9908
Remainder ratio
0.6474
0.3888
0.9763
Variance-optimal
0.6476
0.3883
0.9863
Jet smoothstep
0.6471
0.3898
0.9821
Appendix
Table 7: Fusion-function ablation. Bold marks the best point estimate in each SSIM, LPIPS, and IR column; no confidence intervals or human-preference study establish quality significance.
Backend
SSIM ↑
LPIPS ↓
IR ↑
Block-wise linear
0.6462
0.3914
0.9908
Root-residual state graft
0.6505
0.3797
0.9916
Backend
Latency (s) ↓
TFLOPs ↓
Peak GiB ↓
Block-wise linear
6.7656
747.502
41.652
Root-residual state graft
5.4130
747.095
40.011
Appendix
Table 8: Two replay backends under the same TaylorSeer N=6 schedule. Image quality uses DrawBench200; efficiency is a separate frozen-prompt A100 diagnostic.
Base
N
Arm
FULL
F-Speed
SSIM
LPIPS
IR
↑
↑
↓
↑
SenCache
6
Base
10.000
4.996
0.6115
0.5126
0.7210
6
+Z
10.000
4.987
0.6149
0.4917
0.7985
SenCache
7/8
Base
8.000
6.243
0.5943
0.5559
0.5486
7/8
+Z
8.000
6.230
0.5982
0.5289
0.6256
D2Cache
6
Base
10.045
4.996
0.6488
0.4211
0.9536
Appendix
Table 9: Matched recent-predictor results. FULL is the mean number of primary FULL evaluations across 200 samples. F-Speed is measured on one frozen prompt-0 trajectory; it is not a mean over 200 prompts or a latency speedup.
Diffusion model caching reuses features, activations, or attention states across denoising steps to reduce inference cost while preserving output quality.
Independent Researcher, Santa Clara, California, United States · Independent Researcher, Mountain View, California, United States · University of Electronic Science and Technology of China
Shenzhen Ubiquitous Data Enabling Key Laboratory, Shenzhen International Graduate School, Tsinghua University, Shenzhen, China · Central Media Technology Institute, Huawei Technologies Co., Ltd., Shenzhen, China