RA-CFGCache: From Branch-Level Criteria to Guided-Risk Control under Classifier-Free Guidance

Yiming Liu, Ben Wan, Tongxuan Liu, Ao Wang, Yuqi Xiong, Fan Zhang, Hui Chen, Guiguang DingNeurIPS 2026

TL;DR

Generating crisp images and videos with diffusion models requires dozens of slow network passes, and standard "caching" tricks—reusing old computations to skip steps—often introduce weird visual artifacts because they look at internal errors in isolation. RA-CFGCache fixes this by estimating how cached shortcuts actually interact during guidance and how much a mistake at this exact moment will ripple into the final output. The result is a plug-and-play, training-free controller that accelerates heavyweights like FLUX and CogVideoX by over 3× while keeping visual details remarkably intact.

What Problem Does This Paper Address?

If you've waited for a modern diffusion model to render a video, you know the pain of iterative denoising. What makes it doubly expensive is Classifier-Free Guidance (CFG)—the secret sauce behind prompt adherence. At every single step, the model actually runs twice: once with your text prompt (conditional branch) and once without it (unconditional branch), blending the two to steer the generation.

To speed things up without retraining the model, engineers use training-free caching: if a layer's output hasn't changed much since the last step, just reuse the old calculation. Standard caching methods monitor the conditional and unconditional branches independently.

Figure 1: Standard caching vs. CFG caching. Standard caching reuses a single prediction whose cache error directly enters the denoising update, whereas CFG caching reuses conditional and unconditional branches whose errors are composed into the guided prediction.

The authors point out two blind spots with this approach:

  1. The Branch–Guided Mismatch: The denoising step doesn't care about either branch alone; it cares about their blended output. Because CFG subtracts one branch from another and scales the difference, two seemingly large branch errors can cancel each other out—or two small ones can amplify into a disaster.
  2. The Local–Final Mismatch: An error of size $X$ at step 5 does not have the same impact on the final image as an error of size $X$ at step 45. Early perturbations propagate and compound across subsequent steps much more dramatically than late ones.
Figure 2: Two mismatches under CFG caching. (a) The first mismatch: branch-wise cache errors do not directly reflect the guided error that enters the denoising update. (b) The second mismatch: local guided error does not directly predict the final deviation after error propagation across timesteps.

Methods

Instead of inventing a new caching estimator from scratch, RA-CFGCache wraps around existing branch-level error proxies (like TeaCache, MagCache, or DiCache) and upgrades how reuse decisions are made, without altering the sampler or guidance rules. It works in three stages:

  • CFG-Aware Guided-Risk Composition: Using exact vector geometry for CFG, the authors combine the base proxy errors of both branches using the guidance scale and an offline-calibrated cosine similarity (which estimates how aligned the two branch errors typically are at a given step). This estimates the true guided perturbation.
  • Propagation-Aware Rescaling: In a quick offline calibration phase, they inject isolated single-step caching errors and measure how much the final image deviates. They fit a simple power-law curve to this data, creating a timestep-dependent weight that penalizes early-step risks more heavily than late-step ones.
  • Online Threshold Controller: During live generation, an accumulator tracks this rescaled risk as cached features are reused. Once the accumulated risk crosses a user-set threshold $\tau$, the system refreshes (recomputes) both branches simultaneously and resets the risk counter to zero.

Datasets

Because this is a training-free inference method, no training datasets are used—only small held-out prompt splits for lightweight offline calibration (e.g., 1 to 100 prompts) and standard benchmarks for evaluation:

  • DrawBench: 200 prompts used to evaluate text-to-image generation on FLUX.1-dev.
  • VBench: 100 prompts sampled from all_dimension.txt to evaluate text-to-video generation on Wan2.1-T2V-1.3B and CogVideoX-2B.
  • No new benchmarks were introduced.

Key Insights and Ideas

  • Errors can be friends under CFG: When the guidance scale $s > 1$ (which is virtually always true in practice), the cross-term in the CFG error equation becomes negative. That means when conditional and unconditional caching errors point in the same direction (positive cosine similarity), they partially cancel each other out! As shown below, this alignment grows stronger in later denoising steps.
  • Joint branch reuse beats one-sided shortcuts: You might think caching just the unconditional branch is safer. In reality, reusing both branches together not only saves far more compute (and avoids GPU synchronization bottlenecks during parallel execution), it actually yields higher visual fidelity under a matched refresh budget because it preserves that natural cross-branch error cancellation.
  • Calibration is surprisingly forgiving: You don't need massive datasets to calibrate the alignment or propagation curves. Calibrating on just 10 prompts—or even 1 single prompt—yields nearly identical downstream speedups and image quality as calibrating on 100 prompts.
Figure 3: Two sources of mismatch under CFG caching. (a) The alignment ρt = cos(δut, δct) varies across timesteps, inducing timestep-dependent cancellation or amplification in Eq. (7). (b) The propagation gain gt varies across timesteps, showing that similar local guided errors can induce different final deviations. Solid curves show the mean over 100 prompts, and shaded bands indicate ± one standard deviation across prompts.

Key Results

Tested on NVIDIA H200 GPUs against unaccelerated 50-step baselines, RA-CFGCache consistently pushes the Pareto frontier of speed vs. visual fidelity (measured via LPIPS, SSIM, and PSNR against the original uncached outputs):

  • FLUX.1-dev (Text-to-Image): RA-CFGCache-Slow hits a 3.19× speedup (cutting latency from 21.02s to 6.58s) with better fidelity (0.1137 LPIPS, 24.02 PSNR) than MagCache at 3.18× (0.1636 LPIPS, 21.46 PSNR). RA-CFGCache-Fast pushes speedup to 3.95× (5.32s) while still maintaining sharper fidelity than slower baselines like FasterCache (2.09×).
  • Wan2.1-T2V-1.3B (Text-to-Video): Achieves a 2.56× speedup (93.32s down to 36.48s) with 28.03 PSNR, handily beating DiCache (24.90 PSNR at 2.61×) and MagCache (22.16 PSNR at 2.54×). Its fast variant reaches 2.99× speedup (31.25s).
  • CogVideoX-2B (Text-to-Video): Reaches 3.13× speedup (40.48s down to 12.91s) in Fast mode while matching or beating the visual quality of baselines running around ~2.4×.
  • Qualitatively, competing caches tend to subtly warp object structures or drop local textures at ~2.8× speedup, whereas RA-CFGCache keeps scenes faithful to the vanilla generation.

Limitations and Future Work

While the provided main text does not feature a dedicated "Limitations and Future Work" section, the authors explicitly note several methodological boundaries throughout the paper:

  • Heuristic Risk Score, Not a Formal Bound: Both the proxy-based guided risk and the accumulated interval score $R$ are heuristic control signals rather than exact online measurements or formal mathematical bounds on final output deviation.
  • Offline Calibration Step: Although lightweight and robust to small sample sizes, deploying the method on a new model still requires an offline calibration pass to fit the cross-branch alignment statistics and power-law propagation priors.
  • Parallel Execution Nuances: While the main experiments evaluate CFG branches sequentially on a single GPU, the authors note that under parallel two-branch execution, one-sided branch reuse offers limited latency savings because the sampler must still wait for the slower recomputed branch—making their joint-reuse design choices hardware-relevant. Future extensions are not explicitly discussed in the main text.

Summary updated

Abstract

Diffusion models enable high-quality visual generation, but iterative denoising remains computationally expensive, especially under classifier-free guidance (CFG), which requires both conditional and unconditional evaluations. Training-free caching reduces this cost by reusing previously computed features or predictions. However, branch-local reuse criteria do not explicitly account for how cache errors combine under CFG or how local perturbations affect the final output. We examine two misalignments in cache control: a *branch--guided mismatch*, where guided error depends on both the magnitudes and alignment of branch errors, and a *local--final mismatch*, where the downstream impact of a local error varies across timesteps. We propose **RA-CFGCache**, a **R**isk-**A**ligned **Caching** framework under **CFG** that incorporates both factors while keeping the sampling schedule and guidance rule fixed. *CFG-aware Guided-Risk Composition* combines existing branch-wise proxies using CFG coefficients and offline-calibrated cross-branch alignment. *Propagation-Aware Rescaling* further weights the resulting guided-risk estimate with a timestep-dependent propagation prior calibrated from isolated reuse perturbations. An online threshold controller then determines when to jointly refresh or reuse both branches. Experiments on FLUX.1-dev, Wan2.1-T2V-1.3B, and CogVideoX-2B demonstrate improved efficiency--fidelity trade-offs over the evaluated training-free caching baselines. Moreover, **RA-CFGCache** is compatible with diverse base proxy families, including TeaCache-, DiCache-, and MagCache-style estimators, and consistently improves fidelity at nearly unchanged latency. Code is available at https://github.com/yiming-l21/RA-CFGCache.git.
BibTeX
@inproceedings{liu2026ra,
  author = {Yiming Liu and Ben Wan and Tongxuan Liu and Ao Wang and Yuqi Xiong and Fan Zhang and Hui Chen and Guiguang Ding},
  title = {{RA-CFGCache: From Branch-Level Criteria to Guided-Risk Control under Classifier-Free Guidance}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=g6toliY0op},
}
Figure