CivArchive
    ← All articles
    Published October 5, 2026by pacifier580737

    From CFG to vector steering: Advanced guidance nodes in ComfyUI

    19 views0 reactions0 comments on CivitAI0 collected
    tool guidelistsdxlcomfyui

    Before Read

    This article lists ComfyUI nodes oriented towards the cond direction.
    Many of these can be used across different models since they aren't specific to any particular type.

    The almost-unrelated cover is generated by asymflux with a little 'help' of TCFG and SMC-CFG.

    I have noticed the suspicious wiring out there. Don't do anything 'stupid'.

    Perp-Neg

    date: Apr 2023
    link: arxiv
    node link: Comfy-Org/ComfyUI/comfy_extras/nodes_perpneg.py & Extraltodeus/pre_cfg_comfy_nodes_for_ComfyUI/nodes.py

    Perp-Neg improves prompt adherence by constraining the negative prompt's denoising direction to be perpendicular to the positive prompt's direction.

    Process time is longer than Normalized Attention Guidance.

    Negative Prompt in Prompt (NegPiP)

    date: Jul 2023
    link: github
    node repo: pamparamm/ComfyUI-ppm & laksjdjf/cd-tuner_negpip-ComfyUI

    This node enables negative weights in prompt.
    Without it, the model will alter the token identity(key) and corrupt the image.

    Its process time is faster than NAG, but it is more sensitive than a normal negative prompt.

    It is guaranteed to work on SD1, SDXL, and Anima.

    Manifold-constrained Classifier Free Guidance (CFG++)

    date: Jun 2024
    link: arxiv
    node repo: Comfy-Org/ComfyUI & xxiiyu/cui_generalized_guidance_forms & xxiiyu/extra_cfgpp & pamparamm/ComfyUI-ppm

    The manifold here is a geometric constraint: a low-dimensional surface in high-dimensional image space where natural/clean image info exist. It is sampled from unconditional data.
    See figure 3 in the paper
    Conditional guidance is supposed to make the latent sample land on a manifold.

    CFG++ keeps sampling closer to the manifold by:

    • using interpolation instead of extrapolation between unconditional and conditional sampling.
      replace normal cfg scale ω with λ ∈ [0, 1]

    • applying proper geometric correction during the sampling process.
      replace picked guided noise prediction ^cω​(xt​) with unconditional noise prediction ϵ^∅​(xt​).

    It excels at recreating fine-grain features of a prompt. Good for consistency, bad for creativity.

    According to the discussion post, CFG scale should be limited to [0,2] instead of [0,1].
    Combining it with other guidance methods offers benefits.

    Skimmed CFG

    date: Aug 2024
    node repo: Extraltodeus/Skimmed_CFG

    A smarter way to stabilize CFG. It avoids over-amplification to pixels caused by high CFG scale.
    Next time I really have to explain only when necessary.

    The node pack can be roughly split to four groups:

    • Group A

      • Skimmed CFG

      • Skimmed CFG - Timed flip

      • Skimmed CFG - Clean Skim

    • Group B

      • Skimmed CFG - replace

    • Group C

      • Skimmed CFG - linear interpolation

      • Skimmed CFG - linear interpolation dual scales

    • Group D

      • Skimmed CFG - Difference CFG

    Except for the Difference CFG variant, Skimmed CFG finds and corrects the pixels that have overlapping guidance directions in pairs.

    Group A corrects them by removing the difference of guided prediction between CFG & skimming scale.

    • full_skim_negative: turn this on, and uncond of these pixels will be replaced by cond.

    • disable_flipping_filter: turn it on, and it will filter out less pixels to not correct.

    • flip_at_percentage: when set above 0, disable_flipping_filter will be reversed until de-noise progress reach this value.

    full_skim_negative and disable_flipping_filter will dampen the anti-burn feature that's already weak, and Timed flip & Clean Skim variant enable full_skim_negative by default.

    Group B corrects them by simply replacing their uncond prediction with cond prediction.
    Noisy artifact will show up when CFG is set too high, Difference CFG with root_distance method can mitigate that without too much semantic change.

    Group C corrects them by replacing uncond prediction with the mix of their uncond & cond prediction by 'fallback weight'. It is the best burn remover with no need for 'crutch' in the pack.

    • uncond = cond * (fallback_weight - 1) + uncond * fallback_weight
      fallback weight = (skimming scale-1) / (cfg scale -1)

    • dual-scale version is equivalent to regular version when positive scale = negative scale.
      turn down positive scale to reduce saturation and the effect of positive conditioning.
      turn up negative scale to reduce saturation and enhance the effect of negative conditioning.

    group D does mixed predictions like Group C, it applies to all the pixels and acts like a CFG mimic.

    • If you choose absolute_sum, 'skimming scale' = cond_scale * ref_norm / cfg_norm
      uncond prediction will still be mixed with cond prediction by 'fallback weight'.
      fallback weight = (skimming scale-1) / (cfg scale -1)
      cond_scale is CFG scale, ref_norm is L1 norms of guided prediction at reference_cfg scale.
      cfg_norm is L1 norms of guided prediction at CFG scale.

    • If you choose other methods, 'skimming scale' = reference_cfg,
      uncond prediction will be mixed with guided reverse prediction at the scale of (skimming scale-1) / (cfg scale -1) by absdiff: a 0~1 mask containing the difference of 'residual' prediction between CFG & skimming scale.

    • If you sort these methods by how much content of the guided prediction at reference cfg they can preserve, you'll find absolute_sum > squared_distance > linear_distance > root_distance.


    Skimming CFG scale is roughly related to CFG temperature, set it to a safe value of CFG scale.
    For example: choose 3~7 with a regular sampler, choose 0~2 with a cfg++ sampler.

    Please remember these nodes can only suppress over-saturation caused by high cfg scale.

    Making classifier free guidance help in naive raw conditioning jumps (MaHiRo)

    date: Dec 2024
    link: github pull / demo graph
    node link: Comfy-Org/ComfyUI/comfy_extras/nodes_mahiro.py

    At first, the node is called
    "Mahiro is so cute that she deserves a better guidance function!! (。・ω・。)".

    Someday it is changed to "Positive-Biased Guidance".

    This node rotates the final conditioning towards positive one, it has no config.
    Activate it if you believe the positive prompt is cleaned with no negative element.

    Negative Rejection Steering (NRS)

    date: Mar 2025
    link: demo graph
    node repo: Reithan/negative_rejection_steering

    An alternative to native CFG controller.
    This simple node disables CFG scale and may conflicts with other components.

    It replaces 'scale' with 'Skew', 'Stretch' and 'Squash':

    • skew: pulls and stretches final conditioning away from negative one.

      • its direction is perpendicular to positive conditioning.

    • stretch: pulls and stretches final conditioning toward positive one.

    • squash: pulls the length of final conditioning back to its original length.

      • It doesn't magically stop over-burn, maximization makes the latent noisy when nrs scale overshoots.

    Don't expect it to enhance negative guidance.
    Old examples don't have much meaning, but you may see a slight improvement on splitting identities when skew is stronger than stretch.

    Tangential Damping Classifier-free Guidance (TCFG)

    date: Mar 2026
    link: arxiv
    note link: Comfy-Org/ComfyUI/comfy_extras/nodes_tcfg.py & pamparamm/ComfyUI-ppm/src/nodes_ppm/guidance.py

    For the manifold, see CFG++ section.
    See Figure1, the paper combines a concept called score function with manifold.
    The grey line represents the alignment of scores to the tagent of a manifold. Poor alignment makes guided score drift away from manifold.

    TCFG makes guided score land closer to manifold by removing unconditional score components tangential to a manifold.

    Native node has no config. ppm allows you to mix and schedule TCFG.

    Sliding Mode Control CFG (SMC-CFG/CFG-Ctrl)

    date: Mar 2026
    link: arxiv
    node repo: flyghtxmz/ComfyUI-CFG-Ctrl & pamparamm/sd-perturbed-attention & xmarre/ComfyUI-CFG-Ctrl & belgiangurista-art/ComfyUI-SMC-CFG & ethanfel/ComfyUI-CFG-CTRL

    A nonlinear control-based guidance mechanism that introduces a switching control term to enforce fast and stable convergence along the sliding mode surface.

    Basic:

    • smc_lambda (λ): decides the shape/steepness of sliding mode surface

      • see Figure 1 in the paper, sliding mode surface is 𝐞˙=−λ⋅𝐞, ideal trajectory is 𝐞˙=−λ₀⋅𝐞.
        the surface is in a linear shape, though it is not mandatory.
        start point lies on the ideal trajectory. Since the velocity of conditioning decides the position of start point, λ₀ is not a static value.
        practically, for two axes, 𝐞˙ = e_t - e_{t-1}, 𝐞 = e_{t-1}.
        𝐞 = cond - uncond, it shows the guidance error.
        𝐞˙ shows how fast guidance error changes at a moment, the measure here is 𝐞/step.

      • lower λ emphasizes correcting the rate change of guidance error. while high λ focus on correcting guidance error.

      • default value works, it doesn't need much adjustment, just set whatever you like.

    • smc_k (k): frequency factor of switching control

      • see Figure 1 in the paper, switching control looks like the arrows at both sides of the convergence curve. arrows increase along with k.

      • see Table 3 in the paper, increase the value may improve text adherence while destroy adherence to trained data by a little bit.

      • maximizing it may destabilize generation, turn it down if you see latent is unsteady when de-noising details.

      • default value works, keep it below 1 is recommended.

    Simple (flyghtxmz):

    • warmup_steps: CFG is equal to 1 until the generation reaches this step number.

      • the node is off until warmup steps are finished.

    • adaptive_scale: it makes the same k value safe across models.

      • when toggled on, sliding mode surface will be divided by ||e_t|| before switching control, and then scaled up by ||e_t|| afterward.
        division will only work in smooth mode, it prevents information loss caused by tanh function.
        multiplication brings the bound up from [-1, 1] to [-||e_t||, ||e_t||]

    • max_correction_ratio: a hard safety clamp. It prevents runaway correction at the cost of 'creativity'.

      • turning it on will make the bound of surface stay inside
        [ - max_correction_ratio ⋅ ||e_t||, max_correction_ratio ⋅ ||e_t||]

    Advanced (flyghtxmz):

    • switching_mode: a function selector determines how the sliding mode surface is processed in switching control.

      • see Algorithm 1, switching control is written in line11.
        if you choose hard, it sticks to the paper and uses sign/signum function.
        if you choose smooth, it uses tanh function. This mode helps reduce noisy edges and chattering/rapid zero-crossing oscillation.

    • tanh_delta: stiffness factor for smooth switching mode.

      • default value is 0.1 in simple, 0.5 in advanced.

      • minimizing the value is roughly equivalent to using the sign function.
        compare tanh(x⋅10^8) with sign(x) if you want.
        1e-8 is used to avoid 'division by zero'.

    • normalize_s: like adaptive_scale, it makes behavior more consistent across models

      • when toggled on, sliding mode surface will be divided by its norm.
        it'll possibly adjust its bound to around [-1, 1]
        only in smooth mode is it effective.
        it is done between switching control and optional division from adaptive scale.

    • smc_end_step: the node will be off after generation progress reach this step.

    If you want to combine it with APG, connect the model patch route like this:

    [Load Checkpoint] ──► [APG] ──► [SMC-CFG (CFG-Ctrl)] ──► [KSampler]

    If you put it ahead of APG, only APG will take effect among those two.

    Archived from CivitAI · Updated October 8, 2026View source