Nodes/ComfyUI-CFG-Ctrl/SMC-CFG Advanced (CFG-Ctrl)
ComfyUI Node

SMC-CFG Advanced (CFG-Ctrl)

The tuning knobs for when plain SMC misbehaves

By flyghtxmz·Created 6 months ago·Updated 6 months ago· 1
SMC-CFG Advanced (CFG-Ctrl)
  • model
  • model
smc_lambda0.05
smc_k0.10
warmup_steps2
adaptive_scaletrue
max_correction_ratio0.25
switching_modesmooth
tanh_delta0.50
normalize_sfalse
smc_end_step0

The plain SMC-CFG node is plug-and-play, and that's its whole appeal. The Advanced version is what you graduate to when the simple one is almost right - edges chattering with noise, the correction running too hot late in the denoising run, or just wanting the paper's exact formulation instead of the safe defaults. Same model-patch trick, same sliding-mode math, but every knob is on the table.

How it's different from the simple node

Both nodes clone the model and register a custom sampler_cfg_function that recomputes guidance as v_uncond + w * (e_t + u_sw), where u_sw = -K * φ(s) is the sliding-mode correction from CFG-Ctrl (arXiv 2603.03281). The Advanced node just stops hiding the internals. The simple node hardcodes "hard" switching and one smoothing bandwidth; here you get to shape the correction term itself.

The extra inputs

  • switching_mode (default smooth) - hard = sign(s), the paper's discontinuous default; smooth = tanh(s/δ), a differentiable approximation that trades a little sharpness for far less chattering. This is the main lever for noisy edges.
  • tanh_delta (default 0.5) - the smoothing bandwidth δ. Smaller = closer to a hard sign. If smooth mode feels mushy, drop it toward 0.2.
  • smc_end_step (default 0) - deactivates SMC after N steps and falls back to vanilla CFG. 0 = always active. This is the one I'd reach for when the last few steps are wrecking an otherwise good render, since CFG overshoot damage concentrates at the end of a run.
  • normalize_s (default off) - a legacy option that normalizes the sliding surface to unit norm before the switching function, independent of adaptive_scale. The tooltip says it plainly: adaptive_scale is the preferred cross-model safety net. Leave this alone unless you're chasing paper parity.

You also get the simple node's whole input set - model, smc_lambda, smc_k, warmup_steps, adaptive_scale, max_correction_ratio - with one notable difference: smc_k ranges up to 2.0 here instead of 1.0. The Advanced node assumes you trust the clamp (max_correction_ratio) to keep the correction from running away, so it gives K more room.

Output is a single model (MODEL), wired into the KSampler. Nothing else changes in your graph.

Install

Same pack as the simple node - one install covers both. In ComfyUI Manager, search "CFG-Ctrl", install, restart:

cd ComfyUI/custom_nodes
git clone https://github.com/flyghtxmz/ComfyUI-CFG-Ctrl

No requirements.txt, no model files, only torch. Restart and both nodes show up under the CFG-Ctrl category.

Troubleshooting with the new knobs

  • Chattering / noisy edges - switch to smooth mode and set tanh_delta around 0.2. That's the README's own fix, and it's usually the first thing people hit with the paper's hard sign.
  • Correction blows up or ruins late steps - either trust max_correction_ratio more (it's a hard clamp on ||u_sw|| as a fraction of ||e_t||) or gate SMC off entirely with smc_end_step.
  • Not sure which knob is hurting you - this node, unlike the simple one, lets you burn a lot of time turning dials. The defaults (adaptive_scale on, smooth mode, λ 0.05, K 0.1) are the safe harbor; the paper's λ is 5.0 if you want the full-strength behavior.
  • No effect at all - CFG 1 or a distilled model. There's no cond/uncond error signal to correct, and no switching term can conjure one.

One thing worth knowing before you over-tune: this is a very young pack (the CFG-Ctrl paper only dropped March 2026, the repo days later), so there's no deep community bench of settings for it. The one real integration I've seen is a Wan I2V workflow that runs it alongside NAG for prompt-following. And the standard skeptic's caveat applies double here: if you're comparing modes, change one thing at a time on a fixed seed, and judge across several generations - a single lucky render proves nothing.

CategoryCFG-Ctrl

Inputs (10)

NameTypeDefaultDescription
modelMODEL
smc_lambdaFLOAT0.050–50Exponential decay coefficient λ. Paper recommends 5.0 for FLUX/SD3/Wan.
smc_kFLOAT0.100–2Switching gain K. With adaptive_scale ON: dimensionless ratio of ||e_t||. Safe range: 0.05–0.3.
warmup_stepsINT20–50Initial steps with NO CFG (only cond prediction). SMC starts after warmup.
adaptive_scaleBOOLEANtrueNormalise s_t by ||e_t|| before applying K. Makes K a safe dimensionless ratio across all model types. Disable for the raw paper formulation.
max_correction_ratioFLOAT0.250–1Hard clamp: ||u_sw|| ≤ ratio * ||e_t||. Set 0.0 to disable.
switching_modeCOMBOsmooth'hard' = sign(s) – paper default. 'smooth' = tanh(s/δ) – less chattering.
tanh_deltaFLOAT0.500.0001–5Smoothing bandwidth δ for tanh mode. Smaller = closer to hard sign.
normalize_sBOOLEANfalseNormalise s_t to unit norm before φ (legacy option, independent of adaptive_scale). adaptive_scale is preferred for cross-model safety.
smc_end_stepINT00–200Deactivate SMC after this many steps (fall back to vanilla CFG). 0 = always active.

Outputs (1)

NameTypeDescription
modelMODEL