Nodes/ComfyUI-Spectrum-sdxl/Spectrum Adaptive Forecaster (SDXL)
ComfyUI Node

Spectrum Adaptive Forecaster (SDXL)

Cut SDXL sampling time roughly in half by predicting the UNet's output

By ruwwww·Created 6 months ago·Updated 4 months ago· 63
Spectrum Adaptive Forecaster (SDXL)
  • model
  • MODEL
w0.30
m3
lam0.10
window_size2
flex_window0.00
warmup_steps5
stop_caching_step-1
steps30

The name is a little misleading in a good way: Spectrum isn't a distilled checkpoint you download, and it doesn't replace your sampler. It's a training-free patch that makes your existing SDXL checkpoint render in about half the wall time by not running the full UNet on every step. You feed it a MODEL, it returns a patched MODEL, you wire that into your KSampler, and nothing else about your workflow changes. The README shows a 30-step Euler run going from 8.8 s to 4.8 s with no visible quality hit, and the math behind it is from a real paper (Stanford/ByteDance, CVPR 2026) rather than a vibe.

How it works

At each denoising step, the UNet turns a noisy latent into a prediction - and that prediction is expensive. Spectrum's trick is to only pay for it sometimes. On selected steps it runs the real forward pass and records the raw output. Then it fits a tiny per-image forecaster on the fly: a Chebyshev polynomial basis solved with ridge regression (this node ports the official basis_utils.py forecaster, not a reimplementation). On the skipped steps it predicts what the UNet would have output instead of running it, and ComfyUI's sampler just carries on with the predicted feature.

The thing that makes it usable day-to-day is the w blend: the final prediction mixes the global Chebyshev fit with a local Taylor extrapolation of the last two real steps. Low w leans on that recent momentum and keeps sharpness; high w trusts the smooth global curve and buys more speed. That's why it doesn't blow up after a few skipped steps the way naive "cache the last output" approaches do.

The inputs that actually matter

There are nine, and the defaults are sane, but three deserve your attention:

  • steps - the one that burns people. It's a manual passthrough of your KSampler's total step count, used to normalize the forecast timestep coordinate. The default is 30; if your KSampler runs 25, set it to 25 or the forecaster drifts.
  • stop_caching_step - where Spectrum stops skipping and hands the final rendering back to the real UNet. Default -1 auto-picks ~80% of the run, but the README's advice is better: set it to your total minus 3 (22 for 25 steps). Those last steps are where skin texture and eyes get pinned down, and forecasting through them is how you get that soft, slightly compressed-looking output people blame on the VAE.
  • warmup_steps - how many full-model steps run before forecasting starts. More warmup, cleaner image, less speed. Start at 5-6.

The rest are set-and-forget: w 0.30 for sharpness, m 3 (Chebyshev basis count, 3-4 is the stable zone), lam 0.1 (ridge regularization - this is your anti-rainbow-artifact knob), window_size 2 with flex_window 0.25 (how many steps get skipped per real pass, and how aggressively that grows).

Output is a single MODEL, straight into the KSampler's model input.

Install

Easiest via ComfyUI Manager - search the pack title ComfyUI-Spectrum-sdxl. Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/ruwwww/ComfyUI-Spectrum-sdxl

Then restart ComfyUI. Good news: the pack ships no requirements.txt and downloads no model files - it's pure PyTorch code, so there's no dependency hell to fight. It's also orthogonal to Sage Attention and works fine alongside fp8.

Common issues

  • Mismatched steps is the #1 drift source. Match it to your KSampler.
  • Speed LoRAs (DMD2, LCM, Lightning, Turbo) at their native low step counts are a trap here. Spectrum needs steps to skip, and at 4-8 steps there's almost nothing left to save - one community test with a DMD2 LoRA at 4 steps ended up slower than the plain run because the caching overhead exceeded the single skipped step. The win lives at 20-30 steps.
  • Rainbow streaks or black output in fp16/fp8 means your lam is too low. Nudge it toward 0.3-1.0.
  • Missing final detail means stop_caching_step is too high (or left on auto).
  • DiT / flow-matching models (like Anima, which ships an example workflow) want higher warmup_steps, around 8-10. This node is tuned for SDXL's UNet.

One honest caveat: the author is upfront in the README that his first attempt at this was "vibe-coded" and non-faithful. This node is the fix - it ports the official forecaster. The old one still ships in the same pack as CalibratedSpectrumSDXL [LEGACY], so if you're on that, migrate.

Categorysampling

Inputs (9)

NameTypeDefaultDescription
modelMODELThe diffusion model to patch with Spectrum forecasting logic.
wFLOAT0.300–1Blending weight between predicted (Chebyshev) and local (Taylor) features. Lower (0.3-0.5) preserves sharpness, higher relies on global smoothing.
mINT31–8Number of Chebyshev basis functions (forecast complexity). Lower values (3-4) are more stable for SDXL.
lamFLOAT0.100–2Ridge regularization strength. Prevents latent explosions and rainbow artifacts in low-precision modes.
window_sizeINT21–10Initial forecasting window size (number of skipped steps).
flex_windowFLOAT0.000–2Increment added to window size after each actual UNet pass. Higher = aggressive acceleration.
warmup_stepsINT50–20Initial full-model steps before forecasting begins. Gives the model time to establish composition.
stop_caching_stepINT-1-1–100The exact step where Spectrum stops and returns to native UNet. Essential for final detail recovery. Set to Total Steps - 3.
stepsINT3010–500Match this value with your KSampler total steps for stable forecast accuracy and drift reduction.

Outputs (1)

NameTypeDescription
MODELMODEL