Nodes/ComfyUI-Spectrum-Qwen-Proper/Spectrum Qwen Model Patcher
ComfyUI Node

Spectrum Qwen Model Patcher

Make Qwen Image Edit stop recomputing the same 40 transformer blocks

By xmarre·Created 6 months ago·Updated 5 months ago· 2
Spectrum Qwen Model Patcher
  • model
  • MODEL
warmup_steps5
tail_actual_steps2
history_points5
chebyshev_degree3
max_consecutive_forecasts1
ridge_lambda0.0001
cache_devicemain_device
force_actual_on_controltrue
debugfalse

If you've sampled a Qwen Image Edit model, you know the pain: a huge transformer block stack that re-runs in full at every single step. This node skips most of it. Spectrum Qwen Model Patcher is a ComfyUI node that applies Spectrum - a real, training-free acceleration method from CVPR 2026 - to native Qwen Image-family models, with the primary target being Qwen-Image-Edit-2511. No API, no key, no fine-tuned weights, no model downloads. It's a patcher: you insert it between your loaded Qwen model and the KSampler, and it outputs a patched MODEL that samples faster.

What it actually does

Spectrum is the opposite of distillation. Distilled models (Lightning, Turbo, LCM) bake a compressed sampling trajectory into the weights, and you pay for it in quality and in rigid low-step settings. Spectrum keeps the original weights untouched and instead gets clever at inference time: run a few real denoising passes, capture the final hidden state right before the model's output head, fit a small polynomial forecaster over those recent states, then on skipped steps predict that hidden state and run only the cheap tail of the network.

For Qwen Image specifically, that tail is time_text_embednorm_outproj_out. The expensive part - the long transformer_blocks stack - gets bypassed on forecast steps. The patcher finds the native Qwen transformer core inside your loaded MODEL, hooks the forward pass, and captures the pre-norm_out image-stream hidden state on real steps. The forecaster is a ridge-regularized Chebyshev polynomial fit over the last few real steps, driven by a normalized step-position coordinate. Warmup, the final tail, and any unsupported case stay on the real path.

The inputs that matter

The node's inputs are all sliders, and the defaults are a sane conservative start. The ones worth touching:

  • warmup_steps (5) - how many initial steps run for real before forecasting starts. More warmup = cleaner result, fewer skipped passes. The author's own FLUX/SDXL testing shows this is your main quality dial.
  • tail_actual_steps (2) - reserves the final steps as real forwards. Late-step forecast error shows up as lost microdetail, so protect the tail before you crank aggression.
  • max_consecutive_forecasts (1) - max skips in a row before a forced refresh step. Keep it low to start.
  • history_points (5) and chebyshev_degree (3) - how much history the fit uses and how fancy the polynomial is. Note the validation: degree must be smaller than history points.
  • ridge_lambda (0.0001) - the ridge regularization. You can basically leave this alone.
  • cache_device (main_device) - where hidden-state history is stored. cpu saves VRAM but can eat the speed win.
  • force_actual_on_control (true) - keep this on. ControlNet residual injection isn't reconstructed by this port, so per-block control stays real.
  • debug (false) - turn it on for your first run; it logs each step as actual vs forecast.

The single output is a patched MODEL, wired straight into your KSampler.

Installing it

ComfyUI Manager - search "Spectrum Qwen Model Patcher" or "ComfyUI-Spectrum-Qwen-Proper" and install. Or manually:

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

Restart ComfyUI. That's the whole install: the requirements file is literally "no extra dependencies" - Python stdlib plus what ComfyUI already ships. No model files to fetch.

The honest gotchas

This is the newest of the author's Spectrum ports (there are siblings for FLUX, SDXL, WAN, and Z-Image under the same "Proper" naming), and the author shipped it saying he hadn't had time to test it. Treat it as experimental. Run debug = true first and confirm you're actually seeing forecast steps before you judge the quality.

Beyond that: it only works on native Qwen Image-family loaders that expose the standard core (img_in, transformer_blocks, norm_out, proj_out, time_text_embed). Quantized or Nunchaku-wrapped Qwen will error out at patch time - the node raises a clear ValueError rather than silently breaking. Speed LoRAs (Lightning/Turbo/LCM/DMD2) fight Spectrum: both try to reduce model evaluations, and a LoRA at its native low-step sweet spot leaves no room to forecast. And if ComfyUI changes the Qwen transformer internals, this node breaks until it's updated. Start with the conservative defaults, protect the tail, and compare outputs yourself - there's no quality oracle here.

Categorymodel/optimization

Inputs (10)

NameTypeDefaultDescription
modelMODEL
warmup_stepsINT50–64Number of initial solver steps forced to run as real Qwen forwards.
tail_actual_stepsINT20–32Number of final solver steps forced to stay on the real path.
history_pointsINT52–16Number of real hidden-state snapshots kept for the Chebyshev fit.
chebyshev_degreeINT31–8Polynomial degree used by the ridge-regularized Chebyshev forecaster.
max_consecutive_forecastsINT10–8Maximum number of skipped Qwen transformer passes allowed in a row before a real refresh step is forced.
ridge_lambdaFLOAT0.00010–1Ridge regularization strength used during the Chebyshev coefficient solve.
cache_deviceCOMBOmain_deviceWhere captured Qwen hidden-state history is stored for fitting and forecasting.
force_actual_on_controlBOOLEANtrueForce real forwards when ControlNet/control residuals are present. Recommended.
debugBOOLEANfalseLog per-step mode decisions and a summary at the end of the run.

Outputs (1)

NameTypeDescription
MODELMODEL