Pre CFG exponentiation
Saturation and contrast, the math way
- model
- MODEL
Every value in a latent prediction sits somewhere on a range, and what you do to that range changes how the image looks in a very predictable way. Pre CFG exponentiation is the pack's rawest style control: it raises the predictions to a power before CFG runs, and the author's README sums up the effect in two lines - an exponent below one simplifies the result and boosts saturation and contrast, above one does the opposite and "if pushed too far will most likely make a mess."
It's marked experimental, and you can feel why. The node takes your cond and/or uncond prediction, applies a normalized power (normalized_pow - it raises values but rescales to keep the overall magnitude sensible), and hands the result to the CFG math. The exponent input (default 0.8, range 0–10) is the whole show. Under 1, the curve flattens large values and lifts small ones - in image terms that's punchier contrast and richer saturation, with a side of simplification (fewer mid-range subtleties). Over 1, the curve stretches values apart, which washes out contrast and can push colors toward the extremes - and the README is not joking about the mess: push past a couple of points above 1 and you get noise and posterization, not style.
The do_on enum (default both) picks which prediction gets the treatment: both, cond only, or uncond only. Applying it to the uncond alone is a neat trick - it reshapes the negative prediction, which changes what CFG "pushes away from" without touching the positive signal, a way to get a flavor of the effect with less risk of wrecking the main prediction.
When would you actually use this? It's the lazy-man's alternative to doing saturation and contrast in post - except it happens during generation, so the model's subsequent steps see the reshaped prediction, and the whole image responds coherently rather than just the final pixels. Fans of punchy, high-contrast output (that "contrasty LoRA look" without the LoRA) reach for a mild sub-1 exponent and let the pipeline do the rest. Pair it in a chain with Post CFG subtract mean if the saturation boost starts pulling a color cast along with it.
Inputs are the minimal three: model, do_on, and exponent. Output is the patched MODEL. There's no sigma windowing on this node - it applies at every step where CFG runs - so it's an all-or-nothing seasoning rather than a phase-specific one.
Install is the pack standard:
cd ComfyUI/custom_nodes
git clone https://github.com/Extraltodeus/pre_cfg_comfy_nodes_for_ComfyUI
or search pre_cfg_comfy_nodes_for_ComfyUI in ComfyUI Manager and restart. No models, no dependencies.
A one-knob node, and the knob goes to 10 - take the README's warning seriously and creep up from 0.8 in small steps. Subtle is where this node earns its keep.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| do_on | COMBO | both | 3 options: both, cond, uncond |
| exponent | FLOAT | 0.800–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |