GAS: Improving Discretization of Diffusion ODEs via Generalized Adversarial Solver
Aleksandr Oganov, Ilya Bykov, Eva Neudachina, Mishan Aliev, Alexander Tolmachev, Alexander Sidorov, Aleksandr Zuev, Andrey Okhotin, Denis Rakitin, Aibek Alanov
https://arxiv.org/abs/2510.17699
Abstract: While diffusion models achieve state-of-the-art generation quality, they still suffer from computationally expensive sampling. Recent works address this issue with gradient-based optimization methods that distill a few-step ODE diffusion solver from the full sampling process, reducing the number of function evaluations from dozens to just a few. However, these approaches often rely on intricate training techniques and do not explicitly focus on preserving fine-grained details. In this paper, we introduce the Generalized Solver (GS): a simple parameterization of the ODE sampler that does not require additional training tricks and improves quality over existing approaches. We further combine the original distillation loss with adversarial training, which mitigates artifacts and enhances detail fidelity. We call the resulting method the Generalized Adversarial Solver (GAS) and demonstrate its superior performance compared to existing solver training methods under similar resource constraints.
- Setup Environment
- Download Pretrained Models and FID Reference Sets
- Generating Teachers Data
- Calculating FID
- Training GAS
- Inference with trained GS
- Datasets
- Pre-trained models
- Citation
See requirements.yml for exact library dependencies. You can use the following commands with Miniconda3 to create and activate your Python environment:
conda env create -f requirements.yml -n gas
conda activate gasAll necessary data will be automatically downloaded by the script. Note that this process may take some time. If you wish to skip certain downloads, you can comment out the corresponding lines in the script.
bash scripts/downloads.shBefore training GS/GAS, we first need to generate teacher data. To get a batch of images using a teacher solver, run:
# Generate 64 images and save them as out/*.png
python generate.py --config=configs/edm/cifar10.yaml \
--outdir=out \
--seeds=00000-63 \
--batch=64Generating a large number of images can be time-consuming; the workload can be distributed across multiple GPUs by launching the above command using torchrun:
# Generate 50000 images using 2 GPUs
torchrun --standalone --nproc_per_node=2 generate.py \
--config=configs/edm/cifar10.yaml \
--outdir=data/teachers/cifar10 \
--seeds=00000-49999 \
--batch=1024You can use option --create_dataset=True for create subdirs with dataset's chunks. The script teachers.sh handles this process. If you wish to skip certain datasets, you can comment out the corresponding lines in the script.
bash scripts/teachers.shWe recommend using different seeds to generate teachers data and to evaluate student quality. For teachers, we use seeds 0-49999 for all datasets except MS-COCO, where we set the seeds to 0-29999.
To compute Fréchet inception distance (FID) for a given solver, first generate the required number of random images and then compare them against the dataset reference statistics using fid.py:
torchrun --standalone --nproc_per_node=1 fid.py calc \
--images=data/teachers/cifar10 \
--ref=fid-refs/edm/cifar10-32x32.npzIt is common to use 50k images to calculate FID in most setups, whereas the MS-COCO dataset is usually evaluated on 30k images.
The command can be parallelized across multiple GPUs by adjusting --nproc_per_node. The fid.py calc typically takes 1-3 minutes in practice. See python fid.py --help for the full list of options.
For instance, run scripts/teachers_fid.sh to compute FID scores across all teacher solvers.
bash scripts/teachers_fid.shAfter generating the teacher data, you can train GS/GAS using main.py. Below is an example of training GS on CIFAR-10 with four sampling steps:
python main.py --config=configs/edm/cifar10.yaml \
--loss_type=GS --student_step=4Below is an example of training GAS in the same setup:
python main.py --config=configs/edm/cifar10.yaml \
--loss_type=GAS --student_step=4The training settings can be controlled through command-line options; see python main.py --help for more information.
For training GAS, we recommend using the --train_size=5000 for all datasets except CIFAR10.
# FFHQ
python main.py --config=configs/edm/ffhq.yaml \
--loss_type=GAS --student_step=4 --train_size=5000
# AFHQv2
python main.py --config=configs/ldm/afhqv2.yaml \
--loss_type=GAS --student_step=4 --train_size=5000
# LSUN
python main.py --config=configs/ldm/lsun_beds256.yaml \
--loss_type=GAS --student_step=4 --train_size=5000
# ImageNet
python main.py --config=configs/ldm/cin256-v2.yaml \
--loss_type=GAS --student_step=4 --train_size=5000
# MS-COCO
python main.py --config=configs/sd/coco.yaml \
--loss_type=GAS --student_step=4 --train_size=5000
If you set the option --checkpoint_path=path, images are generated from the GS checkpoint; otherwise, they are generated from the teacher solver. See python generate.py --help for more information. Below is an example of generating images from a trained GS checkpoint on CIFAR-10 with four sampling steps:
# Generate 50000 images using 2 GPUs and a checkpoint from checkpoint_path
torchrun --standalone --nproc_per_node=2 generate.py \
--config=configs/edm/cifar10.yaml \
--outdir=data/teachers/cifar10 \
--seeds=50000-99999 \
--batch=1024 \
--steps=4 \
--checkpoint_path=checkpoint_pathFor a fair comparison and to avoid leakage of test seeds into the training dataset, we recommend using seeds 50000-99999 for all datasets except MS-COCO, which should use seeds 30000-59999.
The teacher data is available at Hugging Face Hub. We provide SD datasets with both 30,000 and 6,000 samples specifying the teacher NFE. A list of datasets and related links are provided below:
| Dataset | Hugging Face Hub |
|---|---|
| CIFAR-10 | 50k samples link |
| FFHQ | 50k samples link |
| AFHQv2 | 50k samples link |
| LSUN-Bedrooms | 50k samples link |
| ImageNet | 50k samples link |
| Stable diffusion | NFE=5: samples link; NFE=6: samples link; NFE=7: samples link; NFE=8: samples link; |
Pre-trained GS and GAS checkpoints are available at Hugging Face Hub. A list of datasets and related links are provided below:
| Dataset | Hugging Face Hub |
|---|---|
| CIFAR-10 | link |
| FFHQ | link |
| AFHQv2 | link |
| LSUN-Bedrooms | link |
| ImageNet | link |
| Stable diffusion | link |
@misc{oganov2025gasimprovingdiscretizationdiffusion,
title={GAS: Improving Discretization of Diffusion ODEs via Generalized Adversarial Solver},
author={Aleksandr Oganov and Ilya Bykov and Eva Neudachina and Mishan Aliev and Alexander Tolmachev and Alexander Sidorov and Aleksandr Zuev and Andrey Okhotin and Denis Rakitin and Aibek Alanov},
year={2025},
eprint={2510.17699},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2510.17699},
}If you are interested in collaborating, please reach out to us via 3145tttt@gmail.com.
