ComfyUI Spectrum SDXL Node

This repository contains a ComfyUI custom node implementing the Spectrum sampling acceleration technique, tailored specifically for SDXL models. Spectrum is a training-free method that forecasts spectral features using Chebyshev polynomials and ridge regression to skip redundant UNet computations, achieving significant speed-ups with minimal quality loss.

Disclaimer: This repository was created with substantial assistance from AI tools.

Performance comparison:

SDXL (24-step Euler):

Default Spectrum
Default Spectrum
6.5 s 3.6 s

Anima (30-step):

Default Spectrum
Default Anima Spectrum Anima
23.67 s 13.01 s

Key Features

  • Architecture Agnostic – While initially tailored for SDXL, this implementation is designed to be model-agnostic. It successfully accelerates both UNet-based models (like SDXL) and Diffusion Transformer (DiT) architectures (so far tested only on Anima).
  • Sampling Acceleration – Reduce inference time (up to ~2× on SDXL) by skipping UNet evaluations on selected timesteps.
  • Vectorized Batch Processing – Fully vectorized mathematical operations process conditional and unconditional latents independently. This prevents memory contamination (rainbow artifacts) and sustains ultra-high it/s speeds without Python loop bottlenecks.
  • FP8 Tensor-Core Support – Compatible to run on NVIDIA Tensor Cores in FP8 mode, providing additional speed gains on compatible hardware. Works seamlessly alongside other optimizations.
  • Sage-Attention Friendly – Orthogonal to Sage Attention; you can enable them together without conflicts.
  • Stability Enhancements – Incorporates a "Sliding Window" memory limit (prevents mathematical explosions), alongside jitter and anti-NaN safeguards to keep low-precision runs (FP16/FP8) perfectly stable.
  • Step-Based Quality Guard – A dedicated parameter allows you to seamlessly turn off the forecaster during the final critical steps, preserving high-frequency micro-details (like skin texture and eyes) and eliminating VAE-like compression blur.

Installation

  1. Navigate to the custom_nodes directory of your ComfyUI installation.
  2. Clone this repository:
git clone https://github.com/ruwwww/comfyui-spectrum-sdxl

  1. Restart ComfyUI.

Parameters

Parameter Description
w Blending weight between predicted and last true features. Lower values (0.4–0.5) rely more on local momentum, preserving sharpness, while higher values rely on global spectral smoothing.
m Number of Chebyshev polynomial basis functions (forecast complexity). Lower values (3) are generally more stable for short SDXL runs.
lam Ridge regularization strength (\lambda). High values (1.0) prevent latent explosion, rainbow artifacts, and black outputs in low-precision modes.
window_size Initial forecasting window size (number of skipped steps).
flex_window Increment added to the window after each actual UNet pass. Higher values result in aggressive acceleration.
warmup_steps Number of initial full-model steps before forecasting begins. Gives the model time to establish composition.
stop_caching_step The exact step count where Spectrum stops accelerating and hands rendering back to the native UNet. Essential for recovering fine details. (e.g., If rendering 25 total steps, set to 22 to let the original UNet render the final 3 steps). Set to 100 to disable the guard for maximum speed.

For the best balance of extreme speed and high-definition sharpness (no blur/artifacts), use the following configuration (assuming a standard 25-step generation):

  • w: 0.30
  • m: 3
  • lam: 0.1
  • window_size: 2
  • flex_window: 0.25
  • warmup_steps: 4
  • stop_caching_step: 22 (Always set this to Total Steps minus ~3)

Adjust flex_window higher if you want to push speeds further, or lower if you notice structural degradation.

Credits & References

This node implements ideas from the paper:

Adaptive Spectral Feature Forecasting for Diffusion Sampling Acceleration Jiaqi Han, Juntong Shi, Puheng Li, Haotian Ye, Qiushan Guo, Stefano Ermon Stanford University & ByteDance

Citation

If you use this node in your research, please cite the original paper:

@article{han2026adaptive,
  title={Adaptive Spectral Feature Forecasting for Diffusion Sampling Acceleration},
  author={Han, Jiaqi and Shi, Juntong and Li, Puheng and Ye, Haotian and Guo, Qiushan and Ermon, Stefano},
  journal={arXiv preprint arXiv:2603.01623},
  year={2026}
}

S
Description
No description provided
Readme MIT
11 MiB
Languages
Python 100%