Flow Matching

Resources

Main Idea

Flow matching is a technique in Generative Modeling relying on an iterated map in pseudo time ("flow time"). That is, beginning with z0∼p0(z0), where p0 is known, updates are computed as

zk+1=f(zk),k=0,…,K−1,

with the goal that pK(zK) matches some target distribution p∗(z).

To derive an explicit (but expensive) form of pK, begin by considering z0, z1, and their relation assuming f−1 exists:

z1=f(z0).

Through the Change of Variables formula, we can represent the relation between the likelihoods explicitly (although maybe expensively) as

p1(z1)=p0(z0)|det(∂∂z1f−1(z1))|.

Further assumption and simplification gives

p1(z1)=p0(z0)|det(∂f(z0)∂z0)|−1.

Repeating this until K and using the log-likelihood to replace multiplication with addition, we get

log⁡pK(zK)=log⁡p0(z0)−∑k=1Klog⁡|det(∂f(zk−1)∂zk−1)|.

From here, we can choose a simple p0, parameterize f, and maximize the log likelihood. We could substitute data samples as zK, compute the output (which iterates from data samples through f−1), and maximize the parameters of f. We could alternatively derive this by minimizing the KL-divergence between our final distribution pK and the data distribution p∗. There's an extra term that only depends on p∗, but that won't change the optimization procedure.

However, a number of questions still remain, shaping the differences between various approaches:

  1. How do we construct/parameterize f so that is invertible, and so that we know this inverse?
  2. How can we compute the Jacobian in an effective way?