Learning CFG schedules with a GAN: a density-ratio discriminator beats fixed guidance on preferences

Adversarial Learning of Classifier-Free Guidance Schedules

Ashwini Pokle, Alexandre Galashov, Arnaud Doucet, Mauricio Delbracio, Valentin De Bortoli

cs.LG

2026-08-14

Swap constant CFG for an MLP that sets guidance per timestep, prompt and state, trained via a density-ratio discriminator; alignment and preference metrics beat all baselines.

What problem this solves

Nearly every text-to-image model ships with classifier-free guidance (CFG): at each sampling step the model extrapolates between its prompt-aware and prompt-blind velocity predictions, pushing the trajectory toward the prompt. The extrapolation weight is almost always a single constant, typically around 7.5, applied identically across all timesteps, samples, and prompts. That setting has been standard since 2022.

The cost is well documented: oversaturation and artifacts, worse at higher weights. Guidance strength that suits early denoising steps does not suit late ones, and a prompt like "a black dog" needs less pushing than "the same room in the past and present, side by side". Two lines of work address this. Hand-designed dynamic schedules, such as LIG (guidance applied only on a middle interval) and CLG (piecewise-linear), work but need per-dataset tuning and still ignore the prompt. Learned schedules, from the same group of authors (ICLR 2026), used MMD with an energy kernel to enforce a distribution-matching condition; training was stable, but text alignment never beat constant CFG. The bottleneck was the estimator: a fixed-kernel MMD on high-dimensional latients gives high-variance gradients.

This paper replaces the estimator with a GAN discriminator.

Method

The target condition is marginal consistency: after one guided step from time s to t, the particles' distribution should match the true forward-noised distribution at t. Written as a KL divergence, the objective reduces to the density ratio pt(x)/pt^{s,w}(x). The classical GAN result plugs in here: the optimal discriminator's logit equals the log density ratio. No hand-designed kernel is needed; the discriminator itself is the density-ratio estimator.

Three components:

Training alternates discriminator and guidance-network updates under TTUR for 60,000 steps, with real and fake branches built from independently sampled image-prompt pairs so the discriminator cannot cheat by recognizing a single trajectory. At inference the discriminator is gone entirely; only the MLP rides along with the sampler, at negligible cost. This is the real separation from discriminator-guidance methods, which pay at inference time; here the discriminator is strictly a training-time supervisor. A practical detail: the "unconditional" branch uses a fixed negative prompt ("blurred, blurry, disfigured, ugly, tiling, poorly drawn") rather than an empty condition, applied equally to every baseline.

Results

MS-COCO 512x512, custom-trained flow-matching backbone (MMDiT-S, 1.05B), frozen throughout:

MethodFID downCLIP upAesthetic upHPSv2 up
Constant w=7.531.110.30635.310.2850
LIG (hand-designed)24.950.30425.310.2843
MMD+SC (prior learned)28.550.30675.290.2847
GAN+MC (ours)31.700.30685.340.2856

All four alignment and preference metrics land best or tied-best in the group; the 740M MMDiT-XS shows the same ordering (CLIP 0.3048, Aesthetic 5.32, HPSv2 0.2829). PickScore ties constant CFG at 0.2214.

FID moves the other way. GAN+MC sits in the worst tier on both models: 31.31 on the small one, 1.6 points above constant CFG and 5.7 above LIG. The paper attributes this to adversarial training plus CLIP-reward optimization favoring semantics and visual pop over matching low-level Inception-v3 statistics, citing prior work on the misalignment between FID and human preference at high guidance.

The ablations carry real information: an MLP on geometric statistics beats a convolutional network on raw latents (Aesthetic 5.32 vs 5.26); removing the CLIP reward drops HPSv2 from 0.2927 to 0.2825; 128 sampling steps work best, and cutting to 32 steps actually improves FID (28.45) at some cost in alignment. Independence of noise and of image-prompt pairing, two choices motivated by theory, barely matter empirically.

Why it matters

The CFG weight has been a hand-tuned knob for three years, and most production stacks still use a global constant. The alternative offered here has two practical virtues: the weight adapts per timestep, prompt, and state, and inference costs nothing beyond one MLP forward pass per step. The per-model, per-dataset retuning that hand-designed schedules require disappears in principle.

The deeper contribution is the supervision signal. The density ratio has a closed-form correspondent in the discriminator's logit, replacing a fixed-kernel nonparametric estimator. That idea should transfer to other learned sampling-time controllers, such as step-count or noise schedules.

The honest caveat: absolute gains on alignment metrics are small. On the 1.05B model, CLIP is 0.3068 against 0.3067 for MMD+SC and 0.3063 for constant CFG; HPSv2 improves by 0.0006 to 0.0009; Aesthetic's 0.03 to 0.05 is the largest gap. The direction is consistent; the magnitude is marginal.

Limitations

The authors state three: training is complex, an adversarial game over diffusion trajectories needing TTUR-style care; the scheduler is backbone-specific, since it reads geometric statistics of one particular velocity field, and cannot transfer zero-shot to another architecture; and the CLIP reward inherits CLIP's known flaws, with alternative rewards left to future work.

Three more from reading the paper closely. Validation covers only the custom MMDiT-XS/S models (up to 1.05B) on MS-COCO; there are no results on public flagships like SD3 or Flux, so the scaling claim rests on two custom sizes. Checkpoints were selected by CLIP score on a 3,000-image subset, a selection bias favoring the reported CLIP numbers. And the FID degradation the paper calls "marginal" holds only for the large-model comparison against constant CFG (31.70 vs 31.11); against LIG the gap is nearly 7 points, which is not marginal.

Terms

Source

What people are saying

Related papers

All paper explainers