Nodes/ComfyUI/Adaptive Projected Guidance
ComfyUI Node Runs on cloud

Adaptive Projected Guidance

Adaptive Projected Guidance, the guidance hack from the audio world

By Comfy-Org·Created 4 years ago·Updated about 6 hours ago· 129,874
Adaptive Projected Guidance
  • model
  • MODEL
eta1.00
norm_threshold5.0
momentum0.00

APG - Adaptive Projected Guidance - is a model patch that changes how classifier-free guidance is applied. Instead of pushing the full guidance vector at the sample, it splits guidance into two components: one parallel to the current sample direction (which can be scaled independently via eta) and one orthogonal to it (which gets normalized by norm_threshold and optionally smoothed by momentum). The goal is the standard one for guidance patches: keep the prompt pull strong while stopping the guidance from shoving the sample off the data manifold into artifact territory.

It ships with ComfyUI core (comfy_extras/nodes_apg.py), added in May 2025. It's one of those nodes that found its first real audience outside images - the clearest corpus signal for "Adaptive Projected Guidance" is in audio-diffusion workflows (ACE-Step), where APG is a standard guidance technique. In ComfyUI it's a MODEL-in, MODEL-out patch, so it slots into any sampler path.

How it works

The patch intercepts the CFG computation. Given the guidance vector (cond − uncond), it decomposes it:

  • parallel component - along the sample's own direction. eta scales it; at eta = 1 you get the tooltip's promise: "Default CFG behavior at a setting of 1." Raise it and you intensify the prompt-aligned push; lower (even negative) and you soften it.
  • orthogonal component - perpendicular to the sample direction. This is where overshoot usually comes from, so it gets constrained: norm_threshold caps the guidance vector's norm to that value (0 disables normalization), and momentum blends in a running average of past guidance to smooth step-to-step jitter (0 disables, negative inverts - the May 2025 fix commit was literally "fix negative momentum").

The knobs:

  • eta - parallel guidance scale, −10 to 10, default 1 (≈ plain CFG).
  • norm_threshold - normalization cap, 0–50, default 5. 0 = off.
  • momentum - running-average weight, −5 to 1, default 0. 0 = off.

Output is a patched MODEL you feed to your sampler or guider like any other.

When you'd reach for it

When plain CFG is working but rough - the classic symptoms being oversaturation, over-contrast, or guidance that seems to fight the sample in the final steps. APG is a gentler guidance mechanism: the orthogonal push is normalized instead of scaled without bound, and momentum keeps the guidance from flickering between steps. For models where CFG is finicky and you've already tried lower CFG, an APG patch with eta near 1, a modest norm_threshold, and a small momentum is a legitimate alternative. Audio folks treat it as near-essential; image folks use it when they need it.

Where people get burned

  • eta=1 is "default CFG behavior," not "no change." The patch still restructures the guidance even at eta 1 - the decomposition and normalization are active. If you want literally zero effect, don't apply the patch at all.
  • Stacking it on guidance-distilled models. At CFG 1 there's no unconditional pass for APG to decompose - the patch is meaningless there, same as any CFG machinery. This is a real-CFG (SD 1.5/SDXL/Pony-family) tool.
  • norm_threshold=0 is a special value. It doesn't mean "normalize to zero," it means "disable normalization." Easy to misread.
  • Expecting a dramatic change. APG is a stabilization technique; the honest framing is "same idea, gentler behavior," not "dramatically better images." Test it fixed-seed against plain CFG before you commit to it.

If you're on an SDXL-family model fighting CFG overshoot, this is worth an afternoon. If you're on a 2026 distilled model, it's not for you - the machinery it patches isn't running.

Categorymodel/sampling/custom

Inputs (4)

NameTypeDefaultDescription
modelMODEL
etaFLOAT1.00-10–10Controls the scale of the parallel guidance vector. Default CFG behavior at a setting of 1.
norm_thresholdFLOAT5.00–50Normalize guidance vector to this value, normalization disable at a setting of 0.
momentumFLOAT0.00-5–1Controls a running average of guidance during diffusion, disabled at a setting of 0.

Outputs (1)

NameTypeDescription
MODELMODEL