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/
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)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | The Z-Image model to accelerate with MeanCache. | |
| preset | COMBO | Balanced | Acceleration 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_device | COMBO | cpu | Device for storing velocity cache. 'cpu' = saves VRAM, slight transfer overhead. 'cuda' = faster access but uses more VRAM. |
| rel_l1_threshopt | FLOAT | 0.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_budgetopt | FLOAT | 0.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_stepopt | INT | 20–20 | [Custom only] Step index to begin caching (0-indexed). Early steps form image structure and should not be skipped. |
| end_stepopt | INT | -1-1–100 | [Custom only] Step index to stop caching. -1 = cache until the end. |
| enable_psspopt | BOOLEAN | true | [Custom only] Enable Peak-Suppressed Shortest Path scheduling. PSSP optimally allocates compute budget across steps. |
| peak_thresholdopt | FLOAT | 0.150.05–0.6 | [Custom only] Maximum allowed single-step velocity deviation. Lower = more conservative, higher = more aggressive. |
| adaptive_kopt | BOOLEAN | true | [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. |
| debugopt | BOOLEAN | false | Enable debug logging to console. Shows per-step skip/compute decisions and L_K values. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Patched Model | MODEL | Model with MeanCache acceleration applied. Use with any compatible sampler. |