FastGen icon indicating copy to clipboard operation
FastGen copied to clipboard

LADD Quality on Cifar-10

Open leffff opened this issue 3 weeks ago • 1 comments

LADD on CIFAR-10 (class-conditional, 1 step): FID-50k 2.08–2.11 with two config changes

Hi FastGen team, and thanks for the library! We could not find any published LADD FID on CIFAR-10, and FastGen ships LADD only for Wan2.1-T2V. So we ran FastGen's LADD (LADDModel, code unchanged) on class-conditional CIFAR-10 with FastGen's own trainer. Below are the scores, the config and a few observations, in case they help others.

TL;DR

  • With the LADD method defaults, one-step LADD reaches FID-50k 4.55 at 100k iterations.
  • Two config-only changes bring it to 2.11 / 2.08 (best checkpoint, two seeds, at 50–55k iterations):
    1. Adam β1 = 0 on the discriminator, model.discriminator_optimizer.betas=[0.0,0.999]: 4.55 → 3.42
    2. plus the polynomial (ρ = 7) noise law for re-noising the discriminator's inputs, the law FastGen's DMD2 CIFAR-10 config already uses, model.sample_t_cfg.time_dist_type=polynomial: → 2.11
  • For reference, FastGen reports 1.99 for DMD2 with the same teacher (the GAN loss plus distribution matching).
  • Under the polynomial law, FID rises again after ~55k (2.39–2.56 at 100k) while the discriminator keeps winning, so the choice of checkpoint matters.

Setup

FastGen v0.2.0 (deb93e6). FastGen has no LADD CIFAR-10 experiment config, so we built one from FastGen's own pieces:

  • Method: configs/methods/config_ladd.py defaults, unchanged. That means the EDM CIFAR-10 discriminator (heads on the frozen teacher's features), 4 discriminator updates per student update (student_update_freq=5), AdamW with lr 1e-4, weight decay 0.01 and betas (0.9, 0.999) for both networks, no warm-up, the student's gradient norm clipped at 10, the non-saturating loss, R1 off (gan_r1_reg_weight=0), and independent noise for real and fake.
  • Taken from EDM/config_dmd2_cifar10.py: EDM's class-conditional VP checkpoint as teacher and student init, the noise range [0.0021, 79.56], three constant EMAs (0.9999, 0.99995, 0.9996), TF32 off.
  • Batch: 256 per GPU on 2× H100, so 512 global (not DMD2's 2048), with no gradient accumulation. 100k iterations = 20k student updates = 51M images.
  • Eval: FID-50k from scripts/fid/compute_fid_from_ckpts.py on ema_9999, one step, at every 5k-iteration checkpoint.
  • Cost: 0.65 s per iteration and ~41 GB peak per GPU. 100k iterations take ≈ 18 h; the tuned recipe reaches its best checkpoint (50–55k) in ≈ 9–10 h.
Config: fastgen/configs/experiments/EDM/config_ladd_cifar10.py
from omegaconf import DictConfig
from fastgen.configs.callbacks import EMA_CONST_CALLBACKS
from fastgen.configs.methods.config_ladd import create_config as ladd_create_config
from fastgen.configs.net import CKPT_ROOT_DIR


def create_config():
    config = ladd_create_config()  # LADD defaults: 4 D updates per G update, AdamW lr 1e-4, batch 256/GPU, R1 off
    # teacher, noise range and EMAs as in EDM/config_dmd2_cifar10.py
    config.model.pretrained_model_path = f"{CKPT_ROOT_DIR}/cifar10/edm-cifar10-32x32-cond-vp.pth"
    config.model.sample_t_cfg.min_t, config.model.sample_t_cfg.max_t = 0.00210147, 79.5638
    config.model.use_ema = ["ema_9999", "ema_99995", "ema_9996"]
    config.trainer.callbacks = DictConfig(
        {k: v for k, v in config.trainer.callbacks.items() if not k.startswith("ema")}
    )
    config.trainer.callbacks.update(EMA_CONST_CALLBACKS)
    config.trainer.ddp = True
    config.trainer.tf32_conv = False
    config.trainer.fp16_reduced_precision_reduction = False
    config.trainer.max_iter = 100000
    config.trainer.save_ckpt_iter = 5000
    config.log_config.group = "cifar10_ladd"
    return config

Best recipe (2 GPUs):

torchrun --standalone --nproc_per_node=2 train.py \
  --config fastgen/configs/experiments/EDM/config_ladd_cifar10.py - \
  model.discriminator_optimizer.betas=[0.0,0.999] \
  model.sample_t_cfg.time_dist_type=polynomial \
  log_config.name=ladd_cifar10_poly

Main results

FID-50k (ema_9999, 1 step). "Mean 85–100k" is the mean of the 85k, 90k, 95k and 100k checkpoints.

config best (iteration) mean 85–100k 100k
LADD defaults 4.55 (100k) 4.85 4.55
+ D Adam β1 = 0 3.39 (85k) 3.43 3.42
+ D Adam β1 = 0 + polynomial noise law, seed 0 2.11 (55k) 2.36 2.39
same, seed 1000 2.08 (50k) 2.43 2.56
same, seed 0, rerun 2.18 (50k) 2.40 2.50

The rerun used the same seed with FID every 1k iterations. Its best is 0.06 above the first run's, so differences below ~0.1 are run-to-run noise.

FID-50k by iteration:

iterations 20k 30k 40k 50k 60k 70k 80k 90k 100k
LADD defaults 23.5 8.03 6.10 5.65 5.75 4.94 4.90 4.91 4.55
+ D β1 = 0 23.2 6.88 4.56 4.19 3.78 3.43 3.45 3.45 3.42
+ D β1 = 0 + polynomial, seed 0 22.5 4.31 2.44 2.15 2.15 2.23 2.26 2.32 2.39
+ D β1 = 0 + polynomial, seed 1000 21.8 4.38 2.32 2.08 2.14 2.24 2.28 2.35 2.56

Other things we tried

Single runs, one change at a time against the reference named.

change reference result
D:G 2:1 (student_update_freq=3) defaults (4.55) 11.5 at 100k
D:G 2:1 + D β1 = 0 defaults 3.95 at 100k (mean 4.0)
D:G 2:1 + student lr 5e-5 defaults 3.62 at 100k (mean 3.68)
D:G 1:1 (student_update_freq=2) defaults collapse within each class, FID 178 at 10k, stopped
D:G 1:1 + D β1 = 0 defaults no collapse, but 6.48 at 60k and nearly flat from 50k, stopped
D β2 = 0.99 D β1 = 0 (mean 3.43) mean 3.37: a tie
lognormal noise law, ln σ ~ N(0.31, 1) D β1 = 0 (6.88 at 30k) 8.94 at 30k, stopped
student lr decays linearly to 0 over 70k → 100k D β1 = 0 (mean 3.43; constant-lr resume 3.44) mean 3.18
the same decay D β1 = 0 + polynomial (mean 2.36) mean 2.34: no gain
score ema_99995 / ema_9996 instead of ema_9999 D β1 = 0 (mean 3.43) 3.57 / 3.86

An earlier 8-run sweep at D:G 1:1 (with weight decay 0 and batch 256: uniform / polynomial / lognormal noise law × lr 5e-5 / 1e-4 / 2e-4) collapsed in every run, best FID 89.8.

Observations that may be useful

  1. With the default noise law the discriminator stays at chance. LADD configs inherit SampleTConfig.time_dist_type="uniform", so σ is uniform on [0.002, 80]: the median σ is ≈ 40 and only ~2.5% of draws fall below σ = 2. The logged discriminator loss stays at 1.382–1.384 for the whole run (chance is 2 ln 2 = 1.386). We probed the 100k discriminator of the D β1 = 0 run: AUC 0.95 for σ < 0.05, 0.82–0.85 for σ in 0.05–1, 0.61 for σ in 2–5, and chance above σ ≈ 5. FastGen's DMD2 CIFAR config already sets polynomial, and that law gave LADD its largest gain (best 3.39 → 2.11). A polynomial default for EDM-based LADD, or a note in the config, could save people time.
  2. Under the polynomial law the discriminator keeps winning. Between 10k and 90k its loss falls from 1.16 to 0.88 and the student loss rises from 1.22 to 3.46, while FID bottoms out at 50–55k and then climbs. This looks like the discriminator starting to memorise the 50k training images. We have not tried R1 (gan_r1_reg_weight), augmentation or a lower discriminator lr against it.
  3. Low D:G ratios collapse within each class. At σ = 80 the teacher outputs roughly the class mean, so the one-step student starts with almost no variation inside a class: the per-pixel std over noises is 0.065, against 0.477 for real CIFAR-10. With 4 D updates per student update it escapes within 5k iterations. At 1:1 with Adam β1 = 0.9 it never does, and the discriminator's loss stays near chance. Adam β1 = 0 on the discriminator removes the collapse.
  4. Early FIDs mostly measure the teacher. ema_9999 starts from the teacher weights and is updated every iteration, so at 5k iterations 0.9999^5000 ≈ 61% of it is still the teacher. FID before ~20k says little about a run.

We can share the logs, the per-checkpoint FID files, or the config as a PR if that would help.

leffff avatar Nov 10 '26 23:11 leffff

Thanks again for the great explorations! For future reference, here's the related PR: https://github.com/NVlabs/FastGen/pull/53

juliusberner avatar Nov 19 '26 01:11 juliusberner