Scale-Locked Runtime Context
The unglamorous node that makes the scale-lock graph work
- noise
- guider
- sampler
- sigmas
- latent_image
- runtime
- prepared_noise
- lowres_planner
If you've opened the ComfyUI-ScaleLockedResidualDiffusion pack and seen the "suggested modular workflow", this is the node everything else hangs off. It's the front half of the pipeline: it runs the low-res planner pass, records the trajectory, and builds the aligned high-res noise that the rest of the graph consumes. It doesn't produce a final image on its own - it produces the context that makes the scale-lock correction possible.
The trade worth knowing up front: this node plus "Scale-Locked CFG Guider" plus a plain SamplerCustomAdvanced is the fully modular way to do what ScaleLockedResidualSamplerCustomAdvanced does in one node. You only build this graph if you want the pieces separately - to swap the guider, inspect the planner, or wire something custom in between. For everyone else, the one-node version is less to go wrong.
What it does
Feed it the same five objects a SamplerCustomAdvanced takes - noise, guider, sampler, sigmas, latent_image - plus target_megapixels (the planner resolution; 1.0 default) and it:
- downscales the latent to your target megapixel level and runs the planner pass, caching the per-step denoised x0 trajectory,
- builds the nested high-res noise field that shares the planner's coarse layout while carrying
nested_noise_strengthworth of independent high-frequency detail, - bundles it all into a
SLRD_RUNTIMEobject.
The output you actually care about first is prepared_noise (a NOISE object) - that's the aligned noise field, and it's what replaces your original noise when you sample. The runtime output is the context the guider patcher needs, and lowres_planner is the planner's own final latent, which is handy for confirming the low-res pass did what you expected.
The inputs that matter
Only three knobs here, which is refreshing:
target_megapixels- planner resolution in pixel-space MP. The README's Flux.2 Klein 9B-style first settings use 1.0 for a ~4MP target.nested_noise_strength- how much independent high-frequency detail the high-res noise carries. More freedom, more drift risk; 0.35 default.pin_anchors- pinned-memory staging for the planner's trajectory anchors. Leave it on; it's a memory-layout optimization, not a behavior switch.
How to wire it
The README's modular recipe, in order:
- Build your base
GUIDER,sigmas, andsamplernormally. - Run this node with the base
noise,guider,sampler,sigmas, and target latent. - Feed the
runtimeinto Scale-Locked CFG Guider - that patches your guider with the scale-lock correction and returns a fresh guider without mutating the original. - Feed
prepared_noiseand the patched guider into a plainSamplerCustomAdvanced.
That last step is the thing people forget: the runtime context only does its job if the high-res noise field it built actually reaches the sampler. Wire prepared_noise, not the noise you started with.
Install
No extra Python dependencies, no model downloads - it's pure sampling logic.
cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-ScaleLockedResidualDiffusion
Restart ComfyUI. Or search ComfyUI-ScaleLockedResidualDiffusion in ComfyUI Manager.
Troubleshooting
The main failure mode is a "planner pass did not record any x0 anchors" error, which happens on degenerate runs - check sigmas is non-empty and your sampler is one the pack's guard approves of (euler, heun, ddim, dpmpp_2m, lcm and cfg_pp variants). If you're not using this node in a modular workflow and just want the finished image, seriously, use the one-node sampler instead - you're adding wiring for no benefit.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| noise | NOISE | — | |
| guider | GUIDER | — | |
| sampler | SAMPLER | — | |
| sigmas | SIGMAS | — | |
| latent_image | LATENT | — | |
| target_megapixels | FLOAT | 1.000.1–16 | — |
| nested_noise_strength | FLOAT | 0.350–4 | — |
| pin_anchors | BOOLEAN | true | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| runtime | SLRD_RUNTIME | — |
| prepared_noise | NOISE | — |
| lowres_planner | LATENT | — |