ComfyUI Node

ClybGuidance

The do-everything CFG patch for Chroma (and it ships off by default)

By Clybius·Created about a year ago·Updated about a month ago· 13
ClybGuidance
  • model
  • MODEL
eta1.00
norm_threshold0.0
momentum0.00
momentum_beta0.75
momentum_renorm1.00
scalar_projectionfalse
scalar_logsumexpfalse
rescale_phi0.00
var_rescalefalse
scale_up_ratio0.00
scale_up_shift1.00
atan2sin_ratio0.00

Chroma obeys your prompt the way a very literal assistant does: give it a long sentence and it complies, push CFG up and it complies harder - until the image burns and the highlights blow out. That's the problem this node exists to fix. ClybGuidance is a pre-CFG model patch that rewrites how your conditional and unconditional predictions are combined on every sampling step, bundling half a dozen guidance tricks that usually live in separate nodes into one box.

The clever part is how it ships: with every feature at its default, the patched model produces identical output to plain CFG. eta is 1.0 (that's "default CFG behavior", per the tooltip), and everything else defaults to off or neutral. So you can drop it into any Chroma or flow-matching workflow, confirm nothing changed, then turn on one knob at a time instead of fighting a wall of parameters.

How it works

It's applied to the MODEL before sampling, so it hooks the CFG step itself. Internally it takes the guidance vector (cond - uncond) and runs it through whichever of these you've enabled:

  • Project-and-scale (eta) - splits guidance into a component parallel to the conditional and one orthogonal to it, then scales only the parallel part. eta = 1.0 is stock CFG; it can even go negative if you want to push away from the prompt.
  • Norm clamping (norm_threshold) - if the guided output's L2 norm exceeds the conditional's norm times this value, it's rescaled back down. Good for keeping CFG from running away. 0 = off.
  • Momentum (momentum, momentum_beta, momentum_renorm) - adds a fraction of a running average of past guidance to the current step's guidance, optionally restoring the original length afterward. 0 = off.
  • CFG rescale (rescale_phi, var_rescale) - the familiar rescale trick (via std or var) that stops over-saturation at high CFG.
  • Sine-bell schedule (scale_up_ratio, scale_up_shift) - animates effective CFG from 1.0 at the start, up to your CFG in the middle, back to 1.0 at the end. This is the one flow-model folks actually rave about, because it spends your guidance where composition happens.
  • Scalar projection (scalar_projection, scalar_logsumexp) and atan2/sin blend (atan2sin_ratio) - more exotic tools, the latter a Chroma-specific twist on the guidance direction.

The inputs that matter

For a beginner, three knobs earn their keep: eta (start at 1.0, nudge toward 1.2–1.5 if you want more prompt push without full CFG damage), rescale_phi (the standard anti-burn rescale, try 0.3–0.7 at high CFG), and scale_up_ratio (turn on the sine bell and watch detail improve at the same CFG). Everything else is a rabbit hole you can visit later.

Wiring it in

Feed it your model and patch the output into KSampler's model input. Your CFG scale still lives on the KSampler - this node just changes how that scale gets applied. It works with Chroma, FLUX, and SD3, and it detects flow-matching models automatically for the parts that need timestep math.

model → ClybGuidance → KSampler(model=…, cfg=4)

Installing

This is one node in the ComfyUI-ClybsChromaNodes pack, and there are no extra Python dependencies - nothing to pip install, no model files to fetch:

cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/Clybius/ComfyUI-ClybsChromaNodes.git
# then restart ComfyUI

Or search "ComfyUI-ClybsChromaNodes" in ComfyUI Manager and let it do the clone. The author, Clybius, is the same person behind the Chroma-GGUF quantizations, so this is genuinely a Chroma-focused tool, not a grab-bag.

Common issues

One real trap: the atan2sin_ratio tooltip is a copy-paste error - it repeats rescale_phi's "standard deviation renormalization" text. Trust the README, not that tooltip. And resist the urge to enable several features at once; each is a separate variable and you'll never learn what fixed what. Finally, if you came here looking for ChromaNAG (the pack's Normalized Attention Guidance class), it's in the code but not registered as a node - you won't find it in the add-node menu yet.

Categorysampling/custom_sampling

Inputs (13)

NameTypeDefaultDescription
modelMODEL
etaFLOAT1.00-50–50Controls the scale of the parallel guidance vector. Default CFG behavior at a setting of 1.
norm_thresholdFLOAT0.00–50Normalize guidance vector to this value, normalization disable at a setting of 0.
momentumFLOAT0.00-10–10Controls the amount of momentum applied to the latent, disabled at a setting of 0.
momentum_betaFLOAT0.750–0.999Controls a running average of guidance during diffusion.
momentum_renormFLOAT1.000–1Re-normalizes your latent after applying momentum, back to its norm before momentum.
scalar_projectionBOOLEANfalseApplies scalar projection of cond -> uncond onto the uncond.
scalar_logsumexpBOOLEANfalseWhether we use torch.logsumexp (true) or torch.sum (false) for scalar projection.
rescale_phiFLOAT0.000–1Applies standard deviation renormalization of CFG to cond at this rate.
var_rescaleBOOLEANfalseWhether we use torch.var (true) or torch.std (false) for rescaling.
scale_up_ratioFLOAT0.000–1Weight of: Initiating CFG at guidance scale 1, increasing to your guidance scale in the middle of diffusion, and lower back to 1.
scale_up_shiftFLOAT1.000.1–10Whether to shift to your CFG scale later (lower than 1.0) or earlier (higher than 1.0) in the schedule.
atan2sin_ratioFLOAT0.00-100–100Applies standard deviation renormalization of CFG to cond at this rate.

Outputs (1)

NameTypeDescription
MODELMODEL