Chapter 6 Two Gradient Flows
This chapter and the next form the climax of the book. For one and the same function on the Gaussian family, we find its gradient flows with respect to two metrics and compare them. The contents are as follows.
-
•
We show that the gradient flow of with respect to the Wasserstein metric is exactly the time evolution of the law of the OU process (Section 6.1).
-
•
We find the gradient flow of with respect to the Fisher metric ; it is a geometric interpolation along an e-geodesic (Section 6.2).
-
•
We compare the orbits of the two flows and determine the initial values for which they coincide (Section 6.3).
-
•
We show that neither flow is a gradient flow for the other metric (Section 6.4).
We use the following.
- •
- •
- •
- •
- •
We do not treat the theory of gradient flows on the space of all probability distributions. In this chapter we only introduce it without proof in Remark 6.4. For this, see the paper of Jordan–Kinderlehrer–Otto [JKO98], Otto’s paper [OTT01] and Chapter 9.
In this chapter we regard as an open subset of . A tangent vector at a point is thus a pair . We write the differential of a function as . The gradient is the vector satisfying for every tangent vector (Definition 2.7). A gradient flow is a solution of , and we consider only times . For we use as coordinates, where .
6.1 The OU Process as a Wasserstein Gradient Flow
We first compute the differential of .
Lemma 6.1.
For and ,
| (6.1) |
Proof.
We first find the gradient flow for . In the coordinates the Wasserstein metric is (Example 5.12). Since this is the Euclidean metric, the gradient is just the vector of partial derivatives. From we get
Hence , and the gradient flow equations are
Rewritten in terms of , they give . These are the equations satisfied by the OU flow , (Definition 1.9). The same holds for general .
Theorem 6.2 (The OU process is a Wasserstein gradient flow).
Proof.
For tangent vectors , let be the symmetric matrix corresponding to them under Lemma 5.9. Since , we have . Taking transposes and using the symmetry of , and , and then the cyclicity of the trace, we get . Hence . Writing the metric of Definition 5.11 as an inner product, we therefore obtain
Put . Then , so is the symmetric matrix corresponding to the tangent vector . For any tangent vector , the formula above and Lemma 6.1 give
This means .
The gradient flow equations are therefore (6.2). They form a linear differential equation with constant coefficients, so the solution is uniquely determined by its initial value. The OU flow satisfies and . Moreover, for , is a convex combination of two positive definite matrices and so stays in . Hence the solution is the OU flow. The claim for is the computation preceding the theorem. ∎
The gradient flow of Theorem 6.2 also agrees with the OU process when viewed as a velocity field on . The density of the law of the OU process satisfies the Fokker–Planck equation (Proposition 1.10). When we have , so this equation can be written as
In other words, satisfies the continuity equation for the velocity field .
Proposition 6.3.
Let be the density of . The velocity field of the Fokker–Planck equation is
It equals the affine velocity field corresponding, under Proposition 5.10, to the tangent vector of the OU process.
Proof.
From we get . Hence . On the other hand, is symmetric and satisfies . By the uniqueness in Lemma 5.9, this is the corresponding to the tangent vector . Therefore . ∎
The matrix of Theorem 6.2 is the matrix of Proposition 6.3 with the sign changed. This reflects the fact that the flow moves against the gradient.
Remark 6.4 (Jordan–Kinderlehrer–Otto).
Theorem 6.2 is a statement about the finite-dimensional Gaussian family. It has an infinite-dimensional version: the Fokker–Planck equation can be regarded as the gradient flow of with respect to on (not proved in this book). For this, see Jordan–Kinderlehrer–Otto [JKO98] and Otto [OTT01]. From this point of view, Proposition 6.3 says the following. Starting from a Gaussian, the infinite-dimensional gradient flow stays in the Gaussian family, and its velocity field is exactly the velocity field of the gradient flow of Theorem 6.2.
6.2 The Gradient Flow for the Fisher Metric
We now find the gradient flow of the same , this time with respect to the Fisher metric . We first compute for . In the coordinates the Fisher metric is , with matrix (Proposition 3.10). Hence
and the gradient flow equations are
| (6.3) |
To solve them, it is convenient to use and . By (6.3),
Hence and . The natural parameter is (Example 4.2). So in the coordinate the flow moves along a straight line towards the natural parameter of . This holds for exponential families in general.
Theorem 6.5 (The Fisher–Rao gradient flow).
Let be an exponential family (Definition 4.1). Assume that the natural parameter space is open and convex and that the Fisher matrix is positive definite for each . Fix and put . If is given the Fisher metric , then . Therefore the gradient flow of starting from is
For the Gaussian family with , we have , and the gradient flow of with respect to is
| (6.4) |
The solution starting from is
| (6.5) |
For the flow is (6.3).
From now on we call this flow the Fisher–Rao gradient flow, or the FR flow for short. The flow of Theorem 6.2 is the OU flow of Chapter 1 (Definition 1.9).
Proof.
Setting in Proposition 4.13 gives
Differentiating in , we get
By Proposition 4.3, the matrix of in the coordinate is . Hence . The gradient flow equation is linear, so its solution is uniquely determined by the initial value and is . Since is convex, stays in for .
Next we treat the Gaussian family in the coordinates . Writing the quadratic form of Proposition 3.10 as an inner product, we have
Substituting and using Lemma 6.1, we get
Hence , and the gradient flow equations are (6.4). The right-hand side is polynomial in , so the solution is uniquely determined by the initial value.
The natural parameter of the Gaussian family is (Example 4.2), and that of is . Formula (6.5) is nothing but , in agreement with the general part of the theorem.
Corollary 6.6.
In the situation of Theorem 6.5, the orbit of the FR flow lies on the e-geodesic (Definition 4.15) joining and . Namely, with we have . Since the parameter is not proportional to , the FR flow does not traverse this e-geodesic with a parameter affine in . Equivalently,
In particular, for the Gaussian family . In this sense the FR flow is the geometric interpolation between and .
Proof.
The first part is a rewriting of . We prove the second part. With ,
The right-hand side is a constant multiple of , and hence of . ∎
Remark 6.7 (The FR flow on positive densities).
The geometric interpolation solves an equation of the same form on the set of all positive densities. Let , be positive probability densities on , and assume that is finite and that the differentiations under the integral sign below are allowed. Put . Since , we have
where does not depend on . From we get , so . Hence satisfies
This equation is the gradient flow of when the space of all positive densities is formally given the Fisher–Rao metric (not proved in this book). We do not develop this infinite-dimensional geometry and give only the direct computation above. The behaviour of the KL divergence along this gradient flow is studied in the paper of Domingo-Enrich and Pooladian [DP23].
Remark 6.8 (Natural gradient).
When minimising a function of a parameter , the update is called the natural gradient method, where is the Fisher information matrix. The FR flow is precisely its continuous-time version. Theorem 6.5 says that, for an exponential family and a KL divergence, the natural gradient flow is a straight line in the coordinate . For the natural gradient method, see Amari’s book [AMA16]. Its application to Gaussian variational inference is treated in Chapter 8, and other applications to learning in Chapter 9.
6.3 Comparing the Orbits
In this section we compare the two flows on for , and then move on to general . From now on, the orbit of a flow means its forward orbit . By Theorem 6.2 and Theorem 6.5, the closed-form expressions for are as follows. For the OU flow,
| (6.6) |
and for the FR flow,
| (6.7) |
In both flows moves strictly monotonically from towards , and if . Figure 6.1 shows the orbits of the two flows from several initial points.
Eliminating from (6.6) and (6.7) reveals the shape of the orbits. When , the orbit of the OU flow lies on the curve
| (6.8) |
For the FR flow, the ratio of to is constant, so the orbit lies on the curve
| (6.9) |
We compare these with the geodesics of each metric.
Proposition 6.9.
Let and take an initial point .
-
1.
The orbit of the OU flow is contained in a single straight line if and only if or . In that case the orbit is contained in the image of a geodesic of , but the flow does not move along it at constant speed.
-
2.
The orbit of the FR flow is contained in the image of a geodesic of if and only if . In that case the flow does not move along it at constant speed. In particular, when and , the orbit of the FR flow lies on the horizontal line , but this line is not contained in the image of any geodesic of .
Proof.
(1) In the coordinates , has the Euclidean metric (Example 5.12). Its Christoffel symbols vanish, so the geodesic equation is (Definition 2.13, Definition 2.14). Hence the geodesics are the curves moving along straight lines at constant speed. If the orbit lies on the line , and if it lies on the line . Conversely, suppose and . Since is strictly monotone, (6.8) shows that the orbit is the graph of the function with , where ranges over the interval between and . The second derivative of this function is , so the graph is not contained in any straight line.
We examine the speed. When the speed is , which is not constant. When and the speed is . The function has derivative and vanishes at . Since approaches strictly monotonically, the speed is strictly decreasing and hence not constant.
(2) By Theorem 3.12 (2), every non-constant geodesic of can be written as , where is one of the curves , of that theorem and , are constants. In particular its image is contained in a vertical line or a half-ellipse .
If , the orbit of the FR flow lies on the vertical line and is contained in the image of a geodesic. Conversely, suppose . By the first equation of (6.7), never vanishes. If , then and . If , then is strictly monotone, so by (6.9) is also strictly monotone. In either case, along the orbit ranges over an interval and is given by a polynomial of degree at most one in : namely if , and if . Since varies, the orbit is not contained in a vertical line. Suppose the orbit were contained in a half-ellipse . Then also on . Two polynomials that agree on the interval are equal as polynomials. But their coefficients of are and , a contradiction.
We examine the speed. When and , the speed with respect to is . Since approaches strictly monotonically, the speed is strictly decreasing and hence not constant. ∎
Next we investigate when the orbits of the two flows coincide. For this we first check that coinciding orbits force the velocity fields to be parallel.
Lemma 6.10.
Let be open, a function, and continuous vector fields on . Let be solutions of with . Assume that for all . If , then for each there is with .
Proof.
Put . Since is with , it is a bijection onto the interval , and its inverse is also . In particular is injective. For , lies in the image of , so there is with . Since is injective, is unique. Composing both sides with gives , so . Hence is and . Differentiating , we obtain
Finally, we show that is surjective. For , lies in the image of , so there is with . Since is injective, . Thus for each we may take . ∎
The OU flow and the FR flow are gradient flows of , so by Proposition 2.10. Both and vanish only at . Since is a stationary point of both flows, uniqueness of solutions implies that a solution starting elsewhere never reaches . Hence, if , the solutions of the two flows satisfy the hypotheses of Lemma 6.10 with .
Theorem 6.11 (When the orbits coincide).
We compare the forward orbits of the OU flow and the FR flow starting from .
-
1.
For , the two orbits coincide as sets if and only if or . When they coincide even as parametrised curves: and . When and , both move along the line from towards , but at different speeds. Indeed, for the OU flow and for the FR flow.
-
2.
For general , the two orbits coincide as sets if and only if one of the following holds.
-
(a)
. In this case they coincide even as parametrised curves: and .
-
(b)
, and has at most one distinct eigenvalue different from . That is, for some and some orthogonal projection . In this case the two orbits coincide as sets, but if and the parametrisations differ.
-
(a)
For example, for , and , there are two distinct eigenvalues different from , so the orbits do not coincide (Problem 3 at the end of this chapter).
Proof.
We prove (1). The velocity fields of the two flows are
(Theorem 6.2, Theorem 6.5). The determinant of the matrix with these as columns is
If and , this is nonzero at the initial point, so the two velocity fields are not parallel there. By Lemma 6.10, the two orbits do not coincide.
We prove the converse. When , (6.6) and (6.7) show that both flows have and . When , both flows have . If moreover , then moves continuously and strictly monotonically, by for the OU flow and by for the FR flow, and converges to as . Hence both orbits are , where is the interval between and that contains but not . ∎
Proof.
We prove (2). We first prove sufficiency. (a) When , the OU flow is , . By (6.5), the FR flow is , .
(b) Suppose and . If or this reduces to (a), so assume and . Both flows have . Since , we have for . Hence has the form for both flows, with
In both, moves continuously and strictly monotonically from towards and converges to . So both orbits are , where is the interval between and that contains but not . As , converges to for the OU flow and to for the FR flow. Hence the parametrisations differ.
Next we prove necessity. Suppose the two orbits coincide. Since is covered by (a), we may assume . The velocity fields are and . By Lemma 6.10, at each point of the OU flow there is with
| (6.10) |
The second equation can be written as . We use it at . Each eigenvalue of satisfies , so . Hence, letting be the orthogonal projection onto the eigenspace of for the eigenvalue , we have . If , this is (b) with .
Suppose . By the first equation of (6.10), is an eigenvalue of with eigenvector . Since , we get , so and . If , this is (a). Assume ; we derive a contradiction. Take . The point of the OU flow is then , . Since , the first equation of (6.10) at this point gives . Then the difference of the two sides of the second equation is
a contradiction. ∎
6.4 Neither Is a Gradient Flow for the Other
The OU flow is the gradient flow of with respect to , and the FR flow is the gradient flow of with respect to . Could the velocity field of the OU flow nevertheless be the velocity field of the gradient flow of some other function with respect to ? For we show that this fails on every open set.
Theorem 6.12.
Let and let be a nonempty open set.
-
1.
There is no function on such that the velocity field of the OU flow equals on .
-
2.
There is no function on such that the velocity field of the FR flow equals on .
Proof.
(1) Let be the matrix of . If , then , that is,
Since is , , that is, holds on . But and . A nonempty open set contains a point with , so this is a contradiction.
(2) In the coordinates , is the Euclidean metric, so means
Since and , we get a contradiction as in (1). ∎
The difference in the proof is in (1) and in (2). Both vanish exactly on the line .
Remark 6.13.
Theorem 6.12 is a statement about velocity fields, not about orbits. For example, , obtained by multiplying by the positive function , is the velocity field of a gradient flow with respect to on all of (Problem 5 at the end of this chapter). The solutions of are time changes of the solutions of , so they have the same orbits as the FR flow. Therefore one cannot conclude “not a gradient flow” from the shape of the orbits alone.
Problems
-
1.
Hint: Show and for and , and differentiate and .
-
2.
Let and . Find the gradient flow of with respect to starting from .
Hint: Take in Theorem 6.5.
-
3.
Let , and . Show, without using Theorem 6.11, that the orbits of the OU flow and the FR flow do not coincide.
Hint: If are the diagonal entries of , then is constant for the OU flow and is constant for the FR flow. Check whether the latter is constant along the OU flow.
-
4.
For the FR flow on the Gaussian family, verify directly, by comparing the exponents of the densities, that (6.5) agrees with .
Hint: Compare the quadratic and linear terms in of with .
-
5.
For , find a function on with . Why does this not contradict Theorem 6.12?
Hint: Try . The theorem is a statement about the velocity field itself.