AdversarialDistillationTrainer<T>
Models & Types · AiDotNet.Diffusion.Distillation
Trainer for Adversarial Diffusion Distillation (ADD) as used in SD/SDXL Turbo.
For Beginners
ADD uses two teachers: (1) a diffusion model that ensures the student captures the right image structure, and (2) a discriminator that ensures the output looks realistic. This dual supervision produces remarkably good single-step images — the student learns both “what” to generate and “how real” it should look.
How It Works
ADD combines a diffusion denoising loss with an adversarial loss from a pretrained discriminator. The student generates a sample in 1-4 steps, a discriminator evaluates realism, and the diffusion teacher provides structure guidance. This dual-loss approach produces the highest quality single-step generators.
Reference: Sauer et al., “Adversarial Diffusion Distillation”, 2023
Constructors
| Constructor | Summary |
|---|---|
AdversarialDistillationTrainer(IDiffusionModel<T> teacher, double adversarialWeight, double diffusionWeight) |
Initializes a new adversarial distillation trainer. |
Properties
| Property | Summary |
|---|---|
IDiffusionModel<T> Teacher { get; } |
Gets the teacher model. |
double AdversarialWeight { get; } |
Gets the adversarial loss weight. |
double DiffusionWeight { get; } |
Gets the diffusion loss weight. |
Methods
| Method | Summary |
|---|---|
T ComputeADDLoss(Vector<T> studentOutput, Vector<T> teacherOutput, T discriminatorScore) |
Computes the combined ADD loss. |