Efficient optimization of loops and limits with randomized telescoping sums

Alex Beatson, Ryan P. Adams

The Challenge of Nested Optimization

Many modern machine learning problems are "nested," requiring the evaluation of an expensive inner loop or limit to compute a single loss value. For example, in meta-learning, evaluating a hyperparameter requires training an entire model. In scientific computing, calculating a loss might require solving a differential equation with thousands of discrete steps.

When optimizing these functions, researchers typically face a "pick your poison" scenario:

  1. Full Unrolling: Computing every step of the loop. This provides an unbiased gradient but becomes computationally ruinous as the loop length ($H$) grows.
  2. Truncation: Stopping the loop early (e.g., Truncated Backpropagation Through Time). This is fast but introduces systematic bias—the optimizer "sees" a different objective than the true one, often leading to poor, sub-optimal solutions.

This paper introduces Randomized Telescope (RT) gradient estimators, a clever mathematical approach to bridge this gap, providing a gradient estimator that is both computationally efficient and mathematically unbiased.

The Randomized Telescope (RT) Approach

The core idea relies on representing the objective as a telescoping sum. If a loss function $L$ is the limit of a sequence of increasingly costly approximations $L_n$, it can be written as a sum of differences: $L = \Delta_1 + \Delta_2 + \Delta_3 + \dots$ where $\Delta_n = L_n - L_{n-1}$.

Instead of computing the entire sum (which is equivalent to full unrolling), the RT estimator samples a random stopping point $N$ from a distribution $q$ and weights the terms to ensure the resulting gradient estimate remains unbiased. The authors explore two main variants:

  • RT-SS (Single Sample): Importance samples a single difference $\Delta_N$.
  • RT-RR (Russian Roulette): Sums terms up to $N$, upweighting later terms (a technique dating back to von Neumann and Ulam).

Key Innovations: * Adaptive Tuning: The authors derive an online method to tune the sampling distribution $q$ to maximize the Relative Optimization Efficiency (ROE)—essentially, the expected decrease in loss per unit of computation spent. * Subsequence Selection: To further reduce overhead, they demonstrate how to skip certain intermediate steps in the telescoping sum (e.g., evaluating at steps 1, 2, 4, 8...) while maintaining unbiasedness.

Key Insights and Results

The authors evaluated their method across three distinct tasks: Lotka-Volterra ODE inference, meta-optimization of learning rates on MNIST, and training a high-dimensional LSTM on the enwik8 dataset.

  • Unbiasedness is a Superpower: Unlike truncation, which can lead an optimizer to a completely wrong local minimum, RT estimators eventually converge to the true solution because their "errors" are zero-centered noise rather than systematic drift.
  • RT-SS vs. RT-RR: A major insight is that while Russian Roulette (RT-RR) is famous in physics, the Single Sample (RT-SS) version is often superior for optimization. RT-SS is more robust when the differences between steps are highly correlated.

In practice, RT estimators demonstrated significant efficiency gains. For instance, in the ODE inference task, RT-SS achieved the speed of heavily truncated methods but reached the much lower loss of the full-horizon method.

Negative ELBO vs. Gradient evaluations for the ODE inference task. RT-SS and RT-RR converge significantly faster than the untruncated baseline.

Limitations and Future Work

While highly effective for many problems, the RT approach has limitations, particularly in high-dimensional settings.

  • High-Dimensionality: In the enwik8 LSTM experiment, the RT estimators provided early acceleration but eventually fell back to the performance of the un-truncated estimator. The authors suspect their assumption of "diagonal covariance" (treating different parameters as independent) is too simple for complex neural networks.
Training bits-per-character on the enwik8 LSTM task. While RT estimators provide early acceleration, they eventually fall back to the performance of the untruncated estimator.
  • Tuning Overhead: The process of tuning the estimator itself requires some computation. While mitigated with clever subsequence selection, it remains a factor.
  • Optimizer Compatibility: This work focused on SGD. Extending these unbiased estimators to work seamlessly with adaptive optimizers like Adam (which keep their own internal state) is a promising next step for future research.

Summary updated

BibTeX
@inproceedings{beatson2019efficient,
  author = {Alex Beatson and Ryan P. Adams},
  title = {{Efficient optimization of loops and limits with randomized telescoping sums}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
  url = {https://openreview.net/forum?id=Bk-P4oWuZS},
}
Figure