Implicit MLE: Backpropagating Through Discrete Exponential Family Distributions

Mathias Niepert, Pasquale Minervini, Luca Franceschi

Deep learning models excel at continuous tasks like image recognition and language generation. However, they notoriously struggle when a problem requires discrete reasoning or combinatorial logic—such as selecting the best $k$ words to explain a sentiment or finding the shortest path on a map.

To bridge this gap, researchers have introduced Implicit Maximum Likelihood Estimation (I-MLE), a novel framework that allows neural networks to seamlessly integrate and train through discrete and combinatorial components. By transforming gradient estimation into an implicit maximum likelihood problem, I-MLE enables end-to-end training without relying on the complex, problem-specific "smooth relaxations" that typically plague discrete optimization in deep learning.

The Challenge of Discrete Components in Deep Learning

The fundamental issue with embedding discrete logic into neural networks is the "gradient problem."

End-to-end learning pipeline with a discrete combinatorial component.

Discrete functions are typically piecewise constant. If you nudge their inputs slightly, their outputs often do not change at all, meaning their gradients are zero almost everywhere. When the output finally does jump to a new discrete state, the change is discontinuous. This mathematical reality makes standard backpropagation impossible.

Historically, researchers have bypassed this roadblock by creating "smooth relaxations" (such as the Gumbel-Softmax trick). While useful, these continuous approximations are often mathematically "leaky," difficult to scale to complex constraints, and require tailor-made engineering for every new problem domain.

The I-MLE Solution

Instead of attempting to differentiate directly through a discrete operation, I-MLE re-frames the task entirely. The framework operates in three main steps:

  1. The Forward Pass: The model produces a discrete output (a "MAP state") by solving a combinatorial problem or sampling from a discrete distribution using its current parameters.
  2. The Target Distribution: Based on the downstream loss incurred by that choice, I-MLE constructs a "target distribution." Think of this as a version of the current model that has been slightly nudged to produce a strictly better discrete output.
  3. The Backward Pass: Rather than calculating a standard gradient through the solver, I-MLE calculates the difference between the current model’s state and this new target state. It then uses this difference as a gradient proxy, pulling the model’s parameters toward the better target.

A major technical contribution of this work is the introduction of the Sum-of-Gamma (SoG) noise distribution. In "perturb-and-MAP" sampling, researchers usually add noise to parameters before picking the best discrete state. While standard Gumbel noise is the gold standard for global selections, it fails to capture local, element-wise perturbations accurately. The SoG noise family is specifically designed to make these local perturbations behave like global Gumbel noise, leading to vastly more stable and accurate gradient estimates.

Key Insights and Advantages

  • No Relaxations Required: Unlike previous methods, I-MLE doesn't need a "soft" version of the problem during training. You can use a "hard" black-box solver (like Dijkstra’s algorithm for routing) directly in the training loop.
  • Unification of Methods: I-MLE is not just a standalone trick; it serves as a generalization. It encompasses existing techniques like the Straight-Through Estimator (STE) and recent black-box combinatorial solvers, providing them with a firmer theoretical foundation.
  • The Importance of Noise Structure: The success of the Sum-of-Gamma noise highlights that how we perturb discrete systems is just as critical as the optimization algorithm itself. Proper noise allows the estimator to explore the discrete state space much more effectively.

Experimental Results

The authors evaluated I-MLE across several distinct domains, proving its versatility:

  • Learning to Explain (BeerAdvocate): Given a text review, the model had to select a subset of $k$ words that best predicted a sentiment score. I-MLE achieved significantly higher "subset precision" than popular relaxations like L2X, proving better at picking the actual words humans identified as important while maintaining competitive prediction accuracy.
  • Combinatorial Optimization (Warcraft II Maps): The model analyzed a terrain image to find the shortest (minimum cost) path from corner to corner. I-MLE (specifically using SoG noise) outperformed state-of-the-art methods like Black-Box Differentiation (BB) and Differentiable Perturbed Optimizers (DPO), finding the optimal path more consistently across various grid sizes.
  • Discrete Variational Auto-Encoders: When applied to VAEs, I-MLE with SoG noise resulted in lower test loss and more diverse generated samples compared to standard Gumbel-based approaches.

Limitations and Future Directions

The primary limitation of I-MLE is its reliance on an exact or highly accurate MAP solver. The framework needs to be able to find the "most probable" discrete state efficiently. If the underlying combinatorial problem is NP-hard and lacks a fast heuristic, I-MLE becomes computationally intractable.

Furthermore, while I-MLE eliminates the need for problem-specific relaxations, it introduces its own hyperparameters—namely, perturbation intensity and temperature—which require tuning. Future work will likely focus on developing adaptive strategies for these parameters and exploring settings where the downstream gradient is not easily accessible.

Summary updated

BibTeX
@inproceedings{niepert2021implicit,
  author = {Mathias Niepert and Pasquale Minervini and Luca Franceschi},
  title = {{Implicit MLE: Backpropagating Through Discrete Exponential Family Distributions}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=wyy0D4WGksP},
}
Figure