NeurIPS 2026

Cubic: Curvature-Driven Dynamic Inference Caching for Fast, High-Fidelity Flow Matching

Yuyang Chen1* Linqian Zeng1* Yijin Zhou1 Hengjie Li2 Jidong Zhai3
1Shanghai Jiao Tong University 2Shanghai AI Laboratory 3Tsinghua University *Equal contribution
Paper (coming soon) Code BibTeX

See the trade-off

Hover over any point to see what that method actually generates at that speed. Every point is a real run of the same prompt and seed.

Original (uncached)

Single prompt and seed on one NVIDIA H20; each method's speedup is normalized by the uncached run on its own code path, and PSNR/LPIPS are measured against that uncached output. The full multi-prompt benchmark is in Results.

~2.5×average end-to-end speedup
3tasks: T2I, editing, T2V
0training or extra forward passes
1knob: target speedup

Abstract

Flow Matching (FM) has emerged as the dominant paradigm for state-of-the-art image and video generation, yet its reliance on full attention over lengthy sequences incurs significant latency. While existing caching methods reduce redundant computations, they yield suboptimal performance, fundamentally constrained by inflexible spatial granularity and empirical, model-specific heuristics.

To bridge this gap, we ground the caching mechanism in the geometric properties of the FM velocity field. We theoretically establish that the curvature inherently dictates the coupling between trajectory fluctuation and computational requirements, thereby providing a principled metric to quantify caching staleness loss and derive update intervals that minimize this loss under a compute budget.

Translating this theoretical insight into practical acceleration, we present Cubic, a train-free caching framework. It bypasses expensive curvature computations via a lightweight proxy signal that dynamically guides spatial partitioning and budget-constrained update scheduling. At the system level, a sparse forward engine executes these schedules efficiently, turning the reduced token computation into actual FLOP savings and near-linear speedup. Being model-agnostic and controlled by a user-specified acceleration target, Cubic consistently outperforms state-of-the-art caching baselines in quality at customizable acceleration ratios (averaging 2.5×) across Wan2.1, Flux.1, and FireRed-Image-Edit.

Why Curvature?

Different regions of the same image evolve at different rates. The subject keeps a high trajectory curvature for most of the denoising process, while the background flattens early. A uniform caching schedule therefore wastes compute on the background and under-refreshes the subject, which is where cache errors become visible.

Subject and background regions have different curvature and cache error over denoising steps
Region-mean curvature (top) and cache error (bottom) for the subject and background. Under uniform reuse, the high-curvature subject accumulates larger error and fails to converge.

Method

From curvature to cache intervals

Reusing a velocity computed at step tk for an interval τ makes the cached trajectory drift away from the exact one. Under a forward-Euler abstraction, this drift is governed by the local curvature κ of the trajectory. Minimizing the total curvature-weighted error under a fixed compute budget gives a closed-form allocation:

τb ∝ κb−γ,   γ = α / (β + 1)

Flat blocks get long intervals and curved blocks are refreshed often. Curvature itself is estimated cheaply from the endpoint drift between consecutive anchor steps, without computing Jacobians.

Cache error and endpoint drift along the flow-matching trajectory

System pipeline

CUBIC pipeline: monitor, adaptive partitioner, closed-form optimizer and step trace
At each anchor step, the monitor, partitioner and optimizer produce a caching plan. Selective steps then recompute only the active blocks, giving a 2.4× speedup on Flux in this example.
Monitor

Lightweight curvature proxy

Endpoint drift reuses the latent and velocity already available at anchor steps, with about 1.6 ms overhead versus 600 ms for exact Jacobians.

Partitioner

Block-wise scheduling

Tokens are grouped into spatially coherent blocks, so neighbors that attend strongly to each other share the same cache age.

Executor

Sparse forward with dynamic KV

Only active blocks are recomputed; a layer-wise KV pool is refreshed in place, turning token savings into real wall-clock speedup.

Results

Quality-speedup trade-off of CUBIC and baselines on Flux, FireRed and Wan
Benchmark trade-off from the paper (NVIDIA H100, averaged over the evaluation sets): Cubic gives the best PSNR at every speedup.

Fidelity is measured against the uncached model with the same prompt and seed. Latency is measured on NVIDIA H100. std and fast are two target-speedup settings.

MethodLatency (s) ↓Speedup ↑PSNR ↑SSIM ↑LPIPS ↓FID ↓HPSv3 ↑
Baseline11.59–––––10.68
PAB6.401.81×20.370.7700.25777.3710.65
TeaCache6.241.86×22.880.8510.14945.8710.83
ToCa6.391.81×19.680.7490.27370.7610.62
TaylorSeer6.831.70×26.290.8920.09926.8010.82
Cubic (std)6.141.89×27.780.9000.09527.8110.87
Cubic (fast)4.822.40×25.140.8460.17347.3210.97
MethodLatency (s) ↓Speedup ↑PSNR ↑SSIM ↑LPIPS ↓FID ↓HPSv3 ↑
Baseline39.14–––––8.17
PAB23.701.65×24.390.8890.09339.417.95
TeaCache16.912.31×23.800.8960.10041.037.83
ToCa20.061.95×21.090.7880.17867.257.18
TaylorSeer21.041.86×25.120.9100.08433.708.07
Cubic (std)18.262.14×30.670.9540.04718.558.00
Cubic (fast)16.832.33×27.810.9200.09132.187.90
MethodLatency (s) ↓Speedup ↑PSNR ↑SSIM ↑LPIPS ↓FVD ↓VBench ↑
Baseline101.54–––––79.90
PAB40.602.50×22.360.8000.16757.7878.41
TeaCache61.441.65×30.270.9270.04511.7279.79
ToCa44.002.31×19.190.7380.24184.0478.42
TaylorSeer39.242.59×15.800.6410.352137.0678.82
Cubic (std)62.351.63×32.760.9480.0327.9279.37
Cubic (fast)37.322.72×26.390.8740.09931.7680.03

Qualitative comparison

Flux uncached vs CUBIC
FireRed uncached vs CUBIC
Wan uncached vs CUBIC

Comparison with Jano

Jano is the closest token-level caching method. We tune Cubic on separate prompts and evaluate both methods on held-out prompts with Jano's official default configuration (32 Flux and 24 Wan samples on NVIDIA H20). All fidelity improvements are significant under a paired Wilcoxon test (p < 10−4).

ModelMethodSpeedup ↑PSNR ↑SSIM ↑LPIPS ↓
Flux.1-devJano2.18×21.930.7880.225
Cubic2.43×23.470.8420.145
Wan2.1-1.3BJano2.28×20.640.7660.147
Cubic2.36×23.780.8430.096
Original (uncached)JanoCubic
The first six held-out test prompts at seed 42, not cherry-picked. Speedup and PSNR are measured per sample against the uncached video.
Flux: uncached, Jano and CUBIC

Quick Start

git clone https://github.com/chen-yy20/CuBic.git && cd CuBic
uv sync && source .venv/bin/activate

# Wan2.1 text-to-video with a target selective-phase speedup
python launch.py --model wan --method cubic --launcher python \
    --model-path /path/to/Wan2.1-T2V-1.3B -- --target_speedup 6

See the README for Flux, FireRed, baselines and evaluation scripts.

BibTeX

@inproceedings{chen2026cubic,
  title     = {{CUBIC}: Curvature-Driven Dynamic Inference Caching for Fast, High-Fidelity Flow Matching},
  author    = {Chen, Yuyang and Zeng, Linqian and Zhou, Yijin and Li, Hengjie and Zhai, Jidong},
  booktitle = {Advances in Neural Information Processing Systems},
  year      = {2026}
}