AdaptiveProjectedGuidance<T>
Models & Types · AiDotNet.Diffusion.Guidance
Adaptive Projected Guidance (APG) for diffusion model inference.
Implements: IGuidanceMethod<T>
For Beginners
Standard guidance can sometimes push the image in bad directions, causing artifacts. APG is smarter — it only keeps the “useful” part of the guidance while discarding the part that causes problems.
How It Works
APG projects the guidance direction to reduce components that cause artifacts. It decomposes the guidance vector (per sample) into parallel and orthogonal components relative to the conditional prediction; the parallel component causes oversaturation and is down-weighted, while the orthogonal component, which improves quality, is kept.
Reference: Sadat et al., “Eliminating Oversaturation and Artifacts of High Guidance Scales in Diffusion Models”, 2024 (APG). The update is d_perp + eta d_par with eta = 1 - projectionStrength; the paper’s eta = 0 corresponds to projectionStrength = 1.
Constructors
| Constructor | Summary |
|---|---|
AdaptiveProjectedGuidance(double projectionStrength) |
Initializes a new Adaptive Projected Guidance instance. |
Properties
| Property | Summary |
|---|---|
GuidanceType GuidanceType { get; } |
Methods
| Method | Summary |
|---|---|
Tensor<T> Apply(Tensor<T> unconditional, Tensor<T> conditional, double scale, double timestep) |