WorksComputer Science
OnCache: Learning Dynamic Caching Schedules for Efficient Diffusion Inference
Abstract
Diffusion models have revolutionized generative tasks but incur high inference latency due to iterative denoising. Cache-based strategies accelerate inference by reusing intermediate features, yet they largely rely on static, sample-agnostic schedules. Our empirical analysis reveals two factors that these schedules overlook. (i) denoising dynamics and computational requirements vary across prompts, motivating adaptive computation allocation. (ii) sensitivity to caching errors varies across timesteps, so static schedules may reuse features at error-sensitive steps or waste computation at less sensitive ones. We therefore propose OnCache, a dynamic caching framework that makes prompt-adaptive decisions online about how much computation to allocate and when to refresh cached features. A policy is trained offline on paired compute and cache continuations from identical denoising states, using differences in terminal fidelity and the number of function evaluations (NFE) to account for the downstream consequences of each decision. To further improve the generation quality, a neural corrector compensates for caching-induced errors and mitigates their accumulation throughout the denoising trajectory. Both components are lightweight and introduce negligible additional inference latency. On FLUX.1-dev, OnCache achieves a nearly generation speedup at resolution, with LPIPS of and SSIM of . We further extend OnCache to video generation on Wan2.1-T2V-1.3B, achieving state-of-the-art efficiency–quality trade-offs across both modalities.
Figure 1. Preserving structure and detail with OnCache. Values give LPIPS to Reference (), with actual computation in parentheses.
Introduction
Diffusion models have become a leading paradigm for visual generation, producing high-quality images [7, 26] and videos [36]. Modern systems increasingly combine iterative denoising with scalable Transformer backbones (DiTs) [2, 23], requiring repeated passes through a large network for each generated output. As model capacity and generation quality grow, this repeated computation becomes a substantial inference bottleneck. Reducing its cost while retaining the quality of full-step generation is therefore central to the practical deployment of diffusion models.
Diffusion acceleration addresses this cost from several directions. Improved samplers reduce denoising evaluations through implicit updates and higher-order numerical integration [9, 14, 17, 18, 31, 41]. Distillation compresses pretrained diffusion models into few-step or one-step generators through progressive, consistency-based, and distribution-matching objectives [16, 19, 29, 32, 37, 38]. Feature caching offers a complementary approach by exploiting temporal redundancy within the denoiser [21, 34]. Intermediate representations can be reused across neighboring timesteps, bypassing expensive computation while keeping the pretrained backbone fixed. The resulting efficiency–quality trade-off depends on the amount of cache-reuse and the placement of full evaluations that refresh the cache.
Many feature caching methods determine a shared cache-refresh schedule offline. ERTACache identifies reusable timesteps through residual error profiling, while DPCache and BudCache optimize calibrated path costs and final-output quality, respectively [5, 10, 24]. More adaptive methods, including TeaCache, SeaCache, and DiCache, adjust refresh decisions along the running trajectory using input changes, spectral information, or shallow probes [3, 4, 12]. BAG further learns online gates from searched prompt–budget schedules while enforcing a prescribed per-sample computation [40]. These approaches make refresh timing responsive to individual trajectories, but adaptation remains driven by local proxy signals or constrained to allocating a fixed budget within each sample. A more adaptive online policy must jointly determine how much computation each sample receives and when to spend it, according to the downstream fidelity benefit of each refresh. We identify two forms of heterogeneity that motivate this joint allocation across samples and timesteps, as illustrated in Figure 2:
Figure 2. A computation budget can be reallocated across samples and timesteps. (a) Moving one full evaluation between two samples improves both outputs at unchanged aggregate computation. (b) Changing refresh locations improves final-image fidelity for the same prompt (with the same total NFE). Lower LPIPS indicates closer agreement with the full reference.
Sample-level heterogeneity. Different prompts and denoising trajectories tolerate different amounts of reuse. In Figure 2a, DP Init (OnCache’s initial static schedule, optimized offline via dynamic programming) and ERTACache each use ten NFE for both prompts. OnCache uses nine for each beach scene and eleven for the bird scene, producing outputs closer to their full-step references with the same total twenty NFE. The useful computation budget therefore varies across samples: allocating a larger NFE where it improves fidelity and reusing features more aggressively elsewhere can improve quality under the same aggregate NFE budget. This is the question of how much to cache.
Timestep-level heterogeneity. Feature reuse has different consequences at different points in a denoising trajectory. Figure 2b holds the prompt, initial noise, and ten-NFE budget constant. By selecting different refresh locations, OnCache reduces final-image LPIPS to 0.157, compared with 0.235 for DP Init and 0.303 for ERTACache. Thus, under a fixed NFE budget, refreshes should be spent at states where fresh features most improve final-image fidelity by reducing the downstream impact of reuse errors. This is the question of when to cache.
Together, these observations motivate learning how much to cache across samples and when to cache within each trajectory. An average computation budget allows full evaluations to move between samples as well as between timesteps. The two decisions are coupled through the denoising dynamics: refreshing the cache changes the current prediction, subsequent latent states, and later caching decisions. A refresh costs one full evaluation now but can save evaluations later by enabling more reuse. An effective policy must therefore anticipate how the current choice between compute and cache affects both final-image fidelity and the total NFE.
We propose OnCache, a dynamic caching framework that allocates computation online across samples and timesteps according to the downstream value of each refresh. Trained offline with the diffusion backbone frozen, a compact policy observes the current denoising state and cache history to choose between full computation and cache-reuse at runtime. Its supervision comes from paired continuations: starting from an identical state, we execute the two alternative actions and let the same policy complete each branch on its resulting states. The difference in terminal fidelity to a full-step reference measures the benefit of refreshing, while the difference in total NFE measures its cost. Renewed paired queries refine the policy using the states it visits as its behavior changes. A global offset sets the average budget, allowing both NFE and refresh locations to vary across samples.
At cache steps, errors between cache and compute features propagate through later denoising updates. OnCache pairs the policy with a lightweight neural corrector that uses residual history and current input drift to compensate for errors in reused features. With the policy fixed, we query the full backbone at selected states along its denoising trajectories to obtain target features and predictions. These targets provide supervision for training the corrector. At inference, the corrector adjusts cached features, and the policy adapts its caching decisions online to the resulting trajectory. Together, our proposed OnCache improves the efficiency–quality trade-off by adapting computation online and reducing local errors from feature reuse.
Our core contributions can be summarized as follows:
We formulate diffusion caching as sequential online allocation under an average budget, enabling a learned policy to adapt both how much to cache across samples and when to cache along each denoising trajectory.
We develop paired-continuation supervision that connects individual decisions to terminal fidelity gains and NFE costs, together with a separately trained corrector that further improves final generation quality.
Experiments on image and video generation demonstrate state-of-the-art efficiency–quality trade-offs compared with strong recent baselines, validating the effectiveness of dynamic online computation allocation.
Related Work
Cache reuse and correction. Feature caching reuses intermediate representations across denoising steps [21, 34]. TaylorSeer and Spectrum predict feature evolution from cached history [6, 13], while ERTACache combines residual rectification with timestep adjustment [24].
Adaptive caching. TeaCache, SeaCache, and DiCache adapt refresh decisions using input changes, spectral evolution, and shallow probes, respectively [3, 4, 12]. EpaCache calibrates timestep tolerances from the terminal impact of isolated cache actions [15]. OnCache learns final-image fidelity gains and NFE differences from paired continuations that follow the same policy after the initial action.
Learned and budgeted scheduling. DPCache optimizes calibrated path costs, BudCache searches shared schedules, and ReCache learns them from terminal rewards [1, 5, 10]. BAG distills searched prompt–budget schedules into online gates with exact per-image NFE [40]. Our proposed OnCache initializes data collection with DP and learns state-dependent decisions under an average budget, adapting both NFE and refresh timing across samples. Appendix Appendix § 13 covers broader acceleration methods and detailed comparisons.
Methodology
OnCache pairs an adaptive policy that allocates full evaluations under an average budget with a corrector that adjusts reused features. We first obtain a static schedule with dynamic programming, then optimize the policy from paired continuations, and finally train the corrector with the policy fixed. All training is offline with the diffusion backbone frozen. Figure 3 shows the inference procedure.
Figure 3. OnCache inference framework. (a) Conditioned generation repeatedly applies an OnCache denoising step, producing intermediate latents. (b) The policy observes the causal state and selects full computation () or cache reuse (). Full computation refreshes the residual cache with ; cache reuse forms , where is the most recent refresh index. The corrector adjusts reused features before the output head; denotes the resulting adjustment to the denoiser output.
Problem Formulation
We consider a diffusion-based generative process that progressively denoises a latent variable from to over sampling steps. At step , the denoiser takes the current noisy sample and conditioning . We write it as an input embedding , a Transformer stack , and an output head . Given , the Transformer output can be expressed in residual form as:
The denoiser prediction is , and the sampler advances to . Previous work, such as ERTACache [24], shows that residual features often evolve smoothly across adjacent timesteps. This temporal redundancy suggests approximating with the cached residual from the most recent full evaluation at step .
We introduce a binary action at each step: performs full backbone computation, and reuses the cached residual. The update rule is:
When , the exact residual refreshes the cache. When , reusing bypasses the Transformer stack. With NFE counting full evaluations, OnCache selects actions to preserve final-output fidelity under an average computation budget across samples.
Policy for Adaptive Computation
Policy Learning Motivation. Under an average NFE budget, the policy must decide whether a refresh is worth its cost. A refresh changes the current prediction and later policy decisions: computing now may enable more reuse later. Its benefit is the change in final fidelity, while its cost is the change in total NFE, not necessarily one extra evaluation. In the final fitting bank, refreshing leads to the same or fewer total NFE than reuse in 797 of 1,792 paired continuations (44.5%; 95% prompt-bootstrap interval 41.9–47.0%; Figure 4a). We therefore learn the final-fidelity gain and total NFE change from paired compute and cache continuations.
Figure 4. Continuation costs and same-state correction. (a) NFE changes from 1,792 queries on 256 prompts at native resolution. (b) Mean relative output error on 640 same-state queries from 80 corrector-validation trajectories. Error bars give 95% prompt-cluster bootstrap intervals (5,000 resamples).
Dynamic programming initialization.
We initialize policy learning with a shared schedule of full evaluations over denoising steps. Following prior work on DP-based cache scheduling [5], we use dynamic programming (DP) to find a schedule that minimizes a residual-mismatch proxy. This gives policy learning an informed starting point rather than an arbitrary refresh schedule. On full-compute trajectories for profiling prompts , we form residual summaries by subsampling tokens and channels. Reusing the residual from step at step incurs the proxy error:
Here MS is the mean squared entry, controls time weighting, and stabilizes normalization. The interval cost sums errors over skipped steps. Let be the minimum proxy cost of reaching refresh with full evaluations. The initial table stores the prescribed boundary costs and is infinite elsewhere. For admissible predecessors , the recurrence is:
Backtracking recovers the schedule. We follow this schedule to collect initial trajectory states, then construct paired compute/cache continuations from those states to train the policy. The schedule also serves as a static control. Appendix B.1 gives the profiling, search and pseudo code details.
Policy learning.
At each cache-eligible step, the policy observes the current input , conditioning , sampling progress , and trajectory history , which contains past inputs, actions, and cached residuals. It constructs a causal state and dynamically selects a binary action:
Here is a fixed state-construction map that summarizes the inputs using pooling, statistics, and projections, capturing input drift and residual changes. It uses information available before the current backbone evaluation, and only full evaluations update the cached residual history. The score determines whether to refresh, while the shared offset controls the average computation budget. We encode the DP schedule as a timestep prior that raises the policy score at its refresh steps and lowers it at other eligible steps, guiding the initial policy toward this schedule.
To learn the score , we collect states along the DP schedule initially and along the current policy in later rounds. At each selected state, we start paired continuations with opposite actions: one refreshes and the other reuses the cache. Both then follow the same frozen collection strategy on their respective states until generation completes. For action , let be the resulting output’s scaled fidelity vector relative to the full-step reference, comprising negated LPIPS [39], SSIM [33], and PSNR so that higher values indicate better fidelity. Let denote the total number of full evaluations in that branch. The paired targets are the fidelity gain and change in total computation:
The shared prefix cancels in , leaving the effect of the current action and all subsequent decisions. A refresh can therefore have zero or negative net NFE cost if it leads to sufficiently fewer later full evaluations.
Let be the set of collected paired queries. Each query provides a state , fidelity gain , and NFE change . A linear predictor estimates the concatenation of these targets from state–time features. We fit its coefficients by weighted, regularized least squares:
Here weights the contribution of query . The regularization term is a weighted sum of squared coefficients, with the diagonal matrix setting the penalty strength for each feature. For state , the fitted predictor estimates the fidelity gain and NFE change . These predictions and the DP time prior form the initial policy score.
As the policy visits new states, we collect new paired continuations and refit the predictor. We combine its predicted fidelity gain and NFE change into a net refresh value:
Here weights the predicted fidelity gains and controls the contribution of the predicted NFE change. A positive favors refreshing over reuse under this fidelity–computation trade-off; a negative favors reuse.
With fixed, let and denote the policy scores before and after the update. Their decision scores satisfy:
The difference inside the clip compares the predicted net value with the old decision score, shifting the score in the direction of the predicted value. The strength controls the update, while the clip limits its magnitude. For example, when but the old decision score is negative, the update raises the score and can change the action from reuse to refresh in Eq. (5). Subtracting gives the equivalent update of the policy score itself:
For inference, the policy and its shared offset are frozen, while decisions remain state-dependent and NFE can vary across samples. Appendix § 8.§ 2 gives further details.
Corrector for Reused Hidden States
Motivation. Cache reuse inevitably introduces approximation errors. The corrector reduces these errors locally: on 640 same-state validation queries (Figure 4b), the frozen corrector reduces mean relative output error by 19.5% (95% prompt-bootstrap interval 19.0–20.1%). By improving predictions at cache steps, it can also mitigate error propagation through subsequent denoising steps (Figure 6).
Figure 6. Error propagation on FLUX. Cumulative hidden-residual error (top) and latent deviation (bottom) from Full30, averaged over five prompts and five seeds at and 10 NFE.
Cache-anchored hidden correction. With policy fixed, a lightweight network predicts a hidden adjustment and applies it before the output head:
The inputs summarize the most recent paid residual, its first difference from the preceding paid residual, input drift, and sampler time. The first difference is scaled by the actual noise-level intervals. A depthwise convolution and channel gating mix the features; time-conditioned normalization and a gated feed-forward block precede a zero-initialized projection to the hidden space (see Appendix § 9 for implementation details and § 4.5 for component ablations).
Same-state supervision. With the policy fixed, we run the full backbone offline on cache steps. These evaluations leave the sampling trajectory and residual history unchanged. We detach the teacher outputs from the computation graph and use them to define targets for the hidden and final states:
The corrector learns the hidden representation and aligns the resulting denoiser output with full computation through the frozen output head. Using SmoothL1 loss SL1, we write:
The normalization operators use training-set hidden and output scales. We first fit the hidden loss, add output consistency with , and then refine on a balanced mix of original and corrected trajectories. Only receives gradients. At inference, both modules are frozen, with the corrector compensating for cache-induced errors and the policy observing the corrected resulting trajectory.
Experiments
Experimental Settings
Models and evaluation. We evaluate FLUX.1-dev [2] on 1,000 COCO captions [11] at and , using 30 sampling steps and seed 42. Wan2.1-T2V-1.3B is evaluated on the full VBench [8], using five seeds per prompt (0–4), 50 sampling steps, 81 frames, and 832 × 480 resolution. For FLUX, we compare TeaCache [12], SeaCache [4], DiCache [3], Spectrum [6], TaylorSeer [13], DPCache [5], BudCache [10], and ERTACache [24] using public implementations. Wan uses the same baselines except Spectrum and DPCache. DP Init provides our static initialization. OnCache variants (with / without corrector) target mean NFE budgets of ten for FLUX and twenty for Wan.
Metrics and timing. LPIPS [39], SSIM [33], and PSNR measure fidelity to matched full-step references. We additionally report ImageReward [35] for FLUX and VBench [8] for Wan. Generation is timed on one NVIDIA H20 GPU, including online overhead, sampling, and VAE decoding. Speedup is relative to the full reference. Appendix § 7 gives software details and baseline settings.
Main Experimental Results
Table 1 and 2 report the results. On both backbones, the policy alone improves all fidelity metrics over DP Init at comparable mean NFE. The full OnCache method (with corrector) achieves state-of-the-art performance on both backbones.
| Method | Mean NFE | Gen. (s) ↓ | Speedup ↑ | LPIPS ↓ | SSIM ↑ | PSNR ↑ | ImageReward ↑ |
| Full30 | 30.000 / 30.000 | 6.064 / 19.455 | 1.00× / 1.00× | – / – | – / – | – / – | 0.965 / 1.040 |
| TeaCache | 10.033 / 10.040 | 2.118 / 6.701 | 2.86× / 2.90× | 0.349 / 0.397 | 0.663 / 0.685 | 17.48 / 17.00 | 0.929 / 0.961 |
| TaylorSeer | 10.000 / 10.000 | 2.370 / 7.269 | 2.56× / 2.68× | 0.219 / 0.232 | 0.753 / 0.776 | 20.21 / 20.34 | 0.937 / 0.985 |
| ERTACache | 10.000 / 10.000 | 2.097 / 6.659 | 2.89× / 2.92× | 0.214 / 0.266 | 0.768 / 0.771 | 21.21 / 20.82 | 0.956 / 1.000 |
| SeaCache | 10.003 / 9.982 | 2.127 / 6.689 | 2.85× / 2.91× | 0.179 / 0.217 | 0.805 / 0.810 | 22.64 / 22.17 | 0.951 / 0.991 |
| DiCache | 10.006 / 10.029 | 2.182 / 6.922 | 2.78× / 2.81× | 0.186 / 0.206 | 0.800 / 0.823 | 22.95 / 23.39 | 0.941 / 0.978 |
| DPCache | 10.000 / 10.000 | 2.238 / 6.933 | 2.71× / 2.81× | 0.163 / 0.198 | 0.805 / 0.804 | 22.54 / 22.17 | 0.958 / 0.989 |
| Spectrum | 10.000 / 10.000 | 2.117 / 6.725 | 2.86× / 2.89× | 0.147 / 0.215 | 0.819 / 0.803 | 24.23 / 23.83 | 0.983 / 1.003 |
| BudCache | 10.000 / 10.000 | 2.095 / 6.657 | 2.89× / 2.92× | 0.143 / 0.185 | 0.828 / 0.832 | 24.77 / 24.78 | 0.968 / 0.992 |
| DP Init | 10.000 / 10.000 | 2.091 / 6.668 | 2.90× / 2.92× | 0.158 / 0.201 | 0.824 / 0.827 | 24.35 / 24.29 | 0.929 / 0.974 |
| OnCache (w/o) | 9.867 / 10.175 | 2.098 / 6.771 | 2.89× / 2.87× | 0.144 / 0.176 | 0.835 / 0.841 | 24.92 / 24.69 | 0.950 / 0.994 |
| OnCache (w) | 9.856 / 10.164 | 2.113 / 6.813 | 2.87× / 2.86× | 0.127 / 0.156 | 0.857 / 0.860 | 25.55 / 25.52 | 0.989 / 1.007 |
Table 1. FLUX.1-dev on 1,000 COCO captions at 30 sampling steps. Each cell reports / resolution results. OnCache (w/o) disables the corrector; OnCache (w) is the full method. Bold/underlined scores mark the best/second-best results at each resolution.
Quantitative Comparison. For image generation on FLUX, at , OnCache (w) achieves 0.127 LPIPS, 0.857 SSIM, 25.55 dB PSNR, and 0.989 ImageReward, outperforming all accelerated baselines on every metric. Compared with BudCache, LPIPS improves from 0.143 to 0.127 and PSNR from 24.77 to 25.55 dB, while generation time remains close (2.113 vs. 2.095 s). For video generation on Wan, adding the corrector improves both reference fidelity and VBench with slightly lower mean NFE and nearly unchanged latency. At a speedup, our OnCache achieves a VBench score just 0.09% below full-step inference.
Qualitative fidelity. Figure 5 shows that OnCache better preserves visual details in both images (upper) and videos (lower). Appendix § 14 provides more examples.

Figure 5. Qualitative comparison of image and video. Upper: six FLUX.1-dev images from COCO. Lower: four evenly spaced frames from two Wan2.1-T2V-1.3B videos. Gold boxes and insets mark shared regions. Appendix § 14 gives further image comparisons.
Model Size and Computational Cost
Table 3 shows that both modules are lightweight and add little generation time on both backbones. The policy and corrector weights total 4.42 MB for FLUX and 2.47 MB for Wan. Enabling both modules increases measured generation time over DP Init by 1.05% and 0.83%, respectively. Appendix § 12 details offline teacher trajectory collection and policy/corrector optimization costs for both models.
| Model | Config | Params | Size (MB) | Time (s) |
| FLUX | DP Init | – | – | 2.091 |
| FLUX | + Policy | 51.7K | 0.418 | 2.098 (+0.33%) |
| FLUX | + Corrector | 1.00M | 4.003 | 2.113 (+0.71%) |
| Wan | DP Init | – | – | 147.137 |
| Wan | + Policy | 4.36K | 0.045 | 148.326 (+0.81%) |
| Wan | + Corrector | 0.606M | 2.424 | 148.365 (+0.03%) |
Table 3. Module size and generation time on FLUX and Wan.
Generalization Analysis
Across resolutions. The policy and corrector are trained on mixed and data. The policy uses fixed-dimensional pooled state features, while the corrector shares channel projections and spatial convolutions across token grids. OnCache generalizes zero-shot to the unseen resolution, achieving 0.156 LPIPS without fitting or selection at that resolution (as shown in Table 1).
Across budgets. Adjusting only the operating offset allows the same frozen policy to target mean budgets of 8, 10, and 12 NFE. As computation increases, LPIPS consistently decreases while SSIM and PSNR increase (Table 4). The frozen corrector further improves all three metrics at every budget, showing consistent benefits across the policy trajectories induced at different budgets.
| Method | Target | NFE | LPIPS↓ | SSIM↑ | PSNR↑ |
| w/o | 8 | 8.000 | 0.2271 | 0.7541 | 21.839 |
| w | 8 | 8.000 | 0.2009 | 0.7861 | 22.512 |
| w/o | 10 | 10.000 | 0.1449 | 0.8364 | 24.770 |
| w | 10 | 10.085 | 0.1252 | 0.8602 | 25.447 |
| w/o | 12 | 12.045 | 0.1066 | 0.8808 | 26.303 |
| w | 12 | 12.030 | 0.0950 | 0.8935 | 26.747 |
Table 4. Frozen modules across budgets on 200 test captions. w/o and w denote OnCache without and with the corrector.
Across schedules (Corrector’s generalization). The corrector also improves a fixed BudCache schedule, enhancing all three fidelity metrics without retraining (Appendix § 11.§ 1).
Ablation Studies
Error propagation. Figure 6 compares denoising errors at 10 NFE. OnCache (w/o) already has lower cumulative hidden-residual error and latent deviation than SeaCache and ERTACache. Adding the corrector further reduces both errors. The full method shows more gradual error growth in later denoising steps and lower terminal deviation, highlighting the effectiveness of the policy and corrector.
Corrector components. Figure 7 compares the corrector’s inputs, architecture, and supervision under a fixed training budget and refresh schedule. Each variant is trained from scratch on 64 captions for 1,280 updates, with the backbone and policy frozen. The full design achieves the best mean LPIPS, SSIM, and PSNR across three training seeds. Removing the first residual difference, input drift, or output-velocity supervision causes the largest fidelity drops. Learned time conditioning and spatial mixing provide smaller gains, while adding a second difference or balanced trajectory refresh gives no improvement under this short training schedule. Appendix § 11.§ 2 details the training protocol and controls.
Figure 7. Corrector component ablations. Fidelity on 200 captions under the same 10/30 schedule. Points and whiskers show the mean and sample standard deviation across three seed means.
Conclusion
We presented OnCache, a dynamic caching framework that allocates computation online across samples and timesteps under average budgets. Paired-continuation supervision guides refresh decisions through their downstream effects on final-output fidelity and total computation, while a lightweight neural corrector mitigates feature-reuse errors and their propagation. Both modules are trained offline with a frozen backbone and add minimal inference overhead. Experiments on image and video models demonstrate state-of-the-art efficiency–quality trade-offs.
LLM Usage Statement
ChatGPT assisted with literature organization, writing, and LaTeX formatting. The authors take full responsibility for the scientific content and supporting evidence.
Evaluation Protocol and Reproducibility
Table 5 summarizes the hardware / software used for the main FLUX and Wan experiments. The code and experiment configurations will be released. For our fidelity measurements, each accelerated sample and its full-step reference use the same prompt and initial noise. LPIPS uses AlexNet on uncropped native-resolution images; SSIM and PSNR use scikit-image. Table 6 summarizes the main method settings for both FLUX and Wan main experiments.
| Component | FLUX | Wan |
| GPU | NVIDIA H20 | |
| Python | 3.11.18 | |
| CUDA | 13.0 | |
| PyTorch | 2.14.1+cu130 | |
| Diffusers | 0.41.0 | 0.33.1 |
| Transformers | 5.20.2 | 4.49.0 |
| NumPy | 2.2.6 | 1.26.4 |
Table 5. Hardware / software for the main generation experiments.
| Method | FLUX: , 30 steps | Wan: 50 steps |
| DP Init | Static schedule, 10 NFE | Static schedule, 20 NFE |
| OnCache (w/o) | ; no corrector | ; no corrector |
| OnCache (w) | Same policy, with corrector | Same policy, with corrector |
| TeaCache | Adaptive gate; 10.033 NFE | Adaptive gate; 23.741 NFE |
| SeaCache | Spectral gate; 10.003 NFE | Spectral gate; 20.007 NFE |
| DiCache | One-block probe; 10.006 NFE | One-block probe; 23.718 NFE |
| TaylorSeer | Block-wise forecast; 10 NFE | Block-wise forecast; 20 NFE |
| Spectrum | Chebyshev forecast; 10 NFE | – |
| DPCache | DP-optimized schedule; 10 NFE | – |
| ERTACache | Alignment and rectification; 10 NFE | Alignment and rectification; 24 NFE |
| BudCache | Stage 1 schedule; 10 NFE | Stage 1 schedule; 20 NFE |
Table 6. Baseline settings for FLUX.1-dev and Wan2.1-T2V-1.3B. Shown NFE values are means from Table 1 and Table 2. OnCache (w/o) and (w) share the policy without and with the corrector; – denotes a method not compared.
| Method | Mean NFE | Gen. (s) ↓ | Speedup ↑ | VBench ↑ | LPIPS ↓ | SSIM ↑ | PSNR ↑ |
| Full50 | 50.000 | 337.575 | 1.00× | 81.44% | – | – | – |
| TeaCache | 23.741 | 173.428 | 1.95× | 76.04% | 0.291 | 0.569 | 16.17 |
| ERTACache | 24.000 | 174.017 | 1.94× | 80.73% | 0.110 | 0.820 | 23.77 |
| TaylorSeer | 20.000 | 151.119 | 2.23× | 80.55% | 0.280 | 0.606 | 16.68 |
| SeaCache | 20.007 | 148.565 | 2.27× | 81.04% | 0.138 | 0.784 | 22.26 |
| DiCache | 23.718 | 193.889 | 1.74× | 81.10% | 0.103 | 0.841 | 23.67 |
| BudCache | 20.000 | 147.331 | 2.29× | 80.66% | 0.107 | 0.838 | 24.02 |
| DP Init | 20.000 | 147.137 | 2.29× | 80.51% | 0.175 | 0.766 | 20.74 |
| OnCache (w/o) | 20.026 | 148.326 | 2.28× | 80.91% | 0.113 | 0.832 | 23.79 |
| OnCache (w) | 19.901 | 148.365 | 2.28× | 81.35% | 0.093 | 0.854 | 24.89 |
Table 2. Wan2.1-T2V-1.3B with 50 steps, 832 × 480 resolution, 81 frames, and five seeds. Quality scores for TeaCache and ERTACache are taken from the ERTACache paper [24]. We remeasured their runtimes in our environment using 15 prompts. The 95% bootstrap confidence intervals are 173.26–173.60 s and 173.77–174.25 s, respectively.
Policy Implementation and Training
This section details the policy implementation, training, and online inference.
DP Profiling and Search
Profiling. For both FLUX and Wan, we run full-evaluation trajectories on profiling prompts and subsample the block-stack residuals at each step to obtain compact summaries . Equation (3) in the main paper compares summaries from a candidate refresh step and a later step, estimating the mismatch from residual reuse across prompts. These estimates provide the proxy costs for the DP search.
Search. The interval cost sums the mismatch proxy over steps between successive refreshes and . DP minimizes the sum of these interval costs subject to the budget and boundary constraints. The profiler supplies boundary paths and admissible intervals , so the predecessors of are . We fill the table in increasing order of and record each improving predecessor. Backtracking recovers the refresh steps; an infinite terminal cost indicates an infeasible budget. Given the interval costs, the search takes time and storage.
Detailed schedule. For 30-step FLUX generation, the retained 10-evaluation DP anchor uses indices:
The same anchor is used at both and .
For 50-step Wan generation, the 20-NFE DP schedule is:
These schedules initialize data collection, serve as DP Init controls, and provide the policy’s time prior. The deployed policy chooses refresh steps online. Algorithm 1 summarizes the dynamic programming search and traceback.
Algorithm 1 DP search for an initial refresh schedule
Require: Steps , budget , interval costs , predecessors
Require: Initial table with boundary paths; terminal boundary conditions and costs
Ensure: A -evaluation schedule, or infeasibility
; initialize records for the boundary paths
for do
for do
for do
if then
Record as the predecessor of
end if
end for
end for
end for
Select the lowest-cost admissible terminal path with evaluations, including boundary costs
if no finite admissible terminal path exists then
return infeasible
end if
Backtrack through the recorded predecessors to an initial boundary path
return the boundary path and recovered refresh steps
Policy Training and Inference
Policy learning uses paired continuations to estimate the terminal fidelity gain and total computation change of a refresh. The backbone remains frozen. We first fit an initial score using states from the DP schedule and fit updated paired values on states visited by the resulting policy.
Initial Paired-Value Model
At each selected state, the two continuations start from the same latent, cache, and history, take opposite actions, and then follow the same frozen collection policy on their respective trajectories. Eq. (6) defines their compute-minus-cache fidelity gain and total NFE change . The predictor in Eq. (7) fits these targets from state summaries, time features, and their interactions. State features and targets are normalized using fitting data; robust weighting down-weights large-residual outliers, while query weights balance sample contributions across groups such as prompts or training conditions. The initial score combines these predictions with the DP time prior:
The DP-dependent term includes a fixed initial offset and adds a positive margin at DP refresh steps and a negative margin at other eligible steps. The gain weights include the scale of the prediction term, and the positive floor stabilizes the predicted cost in the ratio (the measured NFE change can still be zero or negative). Using this benefit-per-unit-cost ratio provides a scale-consistent initial ranking around the static DP anchor before switching to linear net-value refinement in later rounds. The shared offset in Eq. (5) separately controls the overall refresh tendency.
Refreshed Paired Values
Once the policy moves beyond the static DP anchor, Eq. (10) refines the score using the linear net-value predictor in Eq. (8) fitted on states visited by the current policy. On the right-hand side, and belong to the fixed collection policy; the arrow replaces its score function with the updated one for the next round. Because each round refits the predictor on an updated visited-state distribution, the gain and NFE weights absorb the new prediction scale, and the symmetric clip bound keeps score updates properly bounded across rounds. At inference (Algorithm 2), the final policy and offset remain fixed, with an optional consecutive-reuse limit safeguarding against overly long reuse intervals.
Corrector Implementation and Training
The corrector estimates a hidden-state correction for a cached feature. It is trained offline with the policy frozen, then applied to the reused representation before the output head.
Causal Inputs and Architecture
At a cache step , let denote the most recent full evaluation. The input combines the cached residual , its first difference from the preceding full evaluation, and input drift
Algorithm 2 OnCache decision at a cache-eligible step
Require: Frozen policy score , offset , reuse limit , latent , conditioning , valid residual , history ; corrector and strength when enabled
if consecutive cache actions precede then
end if
if then
; update residual history
else
if corrector enabled then
Construct from , sampler time, and residual history
end if
end if
Record and realized NFE
. The first difference is divided by the noise-level gap between those evaluations and scaled by the gap from the latest evaluation to the current step; it is masked only during early caching steps before two full evaluations have accumulated. Cache age, sampling progress, and feature statistics provide additional conditioning.
A shared projection compresses these features, which are fused by a depthwise spatial convolution with channel gating. Time-conditioned normalization, a gated feed-forward block, and a zero-initialized output projection produce the hidden correction . This zero initialization provides an identity-preserving starting point that matches the unperturbed cached representation and prevents early random perturbations from destabilizing the denoising trajectory.
Supervision and Deployment
Offline teacher queries on policy-guided cache states provide the hidden and output targets in Eq. (12), without changing the trajectory or cache. In Eq. (13), divides the token/channel-averaged hidden loss by cache age and the mean hidden-target magnitude. scales the output difference after SmoothL1 using the mean full-minus-cached output magnitude. Both normalization scales are computed solely from the training split.
Training follows a staged schedule: it first fits the hidden-state loss, then adds output-velocity consistency (), and finally refines on an equal (1:1) mix of original and corrected trajectories to align training with closed-loop rollout dynamics. The corrector is trained offline on the collected teacher-trajectory queries, with correction strength fixed at across our evaluations. At inference, the frozen corrector adjusts cache steps, only full evaluations update the residual history, and the frozen policy observes the corrected trajectory. As shown in the component ablations in § 4.5 (Figure 7), the full design achieves the best mean LPIPS, SSIM, and PSNR across three training seeds, with the first residual difference, input drift, and output-velocity supervision providing the primary fidelity gains. Detailed training protocols and controls are reported in Appendix § 11.§ 2, and loss objectives at matched updates are compared in Appendix § 11.§ 3.
Policy Experiments and Ablations
We first verify that the policy’s cache allocation adapts both per-sample computation and refresh timing to individual trajectories (Appendix § 10.§ 1). We then isolate the contributions of learned continuation-cost targets and state-history inputs using compact single-fit learners (Appendix § 10.§ 2). Finally, we ablate single-/mixed-resolution training to examine cross-resolution generalization (Appendix § 10.§ 3).
Schedule Assignment with the Final Policy
We verify that our final frozen policy (, without corrector) adapts both per-sample computation and refresh placement to individual trajectories. The evaluation uses 200 test captions at resolution with paired Full30 references (seed 42, 30 sampling steps, guidance 3.5), disjoint from all teacher-trajectory and fitting sets.
We compare the policy’s own schedules against two seeded permutations that preserve the schedule multiset and all 1,973 full evaluations (mean NFE 9.865): an all-prompt permutation that reassigns schedules across all captions (disrupting both per-sample budget and refresh timing), and a within-NFE permutation that permutes schedules only among captions sharing the same NFE (isolating refresh timing while keeping each prompt’s computation fixed).
As shown in Table 7, both permutations degrade every fidelity metric at identical total computation, with the all-prompt permutation suffering the largest drop (+0.0194 LPIPS, −0.0195 SSIM, and −0.98 dB PSNR). Even under the stricter within-NFE control where every caption retains its exact NFE, our policy’s placement reduces LPIPS by 0.0111 (95% CI [−0.0131, −0.0097]), improves SSIM by 0.0116 ([0.0102, 0.0132]), and raises PSNR by 0.86 ([0.7629, 0.9714]), confirming that the policy effectively adapts both computation allocation across different prompts and refresh timing to each trajectory.
| Assignment | NFE | LPIPS↓ | SSIM↑ | PSNR↑ |
| Our Policy | 9.865 | 0.1482 | 0.8319 | 24.70 |
| All-prompt permutation | 9.865 | 0.1676 | 0.8124 | 23.72 |
| Within-NFE permutation | 9.865 | 0.1593 | 0.8203 | 23.84 |
Table 7. Final-policy schedule assignment on 200 captions at matched total computation. Bold marks the best scores.
Paired-Value Targets and Policy Inputs
Measured continuation cost. In sequential caching, refreshing at step changes future states and can either trigger or save subsequent full evaluations, so its true computation cost is not a constant NFE. To verify this motivation, we collect seven paired action queries per caption from 64 teacher-trajectory captions and an additional 16-caption diagnostic set. Each pair shares the same prompt, initial noise, action prefix, and pre-action cache state, takes opposite actions at the queried step, and then follows the same frozen final policy without the corrector. Query steps are chosen from pre-action decision margins before endpoint fidelity is observed, and all 560 pairs pass prefix, image, and execution-count checks. Table 8 reports the resulting trajectory-level NFE difference from Eq. (6). Across the 448 fitting pairs, 206 (46.0%) have , including 201 zero-cost cases where an immediate refresh saves a later full evaluation, yielding a mean cost of 0.556 (ranging from −1 to 2). The 16-caption diagnostic set shows the same pattern (mean 0.714, with 44 of 112 pairs having ). These measurements motivate learning the continuation cost rather than assuming a fixed unit cost.
| Dataset | Pairs | Mean | ||||
| Teacher set (64) | 448 | 1 | 201 | 242 | 4 | 0.556 |
| Diagnostic set (16) | 112 | 0 | 38 | 68 | 6 | 0.714 |
Table 8. Measured compute-minus-cache continuation NFE differences (), accounting for the current and all subsequent actions.
Compact target and input controls. To isolate the contributions of the learned cost target and state-history inputs under a controlled single-fit budget, we train four compact paired-value learners on the same 64-caption teacher-trajectory set via regularized least squares with fitting-set normalization. The Paired learner (Ours) uses full state-time features to predict both normalized fidelity gains and the measured continuation cost in Eq. (6). The Unit cost target control replaces only the cost target with a constant 1. To test input necessity, Time inputs only retains only sampler and time features, while History/drift removed discards residual, history, and drift features (and their interactions) while keeping current hidden summaries, action counters, and time embedding features.
All four learners share the same ten-evaluation BudCache time prior and a bounded softsign score mapping:
where and denote the mean predicted normalized gain and cost, and are fixed scaling coefficients shared across all variants. These compact single-fit models serve strictly as controlled lightweight ablations. All learners are frozen and evaluated on the same 200 test captions.
Table 9 shows that our paired learner achieves the best fidelity across all metrics at essentially the same computation (10.020 vs. 9.995–10.000 NFE). Replacing the measured continuation cost with a constant unit target degrades every metric at virtually identical NFE: LPIPS worsens by 0.00662 (95% CI [0.00512, 0.00847]), SSIM drops by 0.00666 ([−0.00847, −0.00514]), and PSNR drops by 0.3541 ([−0.4204, −0.2967]) across 2,000 paired prompt-bootstrap resamples, confirming that modeling downstream NFE consequences is essential. Furthermore, both input-reduced controls lack the trajectory-specific signals needed to depart from the time prior, collapsing identically to the static BudCache schedule and producing identical images on all 200 captions. By leveraging residual history and input drift, our paired learner outperforms both collapsed controls, demonstrating the necessity of both state-history features and paired-continuation cost supervision.
| Learner | NFE | LPIPS | SSIM | PSNR |
| Paired learner (Ours) | 10.020 | 0.1425 | 0.8285 | 24.635 |
| Unit cost target | 9.995 | 0.1491 | 0.8219 | 24.281 |
| Time inputs only | 10.000 | 0.1452 | 0.8255 | 24.573 |
| History/drift removed | 10.000 | 0.1452 | 0.8255 | 24.573 |
Table 9. Controlled target and input ablations fitted on the 64-caption teacher-trajectory set and evaluated on 200 test captions without the corrector. Bold marks the best scores.
Training Resolution Generalization
To evaluate how training resolution affects cross-grid generalization (complementing § 4.4), we compare single- and mixed-resolution training using a compact, corrector-free policy trained over four iterative rounds. Using the same 64 teacher-trajectory captions throughout, we test three training regimes: -only, -only, and a balanced 1:1 split of 32 captions at each resolution (Mix). Starting from a common ten-evaluation BudCache prior in round 1, each subsequent round collects 448 fresh paired targets along its current calibrated policy and refits the head via regularized least squares using the softsign update in Eq. (15) (1,792 paired targets in total per regime). After each round, a shared offset is calibrated toward a mean budget of 10 NFE using 16 calibration captions. All weights, normalizers, and offsets from the final fourth-round policy are then frozen and evaluated across , , and the unseen grid on 64 held-out test captions (30 steps, seed 42, compared to Full30 references).
Table 10 shows that mixed-resolution training delivers the strongest cross-resolution generalization without sacrificing in-domain fidelity. At both and , Mix achieves the highest PSNR while matching the in-domain single-resolution fits in LPIPS and SSIM (within 0.0013 and 0.0003 LPIPS at and , respectively) at comparable NFE. On the unseen grid, single-resolution policies degrade markedly, whereas Mix achieves the best fidelity across all three metrics (0.1503 LPIPS, 0.8671 SSIM, and 26.732 dB PSNR) at virtually the same computation (10.938 NFE vs. 11.016 and 10.828). Across 2,000 paired prompt-bootstrap resamples, Mix reduces LPIPS significantly over both -only (95% CI [−0.04057, −0.01693]) and -only ([−0.02391, −0.00934]). Exposing the policy to mixed and trajectories therefore prevents overfitting to a single spatial scale and directly supports the zero-shot generalization in § 4.4.
| Test | Fit | NFE | LPIPS | SSIM | PSNR |
| 9.594 | 0.1453 | 0.8032 | 22.652 | ||
| 9.578 | 0.1486 | 0.8005 | 22.406 | ||
| Mix | 9.594 | 0.1466 | 0.8019 | 22.727 | |
| 10.172 | 0.1592 | 0.8297 | 24.712 | ||
| 10.203 | 0.1517 | 0.8354 | 24.804 | ||
| Mix | 10.156 | 0.1520 | 0.8348 | 24.849 | |
| 11.016 | 0.1786 | 0.8446 | 25.161 | ||
| 10.828 | 0.1663 | 0.8542 | 25.931 | ||
| Mix | 10.938 | 0.1503 | 0.8671 | 26.732 |
Table 10. Cross-resolution generalization of the policy after four training rounds on 64 captions. Bold marks the best fidelity.
Corrector Experiments and Ablations
We compare compensation methods at matched computation, detail the corrector’s component and loss ablations, and evaluate transfer to other caching methods.
Correction at Matched Computation
Correction comparison. While several caching methods incorporate feature compensation, existing designs rely on hand-crafted analytical rules rather than learned neural correction. For example, ERTACache [24] applies fixed-grid residual rectification, and forecasting methods such as TaylorSeer [13] extrapolate block-wise features via fixed Taylor expansions. Such analytical heuristics cannot adapt to trajectory-specific input drift or align reused hidden states with the denoiser’s output velocity. In contrast, our corrector is a lightweight neural module trained with same-state teacher supervision to predict hidden-state adjustments from causal residual differences, input drift, and sampler time. To isolate compensation quality from schedule selection, we fix every accelerated method’s full-evaluation steps to (0, 1, 2, 3, 4, 6, 9, 12, 19, 25) (the 10-NFE BudCache [10] schedule) and evaluate all methods on the same 200 test captions in Table 11. ERTACache uses fixed-grid rectification calibrated on 64 separate captions, while TaylorSeer retains its native block-wise forecasting functions.
| Method | NFE | Latency (s)↓ | LPIPS↓ | SSIM↑ | PSNR↑ |
| Full30 | 30 | 4.8956 | – | – | – |
| BudCache | 10 | 1.8980 | 0.1452 | 0.8255 | 24.57 |
| + ERTACache | 10 | 1.9878 | 0.1371 | 0.8303 | 24.63 |
| + TaylorSeer (order 1) | 10 | 2.0905 | 0.1303 | 0.8281 | 23.88 |
| + TaylorSeer (order 2) | 10 | 2.1597 | 0.1805 | 0.7871 | 22.47 |
| + Our corrector | 10 | 1.9392 | 0.1286 | 0.8480 | 25.20 |
Table 11. Frozen compensation under a shared 10-NFE schedule on 200 prompts at . Latency on one A100 GPU includes VAE decoding. Bold marks the best fidelity scores.
Quality and online cost. As shown in Table 11, our corrector achieves the best fidelity across all three metrics while incurring the lowest latency among all compensation methods. Relative to uncompensated residual reuse (BudCache), it improves LPIPS by 0.0166, SSIM by 0.0225, and PSNR by 0.63 dB with only 41.16 ms additional online latency (+2.17%), and consistently outperforms ERTACache in both fidelity and speed (48.6 ms faster).
Compared with native block-wise TaylorSeer (order 1), our corrector saves 151.33 ms per image (7.24%) while delivering substantial gains in SSIM (+0.01989, 95% CI [0.01566, 0.02395]) and PSNR (+1.32014 dB, [1.14018, 1.50157] dB), alongside a lower mean LPIPS (−0.00166, [−0.00568, 0.00177]) across 2,000 paired prompt-bootstrap resamples. Compared with order-2 TaylorSeer, which degrades under this irregular refresh schedule, our corrector saves 220.58 ms (10.21%) and outperforms it by a wide margin across every metric.
Corrector Ablation Setup
Figure 7 in § 4.5 reports the component ablations. Each variant is trained from scratch on teacher trajectories from 64 captions with eight same-state teacher queries per caption. FLUX and the policy are frozen. Training lasts ten epochs (1,280 optimizer updates), with four full-grid queries per batch, learning rate , and output-loss weight 0.1 except for the hidden-only control. Paired variants share their initialization for each of three fixed training seeds. We evaluate the final epoch on 200 captions under the same fixed ten-evaluation BudCache schedule.
Controls. The second-difference control adds the second temporal difference and its availability flag; the first-difference control removes the first difference and its flag. The drift control removes current input drift, while the time control removes learned time conditioning but retains physical noise-level scaling. The spatial control removes depthwise convolution and channel gating together. The hidden-only control removes the output loss but retains hidden-state supervision. Balanced refresh replaces four of each caption’s eight original queries with corrected-rollout queries matched by timestep and cache age. Provider fitting and the 192 refreshed fitting rollouts are shared preparation costs, separate from the final student’s 1,280-update budget. The deployed corrector uses the longer staged procedure in Appendix § 9.
Loss Objectives at Matched Updates
Hidden regression anchors the correction to the teacher representation, while velocity supervision aligns the output consumed by the sampler. The frozen output head is many-to-one, so these objectives impose different constraints on the hidden correction. We fix the deployed architecture and the same 64 teacher-trajectory dataset of Appendix § 11.§ 2, and compare with weights (1, 0), (0, 0.1), and (1, 0.1). Each student starts from the same random initialization and query order for each of three fixed seeds, using AdamW with learning rate , four queries per batch, and ten epochs (1,280 updates). All variants are evaluated directly at the final epoch with on the same 200 captions under the fixed ten-evaluation BudCache schedule.
Table 12 shows that joint training (Ours setting) achieves the best mean across all three metrics (0.1358 LPIPS, 0.8352 SSIM, and 24.904 dB PSNR). It improves all three fidelity metrics over hidden-only training, with paired 95% intervals excluding zero. Relative to velocity-only training, joint training improves SSIM by 0.0042 (95% CI [0.00303, 0.00539]) while also attaining better mean LPIPS and PSNR ([−0.00203, 0.00079] for LPIPS and [−0.03054, 0.06202] dB for PSNR across 2,000 paired prompt-bootstrap resamples after averaging the three seeds within each caption). In addition, joint training exhibits substantially smaller dispersion across the three fixed seeds: the standard deviation of seed-mean LPIPS is 0.00026, versus 0.00531 for velocity-only training. Combining hidden-state and output-velocity supervision therefore delivers both the highest fidelity and the most consistent optimization.
| Objective | LPIPS↓ | SSIM↑ | PSNR (dB)↑ |
| Hidden | 0.1399 ± 0.0001 | 0.8267 ± 0.0001 | 24.758 ± 0.008 |
| Velocity | 0.1365 ± 0.0053 | 0.8310 ± 0.0034 | 24.889 ± 0.147 |
| Joint (Ours) | 0.1358 ± 0.0003 | 0.8352 ± 0.0002 | 24.904 ± 0.010 |
Table 12. Loss objectives at 1,280 updates and NFE 10. Entries are means ± sample standard deviations across three fixed training seeds on the 200 test captions. Bold marks the best mean.
Plug-and-Play Correction for Other Caches
We attach the trained OnCache corrector to BudCache and DiCache, keeping its OnCache-trained weights and fixed. BudCache retains its ten-evaluation schedule; DiCache retains its native probe, threshold, and feature extrapolation. Correction adjusts the reused image-token hidden state before the output head. All results use the same 200 captions at resolution, 30 sampling steps, seed 42, and full 30-step references.
Table 13. Frozen corrector transfer on the 200 captions. NFE counts full evaluations and excludes DiCache’s one-block probes.
| Method | NFE | LPIPS | SSIM | PSNR |
| BudCache | 10.000 | 0.1452 | 0.8255 | 24.573 |
| + corrector | 10.000 | 0.1286 | 0.8480 | 25.198 |
| DiCache | 10.005 | 0.1904 | 0.7963 | 22.712 |
| + corrector | 10.000 | 0.1859 | 0.8074 | 23.242 |
Table 13. Frozen corrector transfer on the 200 captions. NFE counts full evaluations and excludes DiCache’s one-block probes.
Correction improves all three fidelity metrics for both BudCache and DiCache (Table 13). On BudCache, it reduces LPIPS by 0.01667 (95% CI [−0.01957, −0.01405]) while also improving SSIM and PSNR. On DiCache, correction improves all three metrics, reducing LPIPS by 0.00450 and raising SSIM and PSNR by 0.01108 and 0.530 dB, respectively, with all paired 95% intervals excluding zero. Figure 8 visualizes how the same corrector lowers LPIPS and raises SSIM and PSNR for both caches at nearly unchanged NFE.
Figure 8. Plug-and-play corrector gains. Paired markers show mean fidelity before and after adding the same frozen corrector.
Correction changes 118 of 200 DiCache action sequences. Holding each original sequence fixed yields a larger LPIPS reduction of 0.00915 ([−0.01365, −0.00474]), together with SSIM and PSNR gains whose intervals exclude zero. These results show that correction transfers across cache mechanisms, with its gain interacting with dynamic scheduling. Intervals use 2,000 prompt-bootstrap resamples.
Model Size and Computational Cost
Table 3 reports module sizes and online generation times. Here we detail the offline collection and optimization costs for the FLUX and Wan policies and correctors.
Offline Collection and Optimization
Table 14 reports offline preparation costs, with stage times summing to 224.35 min for FLUX and 306.92 min for Wan.
| Stage | FLUX | Wan |
| Policy data collection | 56.36 | 61.35 |
| Policy fitting and optimization | 53.45 | 95.28 |
| Policy total | 109.81 | 156.63 |
| Corrector teacher trajectory collection | 37.71 | 54.11 |
| Corrector fitting | 76.83 | 96.18 |
| Corrector total | 114.54 | 150.29 |
Table 14. Offline collection and optimization time (minutes) on a single NVIDIA A100 GPU. Totals sum recorded stage durations.
Table 14. Offline collection and optimization time (minutes) on a single NVIDIA A100 GPU. Totals sum recorded stage durations.
Policy collection and optimization. Collection includes trajectory generation and terminal scoring; optimization covers policy fitting and offset calibration.
Corrector collection and optimization. Offline teacher queries provide same-state supervision (Appendix § 9.§ 2). Collection time spans the first to last trajectory completion; fitting time sums epoch durations across training.
Comparison with Training-Based Caching
We compare OnCache against ReCache [1], a training-based caching baseline whose released 50-step, 13-evaluation schedules pair with first- and second-order TaylorSeer (T1/T2). All methods use the same FP16 FLUX backbone, seed 42, guidance 3.5, native 50-step sampler, and Full50 references on one A100 GPU, evaluated on 80 COCO captions disjoint from all teacher-trajectory and fitting sets.
Setup. For this 50-step setting, we construct OnCache from a 13-evaluation DP prior on 64 teacher-trajectory captions (using the same paired policy-fitting pipeline and a 40-epoch corrector fit with cosine learning rate from to ), with a global offset calibrated toward a mean budget of 13 NFE. All weights, normalizers, offsets, and are frozen before the 80-caption evaluation.
Inference speed and fidelity. As shown in Table 15, OnCache (w) achieves the best generation quality across all three fidelity metrics (0.1272 LPIPS, 0.8495 SSIM, and 24.026 dB PSNR), outperforming both ReCache + TaylorSeer Order 1 (T1) and ReCache + TaylorSeer Order 2 (T2) while running markedly faster. At virtually the same 13 NFE, OnCache (w/o) and OnCache (w) reach 3.39× and 3.33× speedups over Full50, compared with 2.96× and 2.74× for ReCache + T1/T2. This large latency gap arises because ReCache relies on online block-wise TaylorSeer feature forecasting across Transformer blocks at every cached step, whereas OnCache reuses the whole-stack residual with a lightweight corrector that adds only 43 ms per image.
| Method | NFE | LPIPS↓ | SSIM↑ | PSNR↑ | Time (s)↓ | Speedup↑ |
| Full50 | 50.000 | – | – | – | 8.115 | 1.00× |
| ReCache + T1 | 13.000 | 0.1293 | 0.8478 | 23.882 | 2.742 | 2.96× |
| ReCache + T2 | 13.000 | 0.1364 | 0.8442 | 23.494 | 2.958 | 2.74× |
| OnCache (w/o) | 13.238 | 0.1362 | 0.8426 | 23.561 | 2.394 | 3.39× |
| OnCache (w) | 13.050 | 0.1272 | 0.8495 | 24.026 | 2.437 | 3.33× |
Table 15. 50-step comparison on 80 captions. Time includes VAE decoding. Bold marks the best score in fidelity column.
Offline optimization efficiency. Table 16 highlights a decisive advantage in training efficiency: whereas ReCache requires 22–23 H100 GPU hours for offline schedule learning, OnCache completes all offline data collection, policy and corrector optimization in less than 3 A100 GPU hours.
| Configuration | Device | Hours |
| ReCache + T1 (reported) | H100 | 22 |
| ReCache + T2 (reported) | H100 | 23 |
| OnCache (w/o) | A100 | ≈ 2.28 |
| OnCache (w) | A100 | ≈ 2.81 |
Table 16. Offline training cost for the 50-step comparison. ReCache reports H100 GPU hours; OnCache reports A100 GPU hours.
Extended Related Work
Diffusion inference can be accelerated through faster numerical samplers such as DDIM, PNDM, EDM, DPM-Solver, DPM-Solver++, and UniPC [9, 14, 17, 18, 31, 41], or by distilling pretrained models into one- or few-step generators via progressive, consistency, and distribution-matching distillation [16, 19, 29, 32, 37, 38]. Orthogonal to these approaches, feature caching exploits temporal redundancy within the denoising steps by reusing intermediate representations. Below, we expand on the caching, correction, and sequential policy learning comparisons summarized in § 2.
Reuse Granularity and Online Decisions
DeepCache enables training-free reuse of high-level U-Net features while updating the shallow branch [21]. Block Caching adds block-level reuse and learned scale-and-shift adjustments [34]; FORA reuses attention and MLP intermediates [30]. Learning-to-Cache (L2C) differentially learns a time-dependent, input-invariant layer router, producing a static deployment graph [20]. ToCa recomputes important tokens while reusing the others, varying caching ratios across layer types and depths [42]. DuCa alternates whole-feature reuse with conservative token refresh using random token selection [43]. These designs vary the granularity of reused computation. OnCache reuses the complete Transformer block-stack residual and schedules full-stack evaluations.
Online adaptation supplies feedback from the trajectory being generated. TeaCache accumulates rescaled differences in timestep-modulated inputs to trigger refresh [12], SeaCache filters feature changes through spectral evolution to separate content-relevant variation from noise [4], DiCache probes shallow layers for error estimation and trajectory alignment [3]. These methods adapt refresh decisions to the running trajectory and allow NFE to vary across inputs. OnCache likewise conditions decisions on the current state via an offline-fitted policy.
Prediction, Correction, and Scheduling
TaylorSeer extrapolates feature history through Taylor expansions [13], Spectrum fits temporal features in a Chebyshev basis through regularized regression [6]. Both go beyond direct cache copying. MagCache controls reuse using calibrated residual magnitude-ratio profiles [22]. ERTACache combines residual error rectification with trajectory-aware timestep adjustment [24]. EpaCache measures final latent deviation after an isolated cache action followed by full evaluations, then aggregates results across calibration prompts into timestep-dependent refresh tolerances [15]. OnCache trains a corrector to predict state-dependent adjustments.
DPCache formulates denoising as path planning with dynamic programming over calibrated interval costs [5]; BudCache uses simulated annealing and deterministic hill climbing under an explicit budget [10]. Both use a prescribed NFE. ReCache learns budget-conditioned schedules with policy gradients and terminal fidelity and quality rewards, deploying a shared schedule per budget [1]. BAG distills binary decisions from searched prompt-budget schedules into online gates conditioned on budget state and local feedback, enforcing an exact per-image NFE [40]. OnCache fits fidelity gains and actual NFE differences from paired continuations, then refines a policy using new states it visits.
Connections to Sequential Policy Learning
An online decision changes the states at which later decisions are made. DAgger addresses this dependence through iterative data aggregation under the learned policy [28]; AG-GREVATE incorporates cost-to-go information into interactive cost-sensitive learning [27]. This perspective motivates querying alternative actions at states reached by the collection policy. As the policy changes, both the visited states and their continuation-dependent values change, motivating the refreshed supervision. Outcome comparisons also connect paired-continuation supervision to preference learning [25]. Here, paired continuations provide regression targets for fidelity gains and total NFE changes, linking state-dependent decisions to final generation quality and computation.
Qualitative Comparisons
Figure S1. Selected comparisons at resolution. The OnCache column (without corrector) has lower LPIPS than ERTACache and SeaCache on all twelve prompts. Values give full-image LPIPS to Full30 (), with actual NFE in parentheses.
![Comparisons at resolution. Two columns compare Full30, TaylorSeer, BudCache, and OnCache for twelve image prompts. Left column: “The children are getting ready to enjoy a piece of cake.” Reference (30 NFE), 0.3151 (10 NFE), 0.2775 (10 NFE), 0.1528 (10 NFE); “A man sitting on a chair working on a laptop.” Reference (30 NFE), 0.3485 (10 NFE), 0.2317 (10 NFE), 0.1395 (10 NFE); “A woman holding a baby near a long horn steer.” Reference (30 NFE), 0.2760 (10 NFE), 0.2013 (10 NFE), 0.1482 (10 NFE); “Street signs tell the names of two streets.” Reference (30 NFE), 0.2946 (10 NFE), 0.1923 (10 NFE), 0.1194 (10 NFE); “The camera and snacks are on the table.” Reference (30 NFE), 0.2943 (10 NFE), 0.1871 (10 NFE), 0.1402 (10 NFE); “A bowl filled with many shiny green apples.” Reference (30 NFE), 0.4635 (10 NFE), 0.1399 (10 NFE), 0.1054 (10 NFE). Right column: “A hot dog and fries served in a cardboard vintage car replica.” Reference (30 NFE), 0.2779 (10 NFE), 0.2354 (10 NFE), 0.1535 (10 NFE); “Two people play a game on a Wii.” Reference (30 NFE), 0.3245 (10 NFE), 0.2275 (10 NFE), 0.1712 (10 NFE); “Two men smile as they ride horses on the beach.” Reference (30 NFE), 0.2826 (10 NFE), 0.1763 (10 NFE), 0.1365 (10 NFE); “large stainless refrigerator with the refrigerator door open” Reference (30 NFE), 0.3013 (10 NFE), 0.1333 (10 NFE), 0.1076 (10 NFE); “A boat sailing on top of a body of water.” Reference (30 NFE), 0.1952 (10 NFE), 0.1588 (10 NFE), 0.1319 (10 NFE); “A white cake topped with berries and a plate of fruit and cheeses.” Reference (30 NFE), 0.2964 (10 NFE), 0.1547 (10 NFE), 0.1292 (10 NFE).]
Vector (PDF)Figure S2. Comparisons at resolution. The OnCache column (without corrector) has lower LPIPS than TaylorSeer and BudCache on all twelve prompts at an NFE of ten per accelerated output. Values give full-image LPIPS to Full30 (), with actual NFE in parentheses.
Figure S3. Selected Wan2.1-T2V-1.3B video comparisons. Each example shows four evenly spaced frames from paired videos (seed 0, 832 × 480, 81 frames, 50 sampling steps). Values report actual NFE and mean LPIPS over all decoded frames against Full50. Gold boxes and insets mark matching regions; the train and butterfly show additional frames from the videos in the lower panel of Figure 5.
References
- [1]Mishan Aliev, Eva Neudachina, Ilya Bykov, Aleksandr Oganov, Kirill Struminsky, Aibek Alanov, and Denis Rakitin. ReCache: Learning budget-aware caching schedules for diffusion models via REINFORCE. CoRR, abs/2606.06060, 2026.arxiv.org/abs/2606.06060
- [2]Black Forest Labs. FLUX.1 [dev]. https://huggingface.co/black-forest-labs/FLUX.1-dev, 2024. Model card; accessed November 2, 2026.
- [3]Jiazi Bu, Pengyang Ling, Yujie Zhou, Yibin Wang, Yuhang Zang, Dahua Lin, and Jiaqi Wang. DiCache: Let diffusion model determine its own cache. In International Conference on Learning Representations, 2026.arxiv.org/abs/2508.17356
- [4]Jiwoo Chung, Sangeek Hyun, MinKyu Lee, Byeongju Han, Geonho Cha, Dongyoon Wee, Youngjun Hong, and Jae-Pil Heo. SeaCache: Spectral-evolution-aware cache for accelerating diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 14283–14294, 2026.arxiv.org/abs/2602.18993
- [5]Bowen Cui, Yuanbin Wang, Huajiang Xu, Biaolong Chen, Aixi Zhang, Hao Jiang, Zhengheng Jin, Xu Liu, and Pipei Huang. Denoising as path planning: Training-free acceleration of diffusion models with DPCache. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 43632–43642, 2026.arxiv.org/abs/2602.22654
- [6]Jiaqi Han, Juntong Shi, Puheng Li, Haotian Ye, Qiushan Guo, and Stefano Ermon. Adaptive spectral feature forecasting for diffusion sampling acceleration. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 43320–43330, 2026.arxiv.org/abs/2603.01623
- [7]Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems 33, 2020.arxiv.org/abs/2006.11239
- [8]Ziqi Huang, Yinan He, Jiashuo Yu, Fan Zhang, Chenyang Si, Yuming Jiang, Yuanhan Zhang, Tianxing Wu, Qingyang Jin, Nattapol Chanpaisit, Yaohui Wang, Xinyuan Chen, Limin Wang, Dahua Lin, Yu Qiao, and Ziwei Liu. Vbench: Comprehensive benchmark suite for video generative models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 21807–21818. IEEE, 2024.arxiv.org/abs/2311.17982
- [9]Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. In Advances in Neural Information Processing Systems, 2022.arxiv.org/abs/2206.00364
- [10]Mingkun Lei, Tong Zhao, Liangyu Yuan, and Chi Zhang. Budget-constrained step-level diffusion caching. In Proceedings of the 43rd International Conference on Machine Learning, pages 65536–65553. PMLR, 2026.arxiv.org/abs/2606.13496
- [11]Tsung-Yi Lin, Michael Maire, Serge J. Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C. Lawrence Zitnick. Microsoft COCO: common objects in context. In European Conference on Computer Vision, pages 740–755. Springer, 2014.arxiv.org/abs/1405.0312
- [12]Feng Liu, Shiwei Zhang, Xiaofeng Wang, Yujie Wei, Haonan Qiu, Yuzhong Zhao, Yingya Zhang, Qixiang Ye, and Fang Wang. Time system embedding tells: It’s time to cache for video diffusion model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7353–7363, 2025.arxiv.org/abs/2411.19108
- [13]Jiacheng Liu, Chang Zhou, Yuanhuiyi Lyu, Junjie Chen, and Linfeng Zhang. From reusing to forecasting: Accelerating diffusion models with TaylorSeers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15853–15863. IEEE, 2025.arxiv.org/abs/2503.06923
- [14]Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo numerical methods for diffusion models on manifolds. In International Conference on Learning Representations, 2022.arxiv.org/abs/2202.09778
- [15]Yuhan Liu, Zongwei Hong, Jinglun Li, Linze Li, Shen Zhang, and Yao Tang. EpaCache: Error-propagation-aware caching for accelerating diffusion-based visual generation. CoRR, abs/2608.29264, 2026.arxiv.org/abs/2608.29264
- [16]Cheng Lu and Yang Song. Simplifying, stabilizing and scaling continuous-time consistency models. In International Conference on Learning Representations, 2025.arxiv.org/abs/2410.11081
- [17]Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. DPM-Solver: A fast ODE solver for diffusion probabilistic model sampling in around 10 steps. In Advances in Neural Information Processing Systems, pages 5775–5787, 2022.arxiv.org/abs/2206.00927
- [18]Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. DPM-Solver++: Fast solver for guided sampling of diffusion probabilistic models. Mach. Intell. Res., 22(4):730–751, 2025.DOI
- [19]Simian Luo, Yiqin Tan, Longbo Huang, Jian Li, and Hang Zhao. Latent consistency models: Synthesizing high-resolution images with few-step inference. CoRR, abs/2310.04378, 2023.arxiv.org/abs/2310.04378
- [20]Xinyin Ma, Gongfan Fang, Michael Bi Mi, and Xinchao Wang. Learning-to-Cache: Accelerating diffusion transformer via layer caching. In Advances in Neural Information Processing Systems, 2024.arxiv.org/abs/2406.01733
- [21]Xinyin Ma, Gongfan Fang, and Xinchao Wang. DeepCache: Accelerating diffusion models for free. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 15762–15772. IEEE, 2024.arxiv.org/abs/2312.00858
- [22]Zehong Ma, Longhui Wei, Feng Wang, Shiliang Zhang, and Qi Tian. MagCache: Fast video generation with magnitude-aware cache. In Advances in Neural Information Processing Systems, 2025.arxiv.org/abs/2506.09045
- [23]William Peebles and Saining Xie. Scalable diffusion models with transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4172–4182. IEEE, 2023.arxiv.org/abs/2212.09748
- [24]Xurui Peng, Chenqian Yan, Hong Liu, Rui Ma, Fangmin Chen, Xing Wang, Zhihua Wu, Songwei Liu, and Mingbao Lin. ER TACache: Error rectification and timesteps adjustment for efficient diffusion. In International Conference on Learning Representations, pages 82104–82120, 2026. 2, 3, 6, 5, 8arxiv.org/abs/2508.21091
- [25]Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model, 2023. 8arxiv.org/abs/2305.18290
- [26]Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022. 1arxiv.org/abs/2112.10752
- [27]Stéphane Ross and J. Andrew Bagnell. Reinforcement and imitation learning via interactive no-regret learning. CoRR, abs/1406.5979, 2014. 8arxiv.org/abs/1406.5979
- [28]Stéphane Ross, Geoffrey J. Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, AISTATS 2011, pages 627–635. JMLR.org, 2011. 8arxiv.org/abs/1011.0686
- [29]Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. In International Conference on Learning Representations, 2022. 2, 8arxiv.org/abs/2202.00512
- [30]Pratheba Selvaraju, Tianyu Ding, Tianyi Chen, Ilya Zharkov, and Luming Liang. FORA: Fast-forward caching in diffusion transformer acceleration. CoRR, abs/2407.01425, 2024. 8arxiv.org/abs/2407.01425
- [31]Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021. 2, 8arxiv.org/abs/2010.02502
- [32]Yang Song, Prafulla Dhariwal, Mark Chen, and Ilya Sutskever. Consistency models. In International Conference on Machine Learning, pages 32211–32252. PMLR, 2023. 2, 8arxiv.org/abs/2303.01469
- [33]Zhou Wang, Alan C. Bovik, Hamid R. Sheikh, and Eero P. Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE Trans. Image Process., 13(4): 600–612, 2004. 5, 6pubmed.ncbi.nlm.nih.gov/15376593
- [34]Felix Wimbauer, Bichen Wu, Edgar Schönfeld, Xiaoliang Dai, Ji Hou, Zijian He, Artsiom Sanakoyeu, Peizhao Zhang, Sam S. Tsai, Jonas Kohler, Christian Rupprecht, Daniel Cremers, Peter Vajda, and Jialiang Wang. Cache me if you can: Accelerating diffusion models through block caching. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6211–6220. IEEE, 2024. 2, 3, 8arxiv.org/abs/2312.03209
- [35]Jiazheng Xu, Xiao Liu, Yuchen Wu, Yuxuan Tong, Qinkai Li, Ming Ding, Jie Tang, and Yuxiao Dong. ImageReward: Learning and evaluating human preferences for text-to-image generation. In Advances in Neural Information Processing Systems, pages 15903–15935. Curran Associates, Inc., 2023. 6arxiv.org/abs/2304.05977
- [36]Zhuoyi Yang, Jiayan Teng, Wendi Zheng, Ming Ding, Shiyu Huang, Jiazheng Xu, Yuanming Yang, Wenyi Hong, Xiaohan Zhang, Guanyu Feng, Da Yin, Yuxuan Zhang, Weihan Wang, Yean Cheng, Bin Xu, Xiaotao Gu, Yuxiao Dong, and Jie Tang. CogVideoX: Text-to-video diffusion models with an expert transformer. In International Conference on Learning Representations. OpenReview.net, 2025. 1arxiv.org/abs/2408.06072
- [37]Tianwei Yin, Michaël Gharbi, Tae Sung Park, Richard Zhang, Eli Shechtman, Frédo Durand, and Bill Freeman. Improved distribution matching distillation for fast image synthesis. In Advances in Neural Information Processing Systems, 2024. 2, 8arxiv.org/abs/2405.14867
- [38]Tianwei Yin, Michaël Gharbi, Richard Zhang, Eli Shechtman, Frédo Durand, William T. Freeman, and Taesung Park. One-step diffusion with distribution matching distillation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6613–6623, 2024. 2, 8arxiv.org/abs/2311.18828
- [39]Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 586–595. Computer Vision Foundation / IEEE Computer Society, 2018. 5, 6arxiv.org/abs/1801.03924
- [40]Tong Zhao, Mingkun Lei, Yucheng Han, and Chi Zhang. BAG: Budget-aware gating for diffusion caching. CoRR, abs/2608.09231, 2026. 2, 3, 8arxiv.org/abs/2608.09231
- [41]Wenliang Zhao, Lujia Bai, Yongming Rao, Jie Zhou, and Jiwen Lu. UniPC: A unified predictor-corrector framework for fast sampling of diffusion models. In Advances in Neural Information Processing Systems, 2023. 2, 8arxiv.org/abs/2302.04867
- [42]Chang Zou, Xuyang Liu, Ting Liu, Siteng Huang, and Linfeng Zhang. Accelerating diffusion transformers with token-wise feature caching. In International Conference on Learning Representations. OpenReview.net, 2025. 8arxiv.org/abs/2410.05317
- [43]Chang Zou, Shikang Zheng, Evelyn Zhang, Runlin Guo, Haohang Xu, Zhengyi Shi, Conghui He, Xuming Hu, and Linfeng Zhang. Rethinking token-wise feature caching: Accelerating diffusion transformers with dual feature caching. IEEE Trans. Image Process., 35:6211–6220, 2026. 8DOI








