Papers
Topics
Authors
Recent
Search
2000 character limit reached

Adaptive Projected Guidance (APG)

Updated 5 February 2026
  • Adaptive Projected Guidance (APG) is a sampling modification for diffusion models that improves image fidelity by reducing oversaturation and visual artifacts at high guidance scales.
  • It employs a principled vector decomposition, selectively down-weights the parallel component, and introduces reverse momentum to refine the denoising update.
  • APG offers a plug-and-play, low-overhead enhancement to existing CFG pipelines, compatible with various diffusion architectures and samplers.

Adaptive Projected Guidance (APG) is a sampling modification for conditional diffusion models that addresses oversaturation and visual artifacts associated with high guidance scales in classifier-free guidance (CFG). APG introduces a principled vector decomposition, parallel-component down-weighting, and reverse momentum to the guidance update. This plug-and-play procedure is compatible with all standard samplers and conditional diffusion architectures, incurring negligible overhead and enabling improved generative fidelity, diversity, and alignment at large guidance scales while systematically reducing oversaturation and detail distortions (Sadat et al., 2024).

1. Mathematical Formulation and Derivation

APG arises as a principled extension of the standard classifier-free guidance (CFG) update used in conditional diffusion models. In the noise-prediction paradigm, the unconditional and conditional denoiser outputs at timestep tt are denoted as εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t) and εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t), respectively. The canonical CFG update, with guidance scale ww, is: Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right) or, equivalently in the predicted-clean space,

Δx=w(x^0,condx^0,uncond)\Delta x = w \left( \hat{x}_{0,\mathrm{cond}} - \hat{x}_{0,\mathrm{uncond}} \right)

APG modifies this update through the following steps:

  1. Decomposition: Define the guidance vector g=x^0,condx^0,uncondg = \hat{x}_{0,\mathrm{cond}} - \hat{x}_{0,\mathrm{uncond}}. Decompose gg into parallel and orthogonal components relative to x^0,cond\hat{x}_{0,\mathrm{cond}}:
    • g=g,x^0,condx^0,cond2x^0,condg=ggg_\parallel = \frac{ \langle g, \hat{x}_{0,\mathrm{cond}} \rangle }{ \| \hat{x}_{0,\mathrm{cond}} \|^2 } \hat{x}_{0,\mathrm{cond}} \qquad g_\perp = g - g_\parallel
  2. Down-weighting: Empirical evidence indicates εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)0 induces oversaturation, whereas εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)1 governs detail. Introduce a hyperparameter εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)2:
    • εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)3
  3. Guided update: The APG update becomes:
    • εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)4
  4. Gradient ascent interpretation, rescaling, and reverse momentum: Observing the guidance update as a step of gradient ascent on εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)5, two additional modifications are introduced:
    • Rescaling: Restrict the update norm to within a radius εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)6: εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)7
    • Reverse momentum: Maintain a negative-momentum buffer εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)8, with εuncond(xt,t)\varepsilon_{\text{uncond}}(x_t, t)9 and εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)0

The final APG-guided prediction utilizes εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)1, yielding: εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)2

2. Algorithmic Realization and Pseudocode

APG can be realized as a direct, low-overhead extension to the CFG sampling pipeline. The following pseudocode illustrates the method precisely in the context of a diffusion sampler:

Δx=w(x^0,condx^0,uncond)\Delta x = w \left( \hat{x}_{0,\mathrm{cond}} - \hat{x}_{0,\mathrm{uncond}} \right)2

Hyperparameters:

  • Guidance scale εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)3 (as in CFG)
  • Parallel-weight εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)4, default εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)5
  • Rescaling radius εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)6 (typically matching average norm of updates)
  • Reverse-momentum coefficient εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)7, default εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)8

3. Computational Implementation and Compatibility

APG is intended as a drop-in replacement for the standard CFG step in diffusion model sampling. No additional denoiser or neural network evaluations are necessary. The computational overhead is limited to a single inner product and projection, one norm calculation and clamping operation (for rescaling), and a running vector addition (for momentum buffering). For a εcond(xt,t)\varepsilon_{\text{cond}}(x_t, t)9 image, this overhead is ww0 ms compared to approximately ww1 ms for a single denoiser pass.

Conversions between noise-prediction and clean-prediction are standard and natively supported in modern diffusion toolkits. APG is directly compatible with any conditional diffusion model—including EDM2, DiT (e.g., DiT-XL/2), Stable Diffusion variants (2/3/XL), distilled samplers (SDXL-Lightning, PixArt-ww2), and rectified-flow models such as SD3. Sampler-agnosticity is maintained: DDIM, PNDM, DPM++, UniPC, and others are supported without modification (Sadat et al., 2024).

4. Empirical Performance and Evaluation

APG demonstrates broad improvements in quantitative fidelity and qualitative artifact suppression across a variety of datasets and diffusion model architectures. The most relevant testbeds include:

  • Class-conditional ImageNet (EDM2-S, EDM2-XXL, DiT-XL/2)
  • Text-to-image generation on MS–COCO (Stable Diffusion 2.1, Stable Diffusion XL)
  • Fast and distilled models (SDXL-Lightning, PixArt-ww3)
  • Rectified-flow models (SD3) for robust text rendering

Key metrics include FID (Fréchet Inception Distance, ww4), precision (ww5), recall (ww6), mean saturation (HSV channel, ww7), and RMS grayscale contrast (ww8).

Model (w) Guidance FID↓ Prec↑ Recl↑ Sat↓ Contra↓
EDM2-S (4) CFG 10.42 0.85 0.48 0.46 0.27
APG 6.49 0.85 0.62 0.33 0.21
DiT-XL/2 (4) CFG 19.14 0.92 0.35 0.37 0.25
APG 9.34 0.89 0.56 0.30 0.20
SD XL (15) CFG 26.29 0.62 0.49 0.28 0.24
APG 25.35 0.64 0.50 0.18 0.17

Qualitative analysis finds:

  • Significant reduction in oversaturation and "pasted-on" contrast with high ww9
  • Elimination of local artifacts (e.g., "fried-egg" textures, checkerboarding)
  • Enhanced text spelling consistency in SD3 rectified-flow (cf. Fig. 8)
  • Mitigation of mode-drift in toy Gaussian-mixture settings (cf. Fig. 18)

5. Hyperparameter Selection and Key Insights

APG's parameterization provides explicit control over the tradeoff between saturation and detail:

  • Parallel-weight Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)0: Default Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)1 (parallel update removed entirely); values up to Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)2 yield increased image "punch" and color saturation.
  • Rescale radius Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)3: Set to match the typical Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)4; e.g., Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)5 for EDM2/DiT and Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)6 for SD 2.1/XL. Small Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)7 underguides (blurry results), while large Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)8 suppresses rescaling's effect.
  • Reverse momentum Δx=w(εcond(xt,t)εuncond(xt,t))\Delta x = w \left( \varepsilon_{\text{cond}}(x_t, t) - \varepsilon_{\text{uncond}}(x_t, t) \right)9: Negative values in Δx=w(x^0,condx^0,uncond)\Delta x = w \left( \hat{x}_{0,\mathrm{cond}} - \hat{x}_{0,\mathrm{uncond}} \right)0 consistently improve FID and recall. Default Δx=w(x^0,condx^0,uncond)\Delta x = w \left( \hat{x}_{0,\mathrm{cond}} - \hat{x}_{0,\mathrm{uncond}} \right)1.

A summary takeaway is that APG acts as a nearly zero-overhead, plug-and-play substitute for CFG, retaining all major benefits (sample alignment, fidelity) while robustly mitigating oversaturation and artifact formation at high guidance strengths (Sadat et al., 2024).

6. Significance and Applications

APG enables the practical use of high guidance scales in conditional diffusion sampling. This removes the primary empirical limitation of CFG (oversaturation, detail artifacts), broadening the effective parameter range for applications requiring strong condition alignment. APG's architecture-agnostic, sampler-agnostic construction and negligible runtime cost facilitate immediate adoption across research and production pipelines in image, text-image, and other generative domains. Empirical improvements in both established quantitative metrics (FID, recall) and qualitative robustness (artifact elimination, improved text rendering) position APG as a robust methodological advancement within guided diffusion model sampling.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Adaptive Projected Guidance (APG).