On the Gradient Formula for learning Generative Models with Regularized Optimal Transport Costs

Antoine Houdard, Arthur Leclaire, Nicolas Papadakis, Julien Rabin

Introduction

In the landscape of generative modeling, Wasserstein Generative Adversarial Networks (WGANs) have emerged as a powerful framework for learning complex data distributions. Central to the WGAN training process is the minimization of the Optimal Transport (OT) cost between a generated distribution and a target empirical distribution. To update the generator's parameters via backpropagation, practitioners rely on a specific gradient formula derived from the dual formulation of the OT problem. However, the mathematical validity of this formula—specifically the ability to differentiate "under the maximum"—is often assumed rather than proven. This paper provides the theoretical foundation for these gradients in both semi-discrete and entropy-regularized OT settings, bridging the gap between optimal transport theory and deep learning practice.

The Gradient Formula Challenge

To train a generator, we must calculate the gradient of the OT cost with respect to the generator's weights. In practice, this is typically done using a formula based on the Envelope Theorem (or Danskin’s Theorem), which assumes that the gradient of the maximum is equal to the gradient of the function evaluated at the optimal dual variables.

This assumption is non-trivial. In the semi-discrete case—where a continuous generated distribution is mapped to discrete data points—the OT cost may not be everywhere differentiable. The authors investigate the conditions under which this "gradient formula" is legally valid, particularly when dealing with non-smooth cost functions like the 1-Wasserstein distance.

Theoretical Framework and Innovations

Mathematical Validation

The authors establish rigorous proofs for the existence of the gradient formula under specific "x-regularity" conditions for the cost function and regularity hypotheses for the generator. They successfully extend this validation to $L^p$ costs ($p \ge 1$), which encompasses the widely used 1-Wasserstein and 2-Wasserstein distances.

The Geometry of Transport: Laguerre Diagrams

A key insight of the paper is the connection between the gradient of the WGAN loss and Laguerre diagrams. These are geometric partitions of space where each "cell" is associated with a specific target data point. The gradient formula's validity hinges on the "Laguerre Interface"—the boundaries between these cells. The authors demonstrate that for most neural network generators and continuous noise sources, the probability of the generated distribution putting mass exactly on these interfaces is zero. This finding provides the mathematical "green light" for using the standard gradient formula in general deep learning applications.

Regularization and the Smoothing Trade-off

To address the computational complexity of standard OT, practitioners often use entropic regularization ($\lambda$). This allows for faster computation via the Sinkhorn algorithm and creates a smoother optimization landscape. However, the paper highlights a critical trade-off: as the regularization parameter $\lambda$ increases, the generator is biased toward the "barycenter" (the average) of the dataset. This results in a "blurring" effect, where the model produces average representations rather than sharp, distinct samples.

Optimization Strategy

The authors propose a stochastic alternating optimization scheme to implement their findings:

  1. Inner Loop: Uses Averaged Stochastic Gradient Descent (ASGD) to find the optimal dual variables (solving the OT problem).
  2. Outer Step: Uses the ADAM optimizer to update the generator's weights based on the calculated gradient.

Experiments on synthetic 2D datasets and the MNIST handwritten digit dataset validate this approach. While unregularized OT ($\lambda = 0$) produces the sharpest images, it often suffers from jittery loss curves. Conversely, increasing $\lambda$ stabilizes the loss but quickly degrades image quality into unrecognizable blurry blobs.

Insights on Mode Collapse

The study suggests that "mode collapse"—a common failure mode where the generator produces limited varieties of outputs—is not solely a failure of the OT loss function itself. Instead, it is deeply intertwined with the choice of generator architecture and the specific hyperparameters of the optimization strategy. This suggests that solving mode collapse requires a holistic view of the training pipeline rather than just a change in the distance metric.

Conclusion and Future Work

This research provides a rigorous justification for the gradient formulas used in WGAN training, ensuring that the mathematical foundations of these models are as robust as their empirical performance. However, scalability remains a challenge; the semi-discrete approach currently requires visiting every data point to compute the $c$-transform, which is prohibitive for massive datasets like ImageNet.

Future research directions include:

  • Efficient Batching: Developing mini-batch strategies that avoid the significant estimation biases currently found in batch-wise OT.
  • Stability Control: Establishing better theoretical bounds for the errors introduced by early-stopping the inner optimization loop, ensuring global stability in the learning process.

Summary updated

BibTeX
@article{houdard2023gradient,
  author = {Antoine Houdard and Arthur Leclaire and Nicolas Papadakis and Julien Rabin},
  title = {{On the Gradient Formula for learning Generative Models with Regularized Optimal Transport Costs}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2023},
  url = {https://openreview.net/forum?id=GPqfpqH97r},
}
Figure