A Generalizable Approach to Learning Optimizers

Diogo Almeida, Clemens Winter, Jie Tang, Wojciech Zaremba · DOI

Abstract

A core issue with learning to optimize neural networks has been the lack of generalization to real world problems. To address this, we describe a system designed from a generalization-first perspective, learning to update optimizer hyperparameters instead of model parameters directly using novel features, actions, and a reward function. This system outperforms Adam at all neural network tasks including on modalities not seen during training. We achieve 2x speedups on ImageNet, and a 2.5x speedup on a language modeling task using over 5 orders of magnitude more compute than the training tasks.

Introduction

Deep learning success is heavily dependent on the choice of optimization algorithms like Adam or SGD. However, these optimizers require manual tuning of hyperparameters—such as learning rate schedules and weight decay—which can be both time-consuming and computationally expensive. While "Learning to Optimize" (L2O) methods aim to automate this process by training a neural network to act as the optimizer, they have historically suffered from a significant generalization gap. An optimizer trained on a simple task, like MNIST, typically fails when applied to complex architectures like ResNets or Transformers. This paper introduces LHOPT (Learned Hyperparameter Optimizer), a system designed to bridge this gap by focusing on high-level hyperparameter control rather than low-level parameter updates.

The LHOPT Framework

LHOPT shifts the focus from learning specific parameter updates to learning dynamic hyperparameter adjustments. The system employs a hierarchical structure consisting of an "outer" LSTM controller and an "inner" training loop.

The LHOPT architecture: an outer LSTM controller observes unitless features from the inner training loop and outputs hyperparameter multipliers.

To ensure generalization across different scales and loss values, the researchers implemented several key design choices:

  • Unitless Features: Instead of raw loss values, the controller receives "unitless" inputs, such as log-ratios of training vs. validation loss and cosine similarities between gradients and momentum. This allows the optimizer to behave consistently regardless of the specific loss magnitude.
  • Relative Actions: The controller does not set absolute hyperparameter values. Instead, it outputs multipliers (e.g., "increase learning rate by 10%") to adjust the state of an underlying optimizer (a variant of the LAMB/Adamax family).
  • Decoupled Execution: The LSTM controller runs only periodically (every few hundred inner steps), which significantly reduces computational overhead and allows the logic to scale to much larger tasks than those seen during training.

Generalization and Scaling Results

LHOPT was trained on a diverse set of "tiny" tasks, including MLPs and small RNNs. Despite this modest training data, it demonstrated remarkable zero-shot generalization to large-scale real-world problems. On ImageNet, LHOPT achieved a 2x speedup over a well-tuned AdamW baseline, reaching target accuracy in half the steps. In language modeling, it provided a 2.5x speedup for a 760M parameter GPT-2 Large model.

LHOPT demonstrates consistent compute savings across multiple orders of magnitude, achieving up to 2.7x speedups over baseline schedules.

Crucially, the performance of LHOPT appears to follow scaling laws; the speedup relative to baselines actually increases as the model size and compute budget grow. The system also outperformed tuned baselines on modalities it never encountered during training, such as speech recognition (Deep Speech 2) and recommendation systems (Neural Collaborative Filtering).

Discussion and Future Work

While LHOPT represents a major advancement in L2O, some limitations remain. The current implementation requires knowing the total number of training steps in advance to calculate its "progress" feature, making it less suitable for open-ended training. Additionally, while the overhead is lower than previous methods, it still adds between 2% and 20% to training time depending on the architecture. Future research may explore applying LHOPT to more unstable optimization landscapes, such as those found in Generative Adversarial Networks (GANs) or Reinforcement Learning.

Summary updated

BibTeX
@misc{almeida2021generalizable,
  author = {Diogo Almeida and Clemens Winter and Jie Tang and Wojciech Zaremba},
  title = {{A Generalizable Approach to Learning Optimizers}},
  year = {2021},
  eprint = {2106.00958},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2106.00958},
}
Figure