Important
The current implementation of the package is a work in progress, expect things to break and change.
This package provides a Julia implementation of flow-based generative models, a unified mathematical framework that includes Normalizing Flows, Flow Matching, and Diffusion Models.
At their core, these models learn to transform noise into data through the simulation of differential equations. They are among the most successful approaches in modern generative AI, powering systems such as Stable Diffusion, Imagen, and AlphaFold.
Generative modeling can be understood as sampling from a data distribution
Mathematically, this transformation can for example be represented by an ordinary differential equation (ODE):
Here, the ODE is defined by a vector field
All three model families arise from the same principle of describing Flows through a vector field to transform a probability distribution over time:
| Model family | Equation type | Type | Description |
|---|---|---|---|
| Normalizing Flow | ODE | Simulation-based | Deterministic flow transforming noise into data with exact likelihoods through the change-of-variables formula. |
| Flow matching | ODE | Simulation-free | Learns a vector field to match the ground-truth “data flow” given a user-defined probability path |
| Diffusion | SDE | Simulation-free | Learns to reverse a noise process by gradually denoising samples given a user-defined variance schedule, turning random noise into structured data. |
Each approach can be seen as a different way of specifying and training the same underlying dynamical system that moves particles from simple noise toward complex data distributions.
Normalizing Flow models are often more computationally intensive to train since their learning objective requires simulation of the full ODE. In contrast, Flow Matching and Diffusion models can be trained using samples from the marginal distributions of the flow or diffusion process at arbitrary time points, without simulating the entire trajectory during training. These marginal distributions can be obtained through the definition of a probability path, which is a process that describes the gradual interpolation between noise and data.
While both approaches model the evolution of data through time, Flow Matching learns a deterministic transformation (an ODE) that smoothly transports noise into data, whereas Diffusion Models learn a stochastic process (an SDE) that reverses gradual noise corruption. As a result, diffusion models tend to be more robust and cover complex multimodal data better, while flow matching models offer faster, deterministic sampling and a clearer interpretation as a continuous transport map.