Narrowing the Focus: Learned Optimizers for Pretrained Models

Gus Kristiansen, Mark Sandler, Andrey Zhmoginov, Nolan Miller, Anirudh Goyal, Jihwan Lee, Max Vladymyrov · OpenReview

Abstract

In modern deep learning, the models are learned by applying gradient updates using an optimizer, which transforms the updates based on various statistics. Optimizers are often hand-designed and tuning their hyperparameters is a big part of the training process. Learned optimizers have shown some initial promise, but are generally unsuccessful as a general optimization mechanism applicable to every problem. In this work we explore a different direction: instead of learning general optimizers, we instead specialize them to a specific training environment. We propose a novel optimizer technique that learns a layer-specific linear combination of update directions provided by a set of base optimizers, effectively adapting its strategy to the specific model and dataset. When evaluated on image classification tasks, this specialized optimizer significantly outperforms both traditional off-the-shelf methods such as Adam, as well as existing general learned optimizers. Moreover, it demonstrates robust generalization with respect to model initialization, evaluating on unseen datasets, and training durations beyond its meta-training horizon.

Introduction

In modern deep learning, we spend an enormous amount of time "tuning the tuner." Hand-designed optimizers like Adam or SGD require careful hyperparameter selection—such as learning rates and decay schedules—to work well. While "learned optimizers" (AI models trained to act as optimizers) have been proposed to automate this, they face two major hurdles: the generalization gap, where optimizers trained on simple tasks fail on complex ones, and the complexity trap, where universal learned optimizers are computationally heavy and expensive to train.

This research introduces L3RS (Learned Layer-wise Learning Rate Scheduler), a specialized learned optimizer designed specifically for the most common use case in AI today: fine-tuning pretrained models. By narrowing the scope, L3RS creates a leaner, more effective tool that understands the specific dynamics of adapting a pretrained network to a new task.

Methodology: The L3RS Framework

L3RS acts as a "meta-manager" for existing base optimizers like Adam and SGD. Unlike black-box learned optimizers that generate updates from scratch, L3RS employs a technique called "grafting," which separates the update direction from its magnitude.

The L3RS architecture applies a specialized MLP to each layer independently, combining base optimizer directions with learned coefficients.

The framework applies a small Multi-Layer Perceptron (MLP) to every layer of the target model independently. This layer-wise logic allows it to adapt to the varying needs of different network components—for instance, realizing that an early convolutional layer might require a different update strategy than a final dense layer. The L3RS controller makes decisions based on several feature-rich inputs:

  • Time: Progress within the training process.
  • Statistics: Exponential Moving Averages (EMA) of gradients, weights, and loss.
  • Embeddings: A learned "fingerprint" for each layer.

For each layer, L3RS outputs a learning rate and a set of mixing coefficients. It essentially determines the optimal linear combination of directions provided by the base optimizers for that specific layer at that specific moment. The optimizer itself is trained using Natural Evolution Strategies (NES), a gradient-free method that ensures stability during meta-training.

Experimental Results

The researchers evaluated L3RS on image classification tasks using ResNet-34. They used ImageNet for pretraining and meta-training, and the Places dataset as an "out-of-distribution" benchmark to test generalization to different visual domains.

L3RS demonstrated superior performance, reaching target accuracy levels up to 200% faster than the best-tuned traditional optimizers and significantly outperforming general learned optimizers like VELO.

L3RS achieves significant speedups over traditional and general learned optimizers across various evaluation accuracy thresholds.

Key Insights

  • Efficiency: L3RS has a fraction of the parameters of previous learned optimizers, with a compute overhead of only ~0.057%.
  • Robust Generalization: Despite being meta-trained on ImageNet, L3RS performed excellently on the Places dataset without further adjustment.
  • Horizon Extension: The optimizer remained effective for training runs up to five times longer than its meta-training horizon (2,500 steps vs. 500 steps).
  • Interpretability: Analysis showed that L3RS typically favors Adam-like updates with high learning rates early in training, gradually shifting toward SGD-like updates as the model converges.

Conclusion

By specializing in fine-tuning, L3RS avoids the instability and high costs associated with general-purpose learned optimizers. While it requires a pretrained starting point to be effective, its efficiency and robustness make it a practical drop-in replacement for traditional methods. Future work aims to apply this "narrowed focus" approach to Large Language Model (LLM) fine-tuning, potentially offering massive savings in compute for the industry's most expensive models.

Summary updated

BibTeX
@misc{kristiansen2024narrowing,
  author = {Gus Kristiansen and Mark Sandler and Andrey Zhmoginov and Nolan Miller and Anirudh Goyal and Jihwan Lee and Max Vladymyrov},
  title = {{Narrowing the Focus: Learned Optimizers for Pretrained Models}},
  year = {2024},
  eprint = {2408.09310},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.09310},
}
Figure