NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning with Differentiable Perturbed Optimizers

Quentin Berthet, Mathieu Blondel, Olivier Teboul, Marco Cuturi, Jean-Philippe Vert, Francis BacharXiv 2020

Abstract

Machine learning pipelines often rely on optimization procedures to make discrete decisions (e.g., sorting, picking closest neighbors, or shortest paths). Although these discrete decisions are easily computed, they break the back-propagation of computational graphs. In order to expand the scope of learning problems that can be solved in an end-to-end fashion, we propose a systematic method to transform optimizers into operations that are differentiable and never locally constant. Our approach relies on stochastically perturbed optimizers, and can be used readily together with existing solvers. Their derivatives can be evaluated efficiently, and smoothness tuned via the chosen noise amplitude. We also show how this framework can be connected to a family of losses developed in structured prediction, and give theoretical guarantees for their use in learning tasks. We demonstrate experimentally the performance of our approach on various tasks.

The Challenge of Discrete Optimization in Deep Learning

Modern machine learning relies heavily on end-to-end differentiability. To train a model using gradient descent, every component in the pipeline must provide a useful gradient. However, many real-world tasks require discrete decisions—such as ranking items, picking the nearest neighbor, or calculating a shortest path in a graph.

The fundamental problem is that these discrete solvers are "piecewise constant." If the input $\theta$ changes slightly, the output usually stays exactly the same, resulting in a zero gradient. When the output finally does change, it jumps discontinuously, leading to an undefined gradient. This "staircase" behavior breaks backpropagation, making it impossible to train models that include these operations as intermediate steps using standard gradient-based methods.

Differentiable Perturbed Optimizers

To overcome this, the authors propose a framework called Perturbed Maximizers. Instead of using a discrete solver directly, the framework introduces a stochastic smoothing process:

  1. Add Noise: The input $\theta$ is perturbed with a random noise vector $\epsilon Z$, where $\epsilon$ is a temperature parameter.
  2. Solve: The original discrete solver is run on the noisy input.
  3. Smooth: The new differentiable output is defined as the expectation of the noisy solutions.
Geometric intuition of perturbed optimizers: adding noise to the input $\theta$ allows the expected solution $y^*_\epsilon(\theta)$ to move smoothly within the convex hull $\mathcal{C}$.

This method treats the discrete solver as a "black box," meaning it can be applied to any existing, highly-optimized combinatorial solver without needing to rewrite the underlying algorithm. The authors prove that these expected values are not only continuous but also differentiable. While calculating the exact expectation is often intractable, Monte-Carlo sampling (running the solver multiple times with different noise) provides an unbiased estimate of the gradient.

Theoretical Foundations

A key contribution of this work is the generalization of the well-known "Gumbel-Max trick." While Gumbel-softmax is widely used for categorical selections, this framework provides the mathematical foundation to apply similar logic to much more complex problems like shortest paths or the Traveling Salesman Problem.

Comparison between the classic Gumbel-max trick and the proposed general perturbed optimizer framework.

As shown in the comparison above, the framework moves beyond the unit simplex to general polytopes. Furthermore, the authors establish a deep connection between these perturbed optimizers and Fenchel-Young losses, a class of loss functions that are naturally convex and well-suited for structured prediction tasks.

Empirical Evaluation

The authors evaluated their method across three distinct domains:

  • Image Classification (CIFAR-10): Using a "perturbed max" (a differentiable version of argmax), the perturbed Fenchel-Young loss performed as well as standard cross-entropy, proving the framework's robustness.
  • Label Ranking: Across 21 benchmark datasets, the proposed method outperformed or matched baseline "blackbox" and squared loss methods in predicting the correct permutation of labels.
  • Warcraft Shortest Path: In a task requiring a model to predict the shortest path between corners of a Warcraft terrain map based only on visual features, the model successfully learned the underlying hidden costs. It achieved higher "perfect accuracy" (getting the exact path right) compared to previous state-of-the-art differentiable solver approximations.

Discussion and Future Work

While powerful, the method introduces computational overhead because the discrete solver must be run $M$ times for every forward and backward pass to obtain a reliable Monte-Carlo estimate. Additionally, the choice of the noise temperature $\epsilon$ is a critical hyperparameter; high noise provides smoother gradients but less accuracy relative to the original solver, while low noise maintains accuracy but makes optimization harder due to sharper gradients.

Future research directions include exploring more complex noise distributions beyond Gaussian or Gumbel and applying the framework to large-scale combinatorial problems within reinforcement learning environments.

Summary updated

BibTeX
@misc{berthet2020learning,
  author = {Quentin Berthet and Mathieu Blondel and Olivier Teboul and Marco Cuturi and Jean-Philippe Vert and Francis Bach},
  title = {{Learning with Differentiable Perturbed Optimizers}},
  year = {2020},
  eprint = {2002.08676},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2002.08676},
}
Figure