[Paper Review] Bridging Discrete and Backpropagation: Straight-Through and Beyond
This paper proposes ReinMax, a novel gradient estimation method for discrete latent variables that achieves second-order accuracy by integrating Heun's method, avoiding costly Hessian computations. It formally establishes Straight-Through (ST) as a first-order gradient approximation and demonstrates ReinMax's superior performance over state-of-the-art methods in multiple tasks with negligible computational overhead.
Backpropagation, the cornerstone of deep learning, is limited to computing gradients for continuous variables. This limitation poses challenges for problems involving discrete latent variables. To address this issue, we propose a novel approach to approximate the gradient of parameters involved in generating discrete latent variables. First, we examine the widely used Straight-Through (ST) heuristic and demonstrate that it works as a first-order approximation of the gradient. Guided by our findings, we propose ReinMax, which achieves second-order accuracy by integrating Heun's method, a second-order numerical method for solving ODEs. ReinMax does not require Hessian or other second-order derivatives, thus having negligible computation overheads. Extensive experimental results on various tasks demonstrate the superiority of ReinMax over the state of the art. Implementations are released at https://github.com/microsoft/ReinMax.
Motivation & Objective
- To formally analyze the Straight-Through (ST) heuristic as a gradient approximation method in the context of discrete latent variables.
- To address the lack of theoretical grounding and hyperparameter guidance in ST and its variants, which currently require trial-and-error tuning.
- To develop a new gradient estimation method that achieves higher-order accuracy without requiring Hessian or second-order derivatives.
- To demonstrate consistent performance gains across diverse tasks such as polynomial programming, variational autoencoders, and structured prediction.
- To provide theoretical insights that guide future design of gradient estimators for discrete or non-differentiable components in deep learning.
Proposed method
- ReinMax is derived by modeling the gradient estimation process as an ordinary differential equation (ODE) and applying Heun’s method, a second-order numerical integration scheme.
- The method uses a two-stage prediction: first compute a predicted gradient using the current parameter value, then refine it using a predicted intermediate state.
- It maintains computational efficiency by avoiding explicit Hessian computation, relying only on first-order gradients and model outputs.
- The approach integrates a differentiable sampling mechanism with a gradient correction step that uses the difference between predicted and actual gradients.
- ReinMax employs a baseline subtraction strategy using the expected loss $\mathbb{E}[f(\mathbf{D})]$ to reduce variance, improving stability.
- The method is implemented via a modified forward pass that combines one-hot sampling with a differentiable soft approximation, enabling end-to-end backpropagation through discrete variables.
Experimental results
Research questions
- RQ1How does the Straight-Through (ST) heuristic relate to formal gradient approximation methods?
- RQ2Can a second-order accurate gradient estimator be constructed without requiring Hessian matrices or second-order derivatives?
- RQ3What hyperparameter configurations (e.g., temperature) are optimal for ST and its variants, and can theory guide this choice?
- RQ4Does a higher-order gradient estimator like ReinMax consistently outperform first-order methods across diverse learning tasks involving discrete variables?
- RQ5How does the choice of baseline in gradient estimation affect convergence and performance in discrete latent variable models?
Key findings
- ReinMax achieves second-order accuracy in gradient approximation by integrating Heun’s method, matching the Taylor expansion of the true gradient up to the second order.
- The Straight-Through (ST) method is formally shown to be equivalent to the forward Euler method, a first-order numerical ODE solver, providing theoretical justification for its use.
- ReinMax outperforms all baselines, including REINFORCE-based methods and SOTA techniques like RODEO, across multiple benchmarks including MNIST, Fashion-MNIST, Omniglot, and polynomial programming tasks.
- On MNIST-VAE with a 2^48-dimensional latent space, ReinMax consistently achieves higher ELBO scores than RODEO and other baselines across all temperature settings.
- The method shows superior performance in challenging settings—smaller batch sizes, more latent variables, and complex objectives—where REINFORCE-style methods struggle due to high variance.
- ReinMax has negligible computational overhead, with time and memory consumption comparable to ST and other first-order methods, unlike variance-reduction baselines like GR-MCK that scale poorly with Monte Carlo samples.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.