ComfyUI Node

Scale-Locked CFG Guider

A guider that patches without mutating — and needs its runtime partner

By xmarre·Created 6 months ago·Updated 6 months ago· 2
Scale-Locked CFG Guider
  • guider
  • runtime
  • lock_mask
  • manifold_mask
  • guider
lock_strength0.85
lock_strength_start0.95
lock_strength_end0.25
lock_schedule
lock_schedule_hold0.00
lock_schedule_power2.0
coarse_cutoff0.33
mid_band_cutoff0.60
mid_band_strength0.35
mid_band_strength_start1.00
mid_band_strength_end0.00
mid_band_schedule
mid_band_schedule_hold0.00
mid_band_schedule_power2.0
manifold_enabledfalse
manifold_strength0.45
manifold_strength_start1.00
manifold_strength_end0.00
manifold_schedule
manifold_schedule_hold0.00
manifold_schedule_power2.0
manifold_cutoff0.18
manifold_radial_strength1.00
manifold_anisotropy0.15
manifold_translation_strength1.00
manifold_anchor_mix0.18
manifold_mean_anchor_mix0.12
manifold_contrast_restore0.10
manifold_energy_tether0.00
manifold_channel_tether0.00
manifold_energy_gain_cap1.75
manifold_max_shift_px3.0

This is the node that actually applies the scale-lock math. Where "Scale-Locked Runtime Context" builds the planner trajectory and the aligned noise, Scale-Locked CFG Guider is the denoiser-side correction: it takes a base GUIDER, wraps it with the scale-lock logic, and hands back a new patched guider ready for SamplerCustomAdvanced. A small thing the pack got right: it doesn't mutate the upstream guider object in place, which is a habit too many guider-patching nodes never learned - you can share the base guider elsewhere without it secretly changing under you.

But read the README's warning before you get excited: this node is only the denoiser-side piece. Full Scale-Locked Residual Diffusion behavior depends on the paired runtime context, because the high-res noise field has to be aligned with the low-res planner branch. Patch a guider with this node and skip the runtime context and you'll get a correction with nothing to correct toward. It's a partnership: runtime context builds the plan, this node enforces it.

How it works

You feed it a guider and a runtime (the SLRD_RUNTIME from Scale-Locked Runtime Context), and the usual lock knobs. Internally it patches the guider's denoiser so that during sampling:

  • the low-frequency (coarse) denoised structure gets pulled toward the planner's recorded x0 trajectory,
  • a separate, looser mid-band lock controls medium-scale shape,
  • the model's own high-frequency residual detail is preserved,
  • schedules fade the lock from lock_strength_start down to lock_strength_end so the image is anchored early and freed up late.

The output is a single guider (GUIDER) - feed that into SamplerCustomAdvanced along with the prepared_noise from the runtime context.

The inputs that matter

The lock knobs mirror the rest of the pack, and the pattern is the same everywhere:

  • lock_strength (0.85) / lock_strength_start (0.95) / lock_strength_end (0.25) - coarse lock level and envelope.
  • lock_schedule - release shape; hold_then_drop with lock_schedule_hold ~0.35 is the README's first-settings choice.
  • coarse_cutoff (0.33) - lower is stronger global structure control; drop toward 0.25 if drift persists.
  • mid_band_cutoff (0.60) / mid_band_strength (0.35) - the medium-scale lock; your first release valve when output feels over-constrained.
  • manifold_enabled - off by default. The experimental residual/manifold correction; don't flip it on until the basic lock is dialed.
  • lock_mask / manifold_mask (optional MASKs) - spatially restrict the correction.

The workflow it belongs to

  1. Build your base GUIDER normally.
  2. Run Scale-Locked Runtime Context with noise, guider, sampler, sigmas, and the target latent.
  3. Run this node on the base guider with the returned runtime.
  4. Feed prepared_noise + the patched guider into SamplerCustomAdvanced.

If you're not building a modular graph and just want the finished image, use ScaleLockedResidualSamplerCustomAdvanced or the all-in-one KSampler instead - this node exists for people who want the pieces, not for everyone.

Install

No extra Python dependencies, no model downloads.

cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-ScaleLockedResidualDiffusion

Restart ComfyUI, or install ComfyUI-ScaleLockedResidualDiffusion via ComfyUI Manager.

Troubleshooting

The big one is conceptual: wire this node without a runtime context (or with a runtime built from different inputs) and you'll see little to no effect, because the correction has no planner trajectory to pull toward. If the guider output looks wrong, rebuild the runtime context with the same sampler/sigmas you're about to sample with. And remember - this pack is an honest MVP from a small author; if the lock is fighting an exotic sampler, sampler_guard on the runtime side warns for a reason. Stick to the safe sampler set (euler, heun, ddim, dpmpp_2m, lcm, and the cfg_pp variants) unless you're deliberately experimenting.

Categorysampling/scale_locked

Inputs (36)

NameTypeDefaultDescription
guiderGUIDER
runtimeSLRD_RUNTIME
lock_strengthFLOAT0.850–1
lock_strength_startFLOAT0.950–1
lock_strength_endFLOAT0.250–1
lock_scheduleCOMBO10 options: linear, cosine, flat, smoothstep, smootherstep, ease_in, +4
lock_schedule_holdFLOAT0.000–0.95
lock_schedule_powerFLOAT2.00.1–8
coarse_cutoffFLOAT0.330.05–1
mid_band_cutoffFLOAT0.600.05–1
mid_band_strengthFLOAT0.350–2
mid_band_strength_startFLOAT1.000–1
mid_band_strength_endFLOAT0.000–1
mid_band_scheduleCOMBO11 options: linked, linear, cosine, flat, smoothstep, smootherstep, +5
mid_band_schedule_holdFLOAT0.000–0.95
mid_band_schedule_powerFLOAT2.00.1–8
manifold_enabledBOOLEANfalse
manifold_strengthFLOAT0.450–1
manifold_strength_startFLOAT1.000–1
manifold_strength_endFLOAT0.000–1
manifold_scheduleCOMBO10 options: linear, cosine, flat, smoothstep, smootherstep, ease_in, +4
manifold_schedule_holdFLOAT0.000–0.95
manifold_schedule_powerFLOAT2.00.1–8
manifold_cutoffFLOAT0.180.05–1
manifold_radial_strengthFLOAT1.000–3
manifold_anisotropyFLOAT0.150–2
manifold_translation_strengthFLOAT1.000–3
manifold_anchor_mixFLOAT0.180–1
manifold_mean_anchor_mixFLOAT0.120–1
manifold_contrast_restoreFLOAT0.100–1
manifold_energy_tetherFLOAT0.000–1
manifold_channel_tetherFLOAT0.000–1
manifold_energy_gain_capFLOAT1.751–4
manifold_max_shift_pxFLOAT3.00–64
lock_maskoptMASK
manifold_maskoptMASK

Outputs (1)

NameTypeDescription
guiderGUIDER