File size: 4,631 Bytes
1a7ec8c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | ---
license: other
library_name: pytorch
tags:
- generative-modeling
- flow-matching
- diffusion
- score-matching
- langevin-dynamics
- time-series
- molecular-dynamics
---
# Implicit Dynamical Flow Fusion (IDFF) for Generative Modeling
**Mohammad R. Rezaei, Milos R. Popovic, Milad Lankarany, Rahul G. Krishnan**
*Transactions on Machine Learning Research (TMLR), 2026*
[Paper (PDF)](paper/IDFF_TMLR_2026.pdf) 路
[OpenReview](https://openreview.net/forum?id=RWnohJJKbq) 路
[arXiv](https://arxiv.org/abs/2409.14599) 路
[Code (GitHub)](https://github.com/MrRezaeiUofT/Implicit_Dynamical_Flow_Fusion_for_Genereative_Modeling) 路
[Code (Hugging Face mirror)](https://huggingface.co/rezapop/IDFF-code)
This repository holds the paper and the trained checkpoints of the 2-D and time-series examples. The
code is in [rezapop/IDFF-code](https://huggingface.co/rezapop/IDFF-code) and on GitHub (release `v1.0.0`).
## Abstract
Conditional Flow Matching (CFM) generates high-quality samples by learning a deterministic transport from
noise to data, but typically requires more than a hundred network function evaluations (NFEs) per sample.
IDFF augments the CFM vector field with $K$th-order score-derivative terms and attains comparable sample
quality with significantly fewer NFEs. At first order ($K=1$) the method reduces to a Langevin-augmented
flow whose marginal $p_t$ is preserved exactly in continuous time, so the NFE reduction is a statement about
discretization robustness. For $K=2$ the paper gives an error analysis showing that the deviation of the
optional curvature correction is bounded by the weighted score-matching loss already minimized by the
objective. Every higher-order marginal derivative is obtained from the learned first-order score by
automatic differentiation, so no additional networks are trained. On CIFAR-10 the $K=1$ configuration
reaches an FID of 2.78 at 10 NFEs; IDFF also performs strongly on molecular-dynamics simulation and
sea-surface-temperature forecasting.
## Examples
<p align="center">
<img src="assets/idff_2d.gif" alt="CFM vs IDFF K=1 and K=2 sampling at NFE=5 on 8 Gaussians" width="90%"/>
</p>
<p align="center"><em>8 Gaussians with 5 network evaluations, same noise and same trained network:
deterministic CFM (blue), IDFF K=1 (red) and IDFF K=2 (purple).</em></p>
<p align="center">
<img src="assets/idff_lorenz.gif" alt="CFM, IDFF K=1 and IDFF K=2 rollouts on the Lorenz attractor" width="95%"/>
</p>
<p align="center"><em>Autoregressive rollouts over a 2000-step held-out Lorenz trajectory at 5 NFE per frame
against the simulated trajectory (grey).</em></p>
## Files
| path | contents |
|---|---|
| `paper/IDFF_TMLR_2026.pdf` | camera-ready paper |
| `checkpoints/2d/{8gaussians,checkerboard,moons}/idff_model.pt` | 2-D joint-head MLPs (`hidden=256, depth=3, sigma0=0.2`) |
| `checkpoints/lorenz/idff_model.pt` | Lorenz model (`hidden=128, depth=2, sigma0=0.05`, 2000 positions) |
| `checkpoints/polyALA/idff_md.pt` | polyALA molecular-dynamics surrogate (46 dihedral angles, 200 positions) |
| `checkpoints/*/config.json` | training arguments and the sampler settings selected on validation data |
| `assets/*.gif` | the animations above |
The checkpoints are PyTorch `state_dict`s for `idff.JointHeadMLP`; load them with `weights_only=True`.
## Usage
```bash
git clone https://huggingface.co/rezapop/IDFF-code && cd IDFF-code
pip install -r requirements.txt
```
```python
import json, torch
from huggingface_hub import hf_hub_download
from idff import JointHeadMLP, sample
repo = "rezapop/IDFF"
cfg = json.load(open(hf_hub_download(repo, "checkpoints/2d/8gaussians/config.json")))
model = JointHeadMLP(2, hidden=256, depth=3, sigma0=cfg["sigma0"])
model.load_state_dict(torch.load(hf_hub_download(repo, "checkpoints/2d/8gaussians/idff_model.pt"),
map_location="cpu", weights_only=True))
model.eval()
nfe = 5
s = cfg["selected"][str(nfe)] # gamma_bar and alpha_2 chosen on validation data
x_k1 = sample(model, torch.randn(2000, 2), nfe, K=1, gamma_bar=s["gamma_bar"])
x_k2 = sample(model, torch.randn(2000, 2), nfe, K=2, gamma_bar=s["gamma_bar"], alphas={2: s["alpha_2"]})
x_cfm = sample(model, torch.randn(2000, 2), nfe, K=0) # deterministic CFM baseline
```
## Citation
```bibtex
@article{rezaei2026idff,
title = {Implicit Dynamical Flow Fusion ({IDFF}) for Generative Modeling},
author = {Rezaei, Mohammad R. and Popovic, Milos R. and Lankarany, Milad and Krishnan, Rahul G.},
journal = {Transactions on Machine Learning Research},
year = {2026},
url = {https://openreview.net/forum?id=RWnohJJKbq}
}
```
|