Nodes/comfyui-meancache-z/MeanCache (Z-Image)
ComfyUI Node

MeanCache (Z-Image)

Training-free inference acceleration for Z-Image using MeanCache. Computes average velocity via JVP approximation to enable intelligent step skipping while maintaining image quality. Based on UnicomAI research: https://unicomai.github.io/MeanCache/

By facok·Created 6 months ago·Updated 6 months ago· 37
MeanCache (Z-Image)
  • model
  • Patched Model
presetBalanced
cache_devicecpu
rel_l1_thresh0.30
skip_budget0.30
start_step2
end_step-1
enable_pssptrue
peak_threshold0.15
adaptive_ktrue
debugfalse
Categorymodel_patches/acceleration

Inputs (11)

NameTypeDefaultDescription
modelMODELThe Z-Image model to accelerate with MeanCache.
presetCOMBOBalancedAcceleration preset. Quality (~1.3x): conservative, minimal skipping. Balanced (~1.5x): good speed/quality tradeoff. Speed (~1.75x): aggressive skipping. Turbo (~2.0x): maximum speed, may reduce quality. Custom: use manual parameters below.
cache_deviceCOMBOcpuDevice for storing velocity cache. 'cpu' = saves VRAM, slight transfer overhead. 'cuda' = faster access but uses more VRAM.
rel_l1_threshoptFLOAT0.300.05–0.8[Custom only] Relative L1 threshold for skip decision. Lower = more quality, fewer skips. Higher = more speedup, potential quality loss. Recommended: 0.2-0.4
skip_budgetoptFLOAT0.300–0.75[Custom only] Maximum fraction of steps to skip. 0.3 = up to 30% speedup potential. Set to 0.0 to disable skipping.
start_stepoptINT20–20[Custom only] Step index to begin caching (0-indexed). Early steps form image structure and should not be skipped.
end_stepoptINT-1-1–100[Custom only] Step index to stop caching. -1 = cache until the end.
enable_psspoptBOOLEANtrue[Custom only] Enable Peak-Suppressed Shortest Path scheduling. PSSP optimally allocates compute budget across steps.
peak_thresholdoptFLOAT0.150.05–0.6[Custom only] Maximum allowed single-step velocity deviation. Lower = more conservative, higher = more aggressive.
adaptive_koptBOOLEANtrue[Custom only] Dynamically select JVP lookback steps K based on sigma. Early steps use small K (captures rapid changes), later steps use large K (smoother estimates). Based on official MeanCache edge_order patterns.
debugoptBOOLEANfalseEnable debug logging to console. Shows per-step skip/compute decisions and L_K values.

Outputs (1)

NameTypeDescription
Patched ModelMODELModel with MeanCache acceleration applied. Use with any compatible sampler.