Generalization of the Change of Variables Formula with Applications to Residual Flows

Niklas Koenen, Marvin N. Wright, Peter Maass, Jens Behrmann

TL;DR

Normalizing flows traditionally require strict, everywhere-smooth diffeomorphisms to compute exact probability densities via the Change of Variables Formula (CVF). This paper introduces $\mathcal{L}$-diffeomorphisms, a rigorous measure-theoretic relaxation that permits transformations to be non-smooth or non-differentiable on Lebesgue-null sets. This generalization provides formal proof that non-smooth activations—such as ReLU and ELU—can be legitimately used in normalizing flows like planar, radial, and contractive residual flows.

What Problem Does This Paper Address?

Normalizing flows transform simple probability densities (e.g., standard Gaussians) into complex target distributions by applying an invertible map $f$. To calculate the target density, practitioners rely on the Change of Variables Formula (CVF), which depends on the determinant of the Jacobian:

$$p_f(x) = p_Z(f^{-1}(x)) \left|\det J_{f^{-1}}(x)\right|$$

In standard textbook calculus, this formula strictly demands that $f$ is a diffeomorphism—bijective, continuously differentiable everywhere, and with a nowhere-vanishing Jacobian determinant.

Because of this rigid definition, using non-smooth activations (such as ReLU, Leaky ReLU, or ELU) is mathematically questionable: they introduce points where the map is not differentiable, technically breaking standard CVF assumptions. While machine learning literature often uses almost-everywhere (a.e.) differentiable activations anyway, formal proofs that such models induce valid, well-defined probability densities were missing.

Methods

The authors formalize a relaxed class of transformations called Lebesgue-diffeomorphisms ($\mathcal{L}$-diffeomorphisms):

  • Definition of $\mathcal{L}$-Diffeomorphism: A map $f: Z \to X$ between open sets in $\mathbb{R}^n$ is an $\mathcal{L}$-diffeomorphism if there exist Lebesgue-null sets $N_Z$ (closed) and $N_X$ such that the restricted map $f: Z \setminus N_Z \to X \setminus N_X$ is bijective, continuously differentiable ($C^1$), and the set of critical points where $\det J_f(x) = 0$ is also a null set.
  • Measurability & CVF Proof: The authors prove that an $\mathcal{L}$-diffeomorphism is measurable with respect to trace Lebesgue $\sigma$-algebras and that the pushforward measure admits the exact standard CVF density almost everywhere via Radon-Nikodym's theorem and Sard's theorem.
  • Compositional Invariance: They prove that the composition of two $\mathcal{L}$-diffeomorphisms is itself an $\mathcal{L}$-diffeomorphism, ensuring that deep, multi-layer flows maintain these guarantees.
  • Application to Residual Architectures: The paper derives explicit parameter conditions that guarantee $\mathcal{L}$-diffeomorphism status for:
  • Planar Flows: $f_P(x) = x + u h(w^T x + b)$
  • Radial Flows: $f_R(x) = x + \beta h(\|x - x_0\|_2)(x - x_0)$
  • Contractive Residual Flows: $f_C(x) = x + g(x)$ where $\text{Lip}(g) < 1$.

Datasets

Not discussed in the paper. (This is a purely theoretical and mathematical contribution; no empirical benchmarks or datasets were evaluated.)

Key Insights and Ideas

  • Critical Points Must Be Null Sets: Bijectivity and $C^1$ smoothness alone are not enough when relaxed to open subsets. The authors use a counterexample based on the Smith-Volterra-Cantor set (a fat Cantor set of measure $1/2$) to show that a $C^1$, strictly increasing function can have critical points on a set of positive measure, causing its inverse to fail continuous differentiability on that set. Restricting critical points to a null set is therefore necessary.
  • Sard's Theorem Bridges the Gap: Because the critical set $C$ has measure zero, Sard's theorem guarantees its image $f(C)$ also has measure zero, allowing both base and target spaces to drop these problematic regions without altering integrals.
  • Exact Activation Thresholds for Planar Flows: Planar flows with non-smooth activations induce valid flows under clean, checkable parameter constraints:
  • ReLU: Valid if $w^T u > -1$.
  • ELU ($\alpha > 0$): Valid if $w^T u > \max(-1, -1/\alpha)$.
  • Tanh: Valid if $w^T u \ge -1$.
  • Softplus: Valid if $w^T u > -1$.
  • Free Pass for Contractive Flows: If a perturbation $g$ is contractive ($\text{Lip}(g) < 1$) and $C^1$ outside a closed null set $N$, $f(x) = x + g(x)$ automatically satisfies the conditions because Lipschitz maps preserve null sets and contractive perturbations cannot have critical points.

Key Results

  • Theoretical Validation: Established Theorem 4 (CVF holds for all $\mathcal{L}$-diffeomorphisms) and Lemma 5 (closure under function composition).
  • Concrete Flow Conditions: Proved that planar flows, radial flows, and contractive residual flows retain exact density models even when built with non-smooth activations (summarized for planar flows in Table 1).

Limitations and Future Work

  • Numerical Instability: While mathematically sound almost everywhere, the Jacobian or inverse mapping may fail to exist precisely on the excluded null sets. In floating-point implementations, evaluating near or at non-differentiable points can cause numerical issues or undefined gradients.
  • Lack of Empirical Exploration: The paper does not run benchmark experiments to show whether non-smooth activations (like ReLU) actually yield superior likelihoods, faster training, or improved expressiveness in practice compared to smooth counterparts like GELU or Swish.
  • Scope of Flow Families: The proofs focused on planar, radial, and basic contractive residual flows; the authors leave extensions to generalized planar flows (e.g., Sylvester flows) and continuous/autoregressive flows for future study.

Summary updated

BibTeX
@inproceedings{koenen2021generalization,
  author = {Niklas Koenen and Marvin N. Wright and Peter Maass and Jens Behrmann},
  title = {{Generalization of the Change of Variables Formula with Applications to Residual Flows}},
  booktitle = {INNF @ ICML},
  year = {2021},
  url = {https://openreview.net/forum?id=msCiI5dejr},
}
Figure