A few facts about Flow Matching
Fact-1: There are three different types of . (#)
Fact-2: The inference time ODE is curved. (#)
Fact-3: For real datasets, follows Softmax-weighting. (#)
Mathematically, the Flow Matching objective is not designed to generate novel samples; Practically, trained neural networks can generate novel samples.
Fact-4: and have the same marginal distribution. (#)
Fact-1: Three Different Types of
There are 3 different types of : the training sample , the conditional expectation , and the ODE endpoint . These three are generally not the same points.
| Type | Meaning |
|---|---|
| Training time sample, paired with . | |
| Inference time, conditional expectation / posterior mean. The ODE velocity (tangent) is determined by this. | |
| Inference time, the endpoint of the learnt ODE curve. |
Below we use a counterexample to show why these 3 are different.
Setup. Noise , clean data , , and interpolation:
A visual example. The plot below visually compares these three types of . The brown is paired with , their interpolation is . These are used for training. But the learnt velocity (tangent) at points at the pink . And even the tagent itself is changing along , where at ODE terminal the actual endpoint is the blue .

Below is a derivation of these three .
1. Marginal Distribution .
First let us check the marginal . Making use of the(my) probability tool, we treat as noise, and because of the Formula-4 below,

Then we use Formula-9,

more specifically,
- Let be , with and .
- Let be . Since , we have , , and .
Checking Formula-9’s Line-2, that , where , and . This leads to the marginal distribution of ,
(Note: we could also have used the stacked vector , but later finding the posterior would be annoying).
2. Conditional Expectation
Secondly, we find . By Line-3 in Formula-9:
Combining above two to find the mean, we get:
For convenience, we introduce the marginal variance , so equivalently:
3. ODE Endpoint
Thirdly, we find the ODE endpoint. To do so, we will follow the ODE using the learnt velocity. At training time, the velocity objective minimises , whose minimiser is .
By the definition of , where we again treat as the noise of ,
Thus:
Plugging in , we get a (seemingly complicated) velocity:
Solving the toy ODE. We need to solve ; the solution of this ODE at will give us the endpoint .
We use a (Chatgpt provided) trick by introducing , hence . After rearranging, the RHS becomes , and the LHS is . Cancelling on both sides yields:
From here, we move to the RHS and move to the LHS.
For the RHS, we further introduce , because , which is the numerator.
The RHS is thus , which leads to the following simplified ODE,
Taking the definite integral , we get:
Substituting the boundary values,
, , , and :
4. Final Comparison
If we rearrange by replacing , we get:
Comparing and , we see that they have different scaling factors ( vs. ) and are not the same, completing the proof of the counterexample.
Fact-2: The inference time ODE is curved.
This is obvious from the above example.
Fact-3: For real datasets, follows Softmax-weighting.
In Fact-1, we used a simplified clean data distribution to demonstrate how three types of are different. For real datasets, we do not have the nice Gaussian posterior property anymore (Formula-9), but we can still use Bayes’ theorem to derive .
Setup. now follows the real data distribution , while still. There are two cases to consider: the theoretical case where is continuous, and the empirical case where is discrete.
The theoretical continuous
We start by writing:
By Bayes’ theorem:
Next, we show that:
To see this, note that:
Note that is (integrating to ) only at , and is elsewhere when . So .
Introducing and (where is for the -dim Jacobian determinant), the integral becomes:
where follows , which gives the exp-square term.
Going back to , we have:
Let the normalised probability be .
Since:
we get . Hence, the cancels out:
where .
Therefore,
The real discrete
The above is also true for the discrete case. However, since a practical dataset has a finite number of samples and each sample is picked uniformly, and is elsewhere.
The normalising constant for the posterior is now a sum over the samples, and cancels out:
Again, for . Thus:
We can analyse this empirical across time :
- At : Since , the term is the same () for every sample , so points to the global average of across the dataset.
- At : The Softmax term , and at the particular sample that has the smallest (nearest) distance . So the velocity points to a single specific training sample .
- At : Here acts as the Softmax temperature evolving the smoothing radius along ; points to a local weighted average of nearby samples. As decreases, these weights shift continuously from the global mean local clusters a single sample, causing the ODE velocity to constantly change direction.
This concludes the fact of Softmax-weighting for the empirical case in real datasets. The above analysis also explains why the inference-time ODE trajectory is curved.
Q: Does the above mean Flow Matching cannot generate new samples unseen from the dataset? Mathematically, yes. As we see above, the exact empirical Softmax solution turns into a hard argmax as , which memorises the dataset. In practice, Flow Matching generates novel samples because the neural network learnt velocity fields do not exactly reproduce the optimal velocity field, and the corresponding ODE’s endpoint can deviate from the training samples.
Fact-4: and have the same marginal distribution
To prove this for general , we need to start from the Continuity Equation. Let me omit it here.
Equation (11) and (12) in this blog (https://mlg.eng.cam.ac.uk/blog/2024/01/20/flow-matching.html) provides a reference for this proof.
However, we can verify this directly on our Gaussian toy example from Fact-1.
Since , by Formula-4 the standardised term . Applying Formula-4 to our boxed equations for and from Fact-1:
- Marginal of :
- Marginal of :
The marginal-augmented table is:
| Type | Meaning | Marginal Distribution |
|---|---|---|
| Training time sample, paired with . | ||
| Inference time conditional expectation / posterior mean. | (Shrunk variance) | |
| Inference time endpoint of the learnt ODE curve. | (Same as ) |