Official Implementation of Terminal Velocity Matching
Also check out our previous paper Inductive Moment Matching.
- Add model weights and model definitions.
- Add evaluation scripts.
- Add training scripts.
To install all packages in this codebase along with their dependencies, run
conda env create -f env.ymlFor multi-node jobs, we use Slurm via submitit, which can be installed via
pip install submititWe provide pretrained checkpoints through our repo on Hugging Face:
| ImageNet-256x256 | |||
|---|---|---|---|
| CFG | NFE | FID | Link |
| 2.0 | 1 | 3.29 | im256_w2.pkl |
| 1.75 | 4 | 1.99 | im256_w1p75.pkl |
| ImageNet-512x512 | |||
| 2.5 | 1 | 4.32 | im512_w2p5.pkl |
Datasets are stored as uncompressed ZIP archives containing uncompressed PNG or NPY files, along with a metadata file dataset.json for labels. When using latent diffusion, it is necessary to create two different versions of a given dataset: the original RGB version, used for evaluation, and a VAE-encoded latent version, used for training.
Please refer to IMM for dataset setups. ImageNet-512x512 follows similar procedures.
The default configs are in configs/. Before training, properly replace the logger and dataset.path fields to your own choice. You can train on a single node by
bash train.sh NUM_GPUS_PER_NODE CONFIG_NAME REPLACEMENT_ARGSIf you want to replace any config args, for example, network.do_scale_param on ImageNet-256x256 to false, you can run
bash train.sh 8 im256_w2.yaml network.do_scale_param=falseTo train multi-node, we use submitit and run
python launch.py --ngpus=NUM_GPUS_PER_NODE --nodes=NUM_NODES --config-name=CONFIG_NAMEAnd output folder will be created under ./outputs/
The eval scripts calculate FID scores. We provide the data reference stats at img256.pkl and img512.pkl.
bash eval.sh NUM_GPUS_PER_NODE CONFIG_NAME eval.resume=YOUR_MODEL_PKL_PATH network.compile=falseFor example, to evaluate on ImageNet-256x256 with your model saved at ./img256_w2.pkl with 8 GPUs on a single node, run
bash eval.sh 8 im256_w2.yaml eval.resume=./img256_w2.pklYOUR_MODEL_PKL_PATH can also be a directory containing all checkpoints of a run labeled with training iterations (i.e. your training directory). It will sort from the latest checkpoint to earliest and evaluate in that order.
@misc{zhou2025terminal,
title={Terminal Velocity Matching},
author={Linqi Zhou and Mathias Parger and Ayaan Haque and Jiaming Song},
year={2025},
eprint={2511.19797},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2511.19797},
}

