LatentApplyOperationCFGToStep
Bend one single denoising step — the surgical one
- model
- operation
- MODEL
Everything else in this pack bends a layer for the whole generation. This node is the opposite instinct: it applies an operation to the intermediate latents at exactly one denoising step, then gets out of the way. If you want to know what step 2 "does" to your image, this is how you find out - and it's the most surgical tool in the kit.
The mechanism sits in a pre_cfg_function, which runs after ComfyUI computes the conditioned latents but before the model applies them. The node figures out which step it's on by matching the current sigma against the sampler's sigma schedule, and when step_num == step, it applies your LATENT_OPERATION. The interesting subtlety: with two conditionings (positive and negative), it applies the operation to (positive − negative) and adds the negative back. In other words, it bends the guidance direction - the delta CFG extrapolates along - rather than the raw positive latent. That's a much more contained effect, and it's a thoughtful detail that says the author thought about where this should bite.
Inputs: model, the operation (a LATENT_OPERATION from the pack's builder nodes), and step (default 0, min 0 - which denoising step gets bent). Step 0 is the first, noisiest step, where the coarse composition is being decided - bending there is the most dramatic. Late steps (18 of 20, say) touch only fine detail.
Why reach for it instead of just cranking the operation the whole way? Because single-step bending is diagnosable. Apply a multiply-scalar of 10 at step 2 and compare against step 12: if the composition shifts but the details don't, you've learned exactly what step 2 decides. It's also the gentlest way to add variety - a one-step nudge with noise at a step you've mapped out gives you consistent, repeatable drift instead of a full-image scramble.
Install: ComfyUI Manager → search "ComfyUI-Model-Bending" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/abuzreq/ComfyUI-Model-Bending
Dependencies: kornia and scikit-learn (the latter only matters if you also use Compute PCA).
Two honest caveats. First, the step counter assumes your sampler actually reports sigmas - with exotic samplers or a denoise < 1 img2img pass, "step" may not line up with your intuition of the steps UI. Second, the effect at a single step is often subtle at small operation values; the pack's example workflow multiplies by 10 at step 2 precisely because you need to go big to see it. Start with a big operation at step 0 to see it work, then dial back.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| operation | LATENT_OPERATION | — | |
| step | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |