Gradient Descent: The Ultimate Optimizer

Kartik Chandra, Erik Meijer, Samantha Andow, Emilio Arroyo-Fang, Irene Dea, Johann George, Melissa Grueter, Basil Hosmer, Steffi Stumpos, Alanna Tempest, Shannon YangarXiv 2019 · OpenReview

Abstract: Working with any gradient-based machine learning algorithm involves the tedious task of tuning the optimizer's hyperparameters, such as its step size. Recent work has shown how the step size can itself be optimized alongside the model parameters by manually deriving expressions for "hypergradients" ahead of time. We show how to automatically compute hypergradients with a simple and elegant modification to backpropagation. This allows us to easily apply the method to other optimizers and hyperparameters (e.g. momentum coefficients). We can even recursively apply the method to its own hyper-hyperparameters, and so on ad infinitum. As these towers of optimizers grow taller, they become less sensitive to the initial choice of hyperparameters. We present experiments validating this for MLPs, CNNs, and RNNs. Finally, we provide a simple PyTorch implementation of this algorithm.

Introduction

Training deep neural networks is notoriously sensitive to hyperparameters, particularly the learning rate ($\alpha$). If $\alpha$ is too small, training is agonizingly slow; if it is too large, the model fails to converge. Finding the "just right" value usually requires tedious manual tuning or expensive grid searches. While previous research suggested using "hypergradients"—the gradient of the loss with respect to the learning rate—to update $\alpha$ during training, these methods relied on manual mathematical derivations. This made them difficult to scale to complex optimizers like Adam or to "hyper-hyperparameters" (the learning rate for the learning rate), creating a "turtles all the way down" problem where every new optimizer level introduced a new parameter to tune.

Automated Hypergradients and Recursive Stacking

The authors propose a fully automated approach using Automatic Differentiation (AD). Instead of deriving formulas by hand, they use AD to compute derivatives for any hyperparameter. The key implementation trick is careful management of the computation graph: they "detach" the model weights at each step to keep memory usage constant, but keep the hyperparameters attached to allow gradient flow back through the optimization step.

This architecture naturally supports a "tower" of optimizers. Level 0 optimizes the model weights. Level 1 (the hyperoptimizer) optimizes Level 0's hyperparameters. Level 2 optimizes Level 1's hyperparameters, and so on. Because the method uses AD, it works "for free" on any differentiable hyperparameter, including momentum coefficients in Adam or decay terms in RMSProp.

Comparison of computation graphs for a single-level optimizer (left) and a two-level hyperoptimizer (right).

Experimental Evaluation

The authors evaluated their method across several standard benchmarks:

  • MNIST: Used for initial tests with Multi-Layer Perceptrons (MLPs).
  • CIFAR-10: Used to train ResNet-20 architectures for computer vision.
  • Tolstoy Dataset: A character-level language modeling task using Recurrent Neural Networks (RNNs).
  • Caltech-256: Used for fine-tuning a large, pre-trained ResNet-152 model.

Key Results and Insights

The experiments revealed several compelling properties of the hyperoptimizer:

  • Tower Robustness: As the stack of optimizers grows taller, the system becomes increasingly indifferent to the initial hyperparameter choice. A 3-level stack can achieve good results even if the base learning rate is off by several orders of magnitude.
  • Emergent Schedules: The hyperoptimizer naturally "discovers" effective learning rate schedules. For example, when training a ResNet, the hyperoptimizer automatically learned a decay schedule that closely matched the famous hand-engineered schedule used in the original ResNet paper.
  • Negligible Overhead: Because hyperoptimizers only perform a few extra scalar operations per step, each additional level in the stack only adds about 1–2% to the total runtime.
Training performance and emergent learning rate schedule for a ResNet-20 on CIFAR-10.

Conclusion

This work demonstrates that the optimization process itself can be effectively optimized using standard backpropagation techniques. While robust, the system can still diverge if initial hyperparameters are so high that the model explodes before the hyperoptimizer can correct them. Additionally, some "black box" modules in deep learning libraries are currently incompatible with this AD-based approach. Nonetheless, the ability to automatically tune optimizers with minimal overhead represents a significant step toward more robust and automated machine learning workflows.

Summary updated

BibTeX
@misc{chandra2019gradient,
  author = {Kartik Chandra and Erik Meijer and Samantha Andow and Emilio Arroyo-Fang and Irene Dea and Johann George and Melissa Grueter and Basil Hosmer and Steffi Stumpos and Alanna Tempest and Shannon Yang},
  title = {{Gradient Descent: The Ultimate Optimizer}},
  year = {2019},
  eprint = {1909.13371},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1909.13371},
}
Figure