Adaptive Perturbation-Based Gradient Estimation for Discrete Latent Variable Models

Pasquale Minervini, Luca Franceschi, Mathias Niepert

Introduction

Modern deep learning architectures increasingly incorporate discrete decision-making components, such as feature selection, shortest-path finding, or categorical sampling. However, these discrete operations are non-differentiable, posing a significant challenge for standard backpropagation. While continuous relaxations (e.g., Gumbel-Softmax) and Implicit Maximum Likelihood Estimation (IMLE) offer workarounds, they often suffer from high variance, task-specific hyperparameter tuning, or poor scalability to complex combinatorial problems.

The Challenge of Discrete Latents

Existing solutions typically fall into two categories. Continuous relaxations replace discrete choices with "fuzzy" approximations, which can be mathematically cumbersome for complex constraints like spanning trees. Alternatively, IMLE uses perturbations and finite differences to estimate gradients. However, IMLE's performance is highly sensitive to a hyperparameter ($\lambda$) that controls perturbation strength. A small $\lambda$ leads to sparse, zeroed-out gradients (low signal), while a large $\lambda$ introduces significant bias (low accuracy). Finding the optimal balance manually is difficult and varies by task.

The AIMLE Approach

To address these limitations, the authors propose Adaptive IMLE (AIMLE). This method automates the gradient estimation process through three key innovations:

  1. Adaptive Step Size: AIMLE dynamically adjusts $\lambda$ by tracking gradient sparsity using an exponential moving average, ensuring a consistent "gradient density" throughout training.
  2. Perturbation Normalization: By scaling perturbations relative to parameter norms, AIMLE maintains stability across different network architectures.
  3. Centred Finite Difference: Moving beyond the one-sided "forward" difference used in standard IMLE, AIMLE employs a two-sided "centred" difference. This provides a second-order approximation, significantly improving gradient accuracy.
Comparison of forward, backward, and central finite difference approximations for smooth and discrete functions.

Experimental Evaluation

AIMLE was evaluated across diverse domains, including synthetic distributions, text explanation tasks (BeerAdvocate), discrete Variational Auto-Encoders (VAEs), and latent graph recovery in Neural Relational Inference (NRI).

Key Results and Sample Efficiency

A standout finding is AIMLE's extreme sample efficiency. As shown in the comparative analysis, AIMLE produces more faithful gradient estimates with $10^3$ samples than the Score Function Estimator (SFE) can achieve with $10^5$ samples—a 100x improvement.

Gradient estimation accuracy (cosine similarity) as a function of the number of samples across different methods.

In practical tasks:

  • BeerAdvocate: AIMLE achieved a subset precision of 62.06% ($k=5$), outperforming standard IMLE's 50.89%.
  • VAEs: AIMLE demonstrated faster convergence and lower test loss than Gumbel-Softmax and STE.
  • NRI: The method successfully backpropagated through Kruskal’s algorithm for spanning tree recovery, yielding the lowest test ELBO.

Conclusion

AIMLE effectively navigates the sparsity-bias trade-off inherent in discrete gradient estimation. By making the perturbation process adaptive and utilizing higher-order finite differences, it provides a robust, relaxation-free alternative for training models with complex discrete latent variables. While it requires a brief initial warm-up period to calibrate $\lambda$, its superior accuracy and sample efficiency make it a powerful tool for modern combinatorial deep learning.

Summary updated

BibTeX
@inproceedings{minervini2023adaptive,
  author = {Pasquale Minervini and Luca Franceschi and Mathias Niepert},
  title = {{Adaptive Perturbation-Based Gradient Estimation for Discrete Latent Variable Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i8.26103},
}
Figure