Chen 2018 - Continuous Normalizing Flows
Summary
In continuous time the change-of-variables formula needs only a trace, not a determinant: . This makes wide flow layers cost linear (not cubic) in hidden units, and the flow is automatically invertible by running the ODE backwards. Trained by maximum likelihood, CNFs match or beat discrete planar flows in the paper’s small experiments.
Overview
A discrete flow has (eq. 6), with determinant cost cubic in dimension or hidden units; the planar flow (Rezende & Mohamed 2015) is with (eq. 7). For the vault’s coverage of discrete flows see Normalizing Flows for Variational Inference.
Main Content
Theorem 1 (Instantaneous change of variables)
Let be a continuous random variable with density and , with uniformly Lipschitz in and continuous in . Then
Proof sketch (Appendix A). Write . Assumptions imply unique solutions (Picard) and bounded (z bounded), allowing exchange of limits. Then (L’Hopital), which at (, determinant 1) equals using and the derivative of at the identity being the trace.
Consequences:
- No bijectivity constraint on : uniqueness of the ODE solution makes the whole map bijective automatically.
- Linear cost in hidden units. Trace is linear, so if then (eq. 10): cost rather than .
- Continuous planar flow (eq. 9): , .
- Time dependence (hypernetwork-like) and a gating , ; the result is a continuous normalizing flow (CNF).
- Sampling and density together: solve the combined ODE for ; reverse-time solve costs about the same as forward, which standard NFs cannot do.
Experiments (Sec. 4.1)
- Density matching (minimizing with known target ): the CNF trained for 10,000 Adam iterations vs the NF for 500,000 RMSprop iterations. Fig. 4: NF capacity is set by depth ; CNF capacity can be raised by width ( vs ), is easier to train, and generally reaches lower loss.
- Maximum likelihood density estimation (Two Circles, Two Moons): maximize with via Theorem 1, then reverse the CNF to sample. CNF uses 64 hidden units; NF uses 64 stacked one-unit layers. The CNF learns smooth, interpretable transformations (e.g., rotating planar flows to spread particles into circles); the NF is unintuitive and struggles with Two Moons.
Examples
Exact check in 1-D. Take . Trace , so and : a Gaussian contracts to , whose log-density at the origin rises at rate .
import numpy as np
from scipy.integrate import solve_ivp
lam, s0, z_start = 0.8, 1.0, 0.5
def rhs(t, y): # y = [z, logp]
z, logp = y
return [-lam*z, +lam] # dz/dt = f, dlogp/dt = -tr(df/dz) = +lam
logp0 = -0.5*(z_start/s0)**2 - np.log(s0*np.sqrt(2*np.pi))
T = 1.3
z_T, logp_T = solve_ivp(rhs, [0, T], [z_start, logp0], rtol=1e-10, atol=1e-12).y[:, -1]
s_T = s0*np.exp(-lam*T)
print(logp_T, -0.5*(z_T/s_T)**2 - np.log(s_T*np.sqrt(2*np.pi))) # equalConnections
- CNFs are generative building blocks for variational posteriors and for neural conditional density estimators in simulation-based inference: Normalizing Flows as Conditional Density Estimators, Neural Posterior Estimation (NPE), Variational Inference - Overview.
- Trace estimation for high-dimensional (Hutchinson) came in follow-up work (FFJORD) and is not in this paper.
See Also
Chen 2018 - Neural ODEs - Overview, Chen 2018 - Latent ODE Time-Series Model.