Nodes/SpectrumKSampler/DiT Spectrum Patch
ComfyUI Node

DiT Spectrum Patch

Block-caching acceleration for your existing sampler graph

By sorryhyun·Created 4 months ago·Updated 22 days ago· 25
DiT Spectrum Patch
  • model
  • MODEL
steps30
window_size2.00
flex_window0.25
warmup_steps6
tail_actual_steps3
blend_w0.30
cheby_degree3
ridge_lambda0.10
history_size100
enabledtrue
one_sampler_onlyfalse
verbosefalse

If you already have a working sampling graph - stock KSampler, KSampler Advanced, a Custom Sampler chain with other wrappers - and you don't want to rebuild it around a new sampler node, this is the way in. DiT Spectrum Patch is Spectrum's core caching trick exposed as a plain MODEL → MODEL patcher: wire it before whatever sampler you already use and it accelerates that sampler transparently.

CheckpointLoader / model loader → DiT Spectrum Patch → KSampler / KSampler Advanced / Custom Sampler

What it does, and - importantly - what it doesn't

This node is the caching mechanism only, stripped down to nothing else. Same family as TeaCache-style step-caching accelerators: it forecasts DiT feature outputs instead of computing every step in full. Specifically, on cached steps it predicts the transformer feature immediately before Anima's final_layer from a Chebyshev ridge-regression fit over recent actual steps, then runs only final_layer + unpatchify - skipping every transformer block for that step. On actual steps, the full model runs and its feature gets captured to feed the forecaster.

What it explicitly does not do: no modulation guidance, no DCW, no SMC-CFG, no SPEED/SPD multi-resolution, no noise generation or latent padding, no custom sampling loop. It's a caching wrapper and nothing more - for the correction stack, chain DiT CFG-FSG/DCW Patch or Anima Mod Guidance separately.

Inputs and outputs that matter

  • steps - has to match your downstream sampler's own step count exactly. This is the one setting most likely to bite you: change your sampler's steps and forget to update this node, and the forecaster's internal schedule desyncs from what the sampler is actually doing.
  • window_size / flex_window / warmup_steps - the same adaptive caching schedule as the integrated samplers: warmup_steps forces full compute up front, then an actual forward runs every floor(window_size) cached steps, growing by flex_window after each real forward. Raise flex_window for more speed, lower it (or raise warmup_steps) for more fidelity.
  • tail_actual_steps (default 3) - the final N steps are always forced to actual forwards, protecting the last stretch of denoising (where detail resolves) from ever being a forecasted guess.
  • enabled - flip to false to pass the input model through completely unchanged, a clean kill switch for A/B testing.
  • one_sampler_only - if the same patched model feeds multiple samplers in one workflow run (a hi-res-fix second pass, for instance), setting this true applies Spectrum only to the first sampler that consumes it; later ones in that same run pass through untouched. It re-arms automatically on the next full workflow execution.
  • verbose - logs the actual/cached decision per step, useful for confirming the schedule is doing what you expect.

Output is a patched MODEL.

Installing it

ComfyUI Manager - search SpectrumKSampler, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/sorryhyun/ComfyUI-Spectrum-KSampler

Restart - no model weight downloads for this node specifically; it's pure computation, no auto-fetched assets.

Common issues & troubleshooting

Output looks subtly off, or the schedule seems desynced. Check steps first - it has to match your sampler's step count. This is the single most common way to misconfigure this node.

Spectrum applied to a hi-res-fix pass when you didn't want it to. If the same patched model feeds two sampler nodes in sequence, both get accelerated by default. Set one_sampler_only = true to limit it to the first run.

Node errors instead of producing garbage on a non-DiT model. That's deliberate - the pack fails loudly with a clear error on non-DiT models rather than silently producing invalid output, so if you see that error, it means you've wired this into a checkpoint it genuinely can't accelerate, not that something else went wrong.

Need it to play nicely with a chained attention-backend wrapper or Custom Sampler flow. This basic node has no compatibility controls - for that, use DiT Spectrum Patch Advanced, which adds a compat_policy setting specifically for wrapper-heavy or multi-conditioning graphs.

Categorymodel_patches

Inputs (13)

NameTypeDefaultDescription
modelMODELDiT MODEL to patch with Spectrum.
stepsINT301–10000Must match the downstream sampler's steps.
window_sizeFLOAT2.001–10Initial caching window; 1.0 disables cached steps.
flex_windowFLOAT0.250–2Window growth after each actual forward.
warmup_stepsINT60–10000Initial steps forced to actual DiT forwards.
tail_actual_stepsINT30–10000Final steps forced to actual DiT forwards.
blend_wFLOAT0.300–1Chebyshev/Taylor blend weight; 1.0 is pure Chebyshev.
cheby_degreeINT31–10Chebyshev polynomial degree.
ridge_lambdaFLOAT0.100.001–10Ridge regression regularization strength.
history_sizeINT1005–10000Forecaster buffer size.
enabledBOOLEANtrue
one_sampler_onlyBOOLEANfalseApply Spectrum only to the first sampler run that uses this patched MODEL within a workflow run; later sampler runs (e.g. hi-res fix) pass through. Re-arms on each new workflow execution.
verboseBOOLEANfalseLog actual/cached step decisions.

Outputs (1)

NameTypeDescription
MODELMODEL