Nodes/ComfyUI-Spectrum-ZImage-Proper/Spectrum Apply Z-Image
ComfyUI Node

Spectrum Apply Z-Image

Your Z-Image Base is doing 30 steps it could guess through

By xmarre·Created 6 months ago·Updated 6 months ago· 0
Spectrum Apply Z-Image
  • model
  • model
enabledtrue
blend_weight0.50
degree4
ridge_lambda0.10
window_size2.00
flex_window0.75
warmup_steps5
tail_actual_steps3
max_history128
debugfalse

If you run Z-Image Base in ComfyUI, you know the pain: it needs 25–50 steps, and on a 3060 that's a solid three-plus minutes per image. Turbo got the speed, but Turbo is guidance-distilled at CFG 1 with no seed diversity, which is exactly why you switched to Base in the first place. Spectrum Apply Z-Image is the third path: keep the full model, and skip a chunk of the expensive transformer work entirely.

It's a faithful ComfyUI port of Spectrum (Adaptive Spectral Feature Forecasting for Diffusion Sampling Acceleration), the training-free sampling acceleration trick that had people asking "comfyui when?" in the paper's Reddit thread. The answer for Z-Image, specifically, is this node. No training, no distilled checkpoint, no LoRA to download - you patch the model at inference time.

How it works

The idea is simple once you see it. Denoising is a smooth trajectory: the hidden features at step 10 and step 11 aren't random, they're points on a curve. Spectrum runs the model for real on some steps, then fits a small predictor to the recent hidden states and forecasts the next few, skipping the model call in between.

The "spectral" bit is the twist. Instead of plain linear extrapolation, it fits a Chebyshev polynomial with ridge regularization over the detected solver-step coordinates. blend_weight mixes the two - 1.0 is pure spectral prediction, 0.0 is pure local linear. The paper's cheat is that these two are weak on their own but complementary, which is why the default is right in the middle.

What makes this port worth reading about is where it hooks. It patches the native ComfyUI Z-Image path on the MODEL line and forecasts the full unified hidden token sequence right before final_layer - not the final denoised image tensor. That's the "last-block-only" strategy done faithfully. Even on skipped steps it still runs patchify_and_embed, conditioning, final_layer, and unpatchify; the only thing it skips is the expensive main transformer stack (self.layers).

The inputs that matter

The node takes a MODEL in, gives a MODEL out, and has ten knobs you mostly never touch. The defaults are sane. The three you'll actually adjust:

  • blend_weight (0–1, default 0.5) - the spectral-vs-linear mix. Push toward 0.75 for more aggression, toward 0.25 if you start seeing artifacts.
  • flex_window (default 0.75) - how much the skip interval grows after each warmup forward. 0.75 is moderate, 3.0 is aggressive. This is the speed-versus-fidelity trade, not the paper's exact scheduler.
  • warmup_steps (default 5) - real forwards before any forecasting is allowed. Raise it if output quality dips; there's no free lunch, just a smaller bill.

degree (Chebyshev degree, default 4), ridge_lambda (regularization, default 0.1), window_size, tail_actual_steps, max_history, and debug are set-and-forget. Flip enabled off to get a pure pass-through, and debug on if you want a per-run summary of how many steps were actually forecast.

How to install

It's a zero-dependency custom node - the dependencies = [] in pyproject is real, nothing beyond stock ComfyUI.

cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-Spectrum-ZImage-Proper

Restart ComfyUI (or via Manager, searching "Spectrum-Z-Image"). No model files to download - it works on whatever Z-Image checkpoint you already have.

Place it after LoRAs, before the guider:

Model loader -> LoRA stack -> Spectrum Apply Z-Image -> guider / sampler

Where it falls over

This is a narrow, opinionated node, and the README is upfront about it. The big one: forecasting only runs on deterministic sample_euler. Any sampler that doesn't do one predict_noise per solver step silently falls back to real forwards - you get correct output, just no speedup. It also only targets the current native Z-Image path in ComfyUI; non-Z-Image Lumina models, pixel-space decoders, and multi-eval samplers are out of scope, and if another node fully replaces Z-Image's _forward after this one patches it, compatibility isn't guaranteed.

It's also not magic. Community skepticism about Spectrum ("a huge leap, skeptical it'll make a real difference in practice") is worth holding onto: with tail_actual_steps = 3 protecting the end of the run, you're shaving maybe 40–60% off the denoising stack on a good day, not turning Base into Turbo. Expect to tune blend_weight and flex_window per prompt. The payoff is a Z-Image Base that keeps its seed diversity and negative prompts at a fraction of the wall-clock cost - and honestly, for a training-free speedup, that's a decent deal.

Categorysampling/spectrum

Inputs (11)

NameTypeDefaultDescription
modelMODEL
enabledBOOLEANtrue
blend_weightFLOAT0.500–1
degreeINT41–16
ridge_lambdaFLOAT0.100–10
window_sizeFLOAT2.001–16
flex_windowFLOAT0.750–8
warmup_stepsINT50–32
tail_actual_stepsINT30–32
max_historyINT12817–512
debugBOOLEANfalse

Outputs (1)

NameTypeDescription
modelMODEL