Official implementation of LEAP: Accelerating ODE-based Diffusion Sampling with Optimal Linear Leaps.
ACM Multimedia 2026 · Paper · Citation
LEAP accelerates diffusion sampling by alternating learned linear predictions with model evaluations. This repository supports SD3.5-Medium, FLUX.1-dev and TRELLIS.2, with calibration, generation and evaluation tools.
conda env create -f environment.yml
conda activate LEAP
python -m pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cu124
python -m pip install -r requirements.txtThe environment uses Python 3.11, PyTorch 2.5.1 and Diffusers 0.35.1. See installation for model access, evaluation dependencies and cache setup.
| Model | Experiment config | 512-resolution smoke config |
|---|---|---|
| SD3.5-Medium | configs/sd35.yaml |
configs/smoke.yaml |
| FLUX.1-dev | configs/flux.yaml |
configs/flux-smoke.yaml |
Use --model-path /path/to/snapshot --local-files-only to load local weights, or --offload to reduce GPU memory use.
Generate four images with the included SD3.5 / Euler / NFE 10 coefficient bank. Run all commands from the repository root:
leap generate --config configs/sd35.yaml \
--prompts benchmarks/prompts/drawbench.json --count 4 --seed 10000 \
--nfe 10 --method leap --bank coefficients/sd35-euler-nfe10.json \
--output outputs/sd35-demoEach run saves images and a run.json containing prompts, seeds, model settings, measured NFE and timing.
Calibrate on 32 reference trajectories, then generate paired baseline and LEAP images for 200 DrawBench prompts:
leap benchmark --config configs/sd35.yaml \
--prompts benchmarks/prompts/drawbench.json --count 200 \
--nfes 10 15 20 --solvers euler dpmpp \
--reference-count 32 --reference-seed 0 --seed 10000 \
--output outputs/sd35-drawbenchEach solver and NFE budget gets its own coefficient bank. Supported solvers are euler, dpmpp, unipc and ipndm. For FLUX, use configs/flux.yaml and a separate output directory; see the FLUX guide. For a quick smoke test, use the corresponding smoke config with --count 2 --reference-count 2 --nfes 10 --solvers euler.
After installing the evaluation dependencies, score every run with HPSv2.1, ImageReward and CLIP:
for solver in euler dpmpp; do
for nfe in 10 15 20; do
for method in baseline leap; do
run="outputs/sd35-drawbench/${solver}-nfe${nfe}/${method}"
leap score --run "$run" --output "${run}-scores.json"
done
done
doneUse a new output directory for each experiment. The benchmark guide covers individual runs, generation shards and metric settings.
leap calibrate --config configs/sd35.yaml \
--prompts benchmarks/prompts/drawbench.json --count 32 --seed 0 \
--nfe 10 --output outputs/sd35-euler-nfe10/bank.jsonPass the resulting file to leap generate --bank. Calibration and generation must use the same model, solver, NFE and configuration. With the default window of 5, NFE 10 produces 15 solver steps; leap plan --nfe 10 displays the prediction/correction schedule.