One Tiny Gate, Any Compute Budget: BAG Learns to Schedule Diffusion Caching
Westlake University and StepFun propose BAG, a sub-1K parameter gating network that learns from offline search to make per-step compute-or-cache decisions during diffusion sampling, jointly considering global budget and local trajectory changes, achieving superior reconstruction at same compute across FLUX, Wan2.1, and Qwen-Image models.
Reading font

Diffusion models require dozens of denoising steps, each invoking a large network, making inference efficiency a persistent bottleneck. Caching methods like TeaCache and MagCache reuse features across steps but lack global budget planning, while static scheduling approaches like BudCache (ICML 2026) pre-compute a fixed schedule that cannot adapt to per-prompt trajectory changes.
The authors frame caching as a scheduling problem: given a limited compute budget (e.g., only 10 full computations out of 50 steps), where should those computations be placed? An experiment on Wan2.1 shows that per-prompt offline search for an optimal schedule reduces LPIPS reconstruction error by 22%–32% compared to SeaCache at the same budget, proving that input-adaptive scheduling has significant headroom.
BAG (Budget-Aware Gating) adopts a three-stage design: (1) Offline search for reference schedules across diverse prompts and budgets, treating the resulting schedules as supervision targets. (2) Distillation of those schedules into a tiny gating network (<1K parameters) that takes six scalar inputs — three describing global budget state (remaining steps, remaining compute, budget ratio) and three capturing local trajectory change (feature difference, timestep, guidance scale). Training the gate takes roughly one minute on a single GPU. (3) Online deployment where the gate decides at each step whether to recompute or reuse cached features, exactly meeting the user-specified budget. The same gate generalizes across different acceleration ratios (2.5× to 5.0×), sampling step counts, random seeds, resolutions, and guidance strengths without retraining.
Experiments on FLUX.1-dev, Wan2.1, and Qwen-Image-2512 demonstrate that BAG consistently outperforms baseline caching methods (TeaCache, SeaCache, BudCache) across all tested budgets. At 5× acceleration (10 full computations out of 50 steps), BAG preserves fine details such as superhero capes and “POW” bubbles that are lost when simply reducing sampling steps. A variant, BAG-R, swaps the offline search objective to align with human preference, showing the framework’s flexibility.
The runtime overhead is minimal: per step the gate processes six scalars through a micro-network. This makes BAG practical for production services where users may request a quick preview (low budget) followed by a high-quality generation (high budget), or where the system dynamically adjusts compute allocation based on load — simply by turning a “budget knob” at inference time.
About this article
For attribution, corrections or content rights, contact


angel leo ·