ADG: Angle Domain Guidance (Jin et al. 2025)
Stop stretching the guidance, rotate it instead
- model
- MODEL
Angle Domain Guidance (Jin, Xiao, Liu & Gu, ICML 2025) is the cleanest idea in this whole pack, and the easiest to explain over coffee: don't make the guidance longer, make it turn.
CFG's core move is extrapolation. u + w(c - u) walks past the conditional prediction along the
line joining it to the unconditional one, and the further you walk the more the latent's norm grows -
which is where saturation, clipped highlights and plastic skin come from. ADG changes the geometry.
It measures the angle between the conditional and unconditional predictions, then turns the denoised
prediction away from the unconditional one by (w - 1) times that angle - capped at a maximum -
instead of sliding it along the line. The result keeps a bounded length no matter how high your scale
goes, because rotating a vector doesn't lengthen it.
That's the whole pitch: high prompt adherence, no norm blowup, and the artifact mode you're trading into is a rotation of the content rather than a brightening of it.
Inputs
Two of them matter.
- model - from your checkpoint or LoRA loader, before the sampler.
- scale (default -1) -
-1means "use the KSampler's cfg". Because ADG's output length is bounded by construction, pushing the scale higher here is less self-destructive than it is with plain CFG. That's the point of the method. - max_angle_degrees (default 60, the paper's value) - the ceiling on how far the prediction is allowed to turn away from the conditional prediction. This is the knob that decides whether you're getting mild or aggressive guidance; 60 is already a substantial turn. Lower it (30–45) if you want ADG to behave as a gentle twist rather than a re-composition, and raise it toward 90+ only if you like living dangerously.
- space -
autocomputes the rule in the denoised image, which is where the angle rule was published. This one is definitively nonlinear: the angle is different in the noise space and the velocity space, soautois not a comment about convenience, it's a claim about the result.
Output is a MODEL. Wire it between the loader and the KSampler.
Install
# ComfyUI Manager: search "CFG Megapack" -> Install -> restart
# or:
comfy node install comfy-cfg-megapack
# or by hand:
cd ComfyUI/custom_nodes && git clone https://github.com/AbstractEyes/comfy-cfg-megapack
The pack has no dependencies beyond ComfyUI's own torch, and nothing to download. It requires
ComfyUI 0.38+ because it uses comfy_api.latest; on anything older the nodes don't register at all.
Where this idea also lives in the pack
ADG's rotation is the seed of the pack's CFG Govern: Angle Band, an in-house node that sits after
every other stage and enforces a band instead of a rule: a max_angle_degrees leash on how far the
final prediction may sit from the conditional one, and optionally a minimum so weak guidance gets
turned further along its own direction. Everything inside the band is left bit-for-bit alone; a unit
that violates the bound is rotated exactly onto the nearest edge, keeping its length. The pack's
authors modelled it on the anchor governor from their own AlephLLM project, and they quote the
measurement that makes the defaults sensible: on SDXL at 1024x1024, 50 steps, cfg 7, the guided
prediction sits 25–33° from the conditional one over the first ten steps, under 20° by step 14 and
under 10° by step 23. So a 30° leash constrains the composition phase and leaves the detail phase
alone.
If you like ADG but want a different mix rule underneath it, that's the combination to build: any mix node, then the governor.
Traps
A later mix node wins. ADG writes the combine stage of the guidance plan. If you chain another
paper node from the "combining the two predictions" menu after it, that one replaces ADG entirely -
they don't stack. Corrections (the CFG Correct node) do stack, which leads people into the wrong
mental model.
Shared CFG-function slot. ComfyUI's model holds one CFG function; RescaleCFG, Mahiro and RenormCFG from other packs write the same slot, and the last node chained is the only one that runs.
At cfg 1 nothing happens, and the pack still turns the second pass back on. Guidance-distilled
2026 models run at cfg 1 by design; w - 1 is zero, there's no angle to apply, and you've just lost
the CFG-1 speedup ComfyUI's math.isclose(cond_scale, 1.0) shortcut gives you - the pack's hook sets
disable_cfg1_optimization so the unconditional prediction is always computed. Use this on SDXL/SD1.5
or a non-distilled base running CFG 4–9.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| scale | FLOAT | -1.0-1–100 | The guidance scale w for this rule. -1 uses the sampler's cfg value. |
| max_angle_degrees | FLOAT | 601–180 | Largest turn away from the conditional prediction (paper 60). |
| space | COMBO | auto (the method's own) | Where the rule is computed. Linear rules give the same image in any space; nonlinear ones do not. 'auto' uses the space the method was published in (noise for most, denoised for APG and the angle rule, velocity for flow models). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |