Pathwise Derivatives for Multivariate Distributions

Martin Jankowiak, Theofanis Karaletsos

Abstract

We exploit the link between the transport equation and derivatives of expectations to construct efficient pathwise gradient estimators for multivariate distributions. We focus on two main threads: developing adaptive gradient estimators that minimize variance by learning "null solutions" to the transport equation, and providing the first efficient pathwise derivatives for complex multivariate mixture distributions.

Introduction

In machine learning, optimizing objectives defined as expectations—$\mathcal{L} = \mathbb{E}_{q_\theta(z)}[f(z)]$—is a fundamental task, particularly in Variational Inference (VI). Calculating the gradient $\nabla_\theta \mathcal{L}$ typically involves a trade-off: the Score Function Estimator (REINFORCE) is general but high-variance, while the Reparameterization Trick (RT) offers lower variance but is limited to specific distributions and may not be optimal.

This work introduces a framework based on the transport equation from fluid dynamics. By viewing probability distributions as moving "clouds of particles," we can derive velocity fields $\mathbf{v}^\theta$ that describe how samples shift as parameters $\theta$ change. This perspective allows for the creation of adaptive, low-variance gradients and extends pathwise methods to multivariate mixture distributions.

Adaptive Velocity Fields (AVF)

The transport equation is under-determined, meaning there are infinite velocity fields that can represent the same change in density. The authors exploit this by introducing "null solutions"—particle movements that do not alter the overall distribution. By parameterizing these solutions and learning them during optimization, the Adaptive Velocity Field (AVF) estimator can actively minimize gradient variance. These null solutions act as "free" control variates, canceling noise without introducing bias.

Gradients for Mixture Distributions

Pathwise gradients for mixture weights have historically been difficult to compute. This paper solves the transport equation for mixtures by defining velocity fields that move mass between components. For mixtures of multivariate Normals with diagonal covariances, the proposed estimator scales linearly with dimension $D$ ($O(DK^2)$), making it significantly more efficient than previous $O(D^2)$ or recursive approaches.

Variance ratio across dimensions for various estimators. The proposed methods maintain lower variance compared to Gumbel-Softmax (GSM) variants as dimensionality increases.

Experimental Results

The approach was validated on several benchmarks, including Gaussian Process (GP) regression on Mauna Loa CO2 data, hierarchical models for baseball data, and Deep Markov Models (DMM) for polyphonic music.

Performance and Convergence

In GP regression tasks, the AVF estimator demonstrated significantly faster convergence than the standard reparameterization trick. An AVF estimator with minimal parameters can reach the same ELBO performance in half the iterations required by the standard RT.

ELBO optimization performance. AVF (Adaptive Velocity Fields) achieves higher ELBO values faster than the standard reparameterization trick (RT) in both iteration count and wall-clock time.

Comparison with Gumbel-Softmax

On music datasets, the pathwise mixture estimator outperformed the Gumbel-Softmax trick. The authors observed that Gumbel-Softmax estimators exhibited 2–8 times higher variance for mixture logits, leading to better test ELBOs for the proposed pathwise method.

Conclusion

By framing gradient estimation as a fluid flow problem, this research provides a powerful toolkit for stochastic optimization. While implementing AVF adds some complexity and requires solving the transport equation for specific distributions, the gains in variance reduction and efficiency—especially for high-dimensional mixtures—are substantial. Future work may explore higher-order derivatives and deeper connections to Optimal Transport.

Summary updated

BibTeX
@inproceedings{jankowiak2019pathwise,
  author = {Martin Jankowiak and Theofanis Karaletsos},
  title = {{Pathwise Derivatives for Multivariate Distributions}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2019},
  url = {https://openreview.net/forum?id=Hve5YTmbO4},
}
Figure