By: Themis Haris
Date: June 2026
Flow matching [5] is truly a gem inside the modern theory of generative modeling. It is a simple, elegant and remarkably powerful algorithm that allows us to efficiently sample from highly complex distributions. These can be any distributions we like! Images, video, voice data, you name it. This is why these methods have found applications in so many domains and currently dominate the state-of-the-art.
The field did not suddenly stumble upon flow matching. The theory and understanding of generative modeling has evolved throughout the last 3 decades through a wide variety of perspectives. In fact, it is still evolving: flow matching is one way of doing things, and not necessarily the best way. Nonetheless, it is a vital tool that should exist in the arsenal of the modern computer scientist.
Plus, it’s quite easy to grasp and even easier to implement! So, without further ado, let’s learn all about it!
The tutorial in this page is long. I’ve tried to organize it in a bottom-up fashion, but it still relatively dense. One way to work through it is via 3 stages: (1) understanding the intuition behind flow matching, (2) going through the rigorous mathematical details, (3) learning about different model architectures. Good luck 🙂
Flow matching is an algorithm used in generative probabilistic modeling. The goal is to generate samples $z \sim p_{data}$ from an unknown distribution. Imagine this as generating pictures of dogs or sentences similar to Shakespearean works. There are numerous ways to achieve this, but we will examine the following viewpoint:
<aside> 💡
We will first sample a point $X_0$ from an initial distribution $p_{init}$ and then transform it grafdually into a point $X_1 \sim p_{data}$.
The transformation can be thought of as a trajectory through time $X_t : [0,1] \to \mathbb{R}^d$.
Our models will dictate how this trajectory evolves and how we can guarantee to reach the desired distribution in the end.
</aside>
How do we learn a set of trajectories that transform one distribution to another?
In modern deep learning whenever we are asked about how to learn something, we usually think in two steps:
We will first tackle the first step: representation
<aside>
Punchline: We represent a set of trajectories via a vector field that defines them through a differential equation. I will refer to this representation as the big assumption of diffusion-based modeling — we assume that the transformation we seek:
(1) exists, and (2) can be adequately expressed via a differential equation.
</aside>
Trajectories arise naturally as solutions to ordinary differential equations (ODEs). These equations specify precisely two things we need to fully define trajectories: