KSampler (Spectrum)
A faster KSampler for Anima, no retraining involved
- model
- positive
- negative
- latent_image
- clip
- LATENT
Anima is a great anime DiT with one real flaw: it's slow for a 2B-parameter model. Community timings put it around 10 seconds on a 5090 and over a minute on a 4060 at the 30-50 steps it wants. The usual fix is a distilled checkpoint or Turbo LoRA - fewer steps, but you give up flexibility and, per plenty of reports, some of the reason you picked Anima in the first place. KSampler (Spectrum) takes a different route: it's a drop-in replacement for the stock KSampler that skips compute inside each step instead of skipping steps, so you keep your full step count and denoising schedule and still come out faster.
How it actually skips work
This is the same family as TeaCache and friends - training-free caching for diffusion transformers - but Spectrum's specific trick is Chebyshev polynomial forecasting instead of a similarity threshold. Every step of a normal DiT run pushes the latent through every transformer block. Spectrum's insight is that block outputs move smoothly from step to step, so most steps don't need to be computed - they can be predicted. On an "actual" step the full model runs and its block outputs get captured; on a "cached" step every transformer block is skipped and only the tiny t_embedder + final_layer + unpatchify tail runs, fed by a Chebyshev ridge-regression fit over recent actual steps.
The schedule starts at warmup_steps (always full compute, to seed the forecaster), then opens an adaptive window: an actual forward every floor(window_size) cached steps, growing by flex_window after each real forward. At 28 steps with the defaults, that's roughly 8 actual forwards out of 28. The refresh_ratio dial layers SEA scheduling on top, deciding which steps get cached based on how much the trajectory is actually moving rather than a fixed cadence. 0 (default) is SEA auto-calibrated to match the plain window's speed; -1 turns SEA off entirely (fast from the first run, no calibration); positive values are an explicit ratio, lower being faster and less faithful. The first run at a new (resolution, steps, cfg, refresh_ratio) combination pays a one-time calibration cost and caches it to your ComfyUI user dir, so don't be alarmed if the very first render at a new resolution is slower than the next one.
What's actually on this node
It's the standard KSampler surface - model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise - plus everything this pack folds in. The parts worth touching as a beginner:
refresh_ratio- the speed dial described above. Leave at0unless you have a reason to change it.clip(optional) +quality_tags/quality_neg/mod_w_profile- Anima's modulation guidance: a learned adapter that steers generation towardquality_tagsby injecting a guidance delta into the DiT's timestep embedding, on top of whatever your prompt already does. Wire a CLIP and pick a profile (defaultstep_i8_skip27) to use it; leave CLIP unwired and it's skipped with a console warning, not an error, so a bare-bones graph still runs fine.adaptive_smc_alpha- an α-adaptive sliding-mode CFG combine that tends to recover fine detail (fingers, eyes, small text) at the cost of a slightly darker image.0disables it, and it's auto-disabled at CFG 1 anyway since there's no cond/uncond gap to work with.xattn_boost- a text-adherence dial for stubborn prompt tags,1.0= off, ~1.5 is the recommended starting point.fsg- a heavier Foresight Guidance switch, off by default; needscfg != 1.
Output is a single LATENT, same as any KSampler - wire it straight into VAE Decode.
One thing this node deliberately doesn't expose: DCW (the post-step SNR bias correction). If you want that, you need KSampler (Spectrum + Mod Guidance Advanced) instead - this unified node covers the common path, not every knob.
Installing it
ComfyUI Manager - search for SpectrumKSampler, install, restart.
Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/sorryhyun/ComfyUI-Spectrum-KSampler
Restart ComfyUI. If you enable modulation guidance, the ~12MB pooled_text_proj adapter auto-downloads to ComfyUI/models/anima_mod_guidance/ the first time you actually use it - no manual step, just expect a short pause on that first run.
Common issues & troubleshooting
Mod guidance seems to do nothing. Check that a CLIP is actually wired in - with a profile selected but no CLIP, guidance is skipped silently (a console warning, not an error), so the graph runs but steering never happens.
First render at a new resolution/step count is slower than expected. That's SEA's one-time calibration pass at refresh_ratio = 0, cached to your ComfyUI user directory afterward. Set refresh_ratio = -1 to skip calibration entirely.
FSG doesn't seem to change anything. It's a no-op at cfg = 1 - an Anima Turbo-style low-CFG setup gives it nothing to calibrate against.
This pack is built for Anima specifically. The README is explicit that modulation guidance, DCW, and the per-block presets are derived from Anima's own training/inference pipeline. It may run against other DiT checkpoints that expose compatible sampler internals, but quality and stability aren't promised there - treat it as an Anima tool first.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | The model used for denoising the input latent. | |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 281–10000 | — |
| cfg | FLOAT | 4.00–100 | — |
| sampler_name | COMBO | 45 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +39 | |
| scheduler | COMBO | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| latent_image | LATENT | — | |
| denoise | FLOAT | 1.000–1 | — |
| quality_tags | STRING | highres, best quality, score_7 | Quality tags to steer generation toward via modulation. |
| quality_neg | STRING | score_1, score_2, score_3, worst quality, lowres, old, bad hands, bad anatomy | Quality-negative baseline for the mod-guidance steering axis (delta = proj(quality_tags) − proj(quality_neg)). Leave EMPTY to reuse the CFG negative (legacy behavior). Set a clean counter-pole (e.g. 'worst quality, score_1') to decouple the quality axis from the broad CFG negative, which is anti-correlated with the intended quality direction. Does NOT change the CFG negative itself. |
| mod_w_profile | COMBO | step_i8_skip27 | Per-block guidance schedule preset. 'off' disables modulation guidance entirely (no adapter download, no extra hook). 'step_i8_skip27' (default) protects early tonal-DC blocks 0–7 and the final compensation block 27, applying w=3 to blocks 8–26 — best overall quality but can occasionally show minor anatomy drift on drift-prone LoRAs. 'step_i14' is the SAFE option: steers only from block 14 onward, reliably stays inside the trained manifold at the cost of a slightly less expressive result. 'uniform_w3' recovers pre-0413 behavior (not recommended — prone to pink-collapse). |
| refresh_ratio | FLOAT | 0.00-1–1 | SEA scheduling dial. -1 = SEA off (plain growing-window schedule; accelerates from the first run, no calibration). 0 = SEA auto (match the window schedule's refresh fraction at this step count — same speed, smarter step placement). >0 = explicit refresh ratio (lower = faster, less faithful). The first run at each (resolution / steps / cfg / refresh_ratio) does a one-time full-compute calibration pass, then caches δ to the ComfyUI user dir for later runs. |
| adaptive_smc_alpha | FLOAT | 0.100–1 | α-adaptive Sliding-Mode Control CFG gain. 0 disables (vanilla CFG combine). 0.2 = production default — k_t := α·mean(|v_cond − v_uncond|) per step keeps the bang-bang correction in-band across CFG/σ/sample (paper's fixed k=0.1 was ~14× off on Anima at CFG=4). Recovers detail (fingers, eyes, text); outputs run slightly darker. Auto-disabled when CFG=1. |
| xattn_boost | FLOAT | 1.001–3 | Front-loaded cross-attn boost λ. 1.0 = off (exact identity). Scales every block's cross-attn residual on the conditional forward at high σ (the plan-writing window where text drive lives), strengthening weak-tag adherence and relation/attribute bindings without changing the render style. Norm-matched by default (renorm 'img' ρ0.5 — tunable on the Advanced node) so the boosted state stays on the trained norm shell instead of burning saturation. ~1.5 recommended; up to 3.0 for stubborn tags (higher λ can amplify unwanted caption tags like framing/crop priors). Boosts only actual forwards; forecast steps extrapolate from the boosted features. Composes with SMC-CFG / CFG++ / FSG / mod-guidance. |
| fsg | BOOLEAN | false | Foresight Guidance toward the golden path (one switch = the validated production stack: CFG++ λ=1.5 substrate + FSG band [0.59,0.75], K=3, on the 1024 tier @ ~28 steps). Needs CFG != 1. Because CFG++ replaces the cond/uncond combine, turning this ON disables SMC-CFG (they are mutually exclusive). Adds ~3·K forwards per in-band step. Band/K/Δσ/γ and the CFG++ λ are tunable on the Advanced node; re-tune if you change steps/resolution (the band moves). |
| clipopt | CLIP | CLIP encoder for encoding positive quality tags. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |