Learning to learn by gradient descent by gradient descent

Marcin Andrychowicz, Misha Denil, Sergio Gomez Colmenarejo, Matthew W. Hoffman, David Pfau, Tom Schaul, Nando de FreitasarXiv 2016

Abstract

The move from hand-designed features to learned features in machine learning has been wildly successful. In spite of this, optimization algorithms are still designed by hand. In this paper we show how the design of an optimization algorithm can be cast as a learning problem, allowing the algorithm to learn to exploit structure in the problems of interest in an automatic way. Our learned algorithms, implemented by LSTMs, outperform generic, hand-designed competitors on the tasks for which they are trained, and also generalize well to new tasks with similar structure. We demonstrate this on a number of tasks, including simple convex problems, training neural networks, and styling images with neural art.

Introduction

For decades, the field of machine learning relied on hand-crafted features like SIFT or HOG to process data. The deep learning revolution shifted this paradigm, demonstrating that features learned directly from data often far exceed the performance of human-designed ones. However, a significant component of the training process remains hand-designed: the optimization algorithms themselves. Popular optimizers such as Stochastic Gradient Descent (SGD), RMSprop, and Adam are built on human intuition about gradient dynamics.

This research explores a provocative alternative: if we can learn features, why can't we learn the optimization algorithm? By framing the design of an update rule as a learning problem, we can create optimizers that automatically adapt to the specific geometry and structure of the tasks they are intended to solve.

Methods: The Optimizer as a Recurrent Neural Network

The core methodology involves replacing traditional update rules with a learned neural network, specifically a Long Short-Term Memory (LSTM) network. In this framework, we distinguish between two entities:

  1. The Optimizer ($g$): A recurrent neural network that takes the current gradient as input and outputs the parameter update for the target model.
  2. The Optimizee ($f$): The target function or model (e.g., a neural network's loss function) that we wish to minimize.

To ensure the optimizer can scale to models with millions of parameters, the authors employ a coordinate-wise architecture. Instead of one massive RNN, a small LSTM operates on each parameter independently. While the LSTM shares weights across all coordinates, it maintains unique hidden states for each, ensuring the update rule is invariant to parameter ordering and computationally efficient.

The unrolled computational graph showing the interaction between the optimizer (m) and the optimizee (f) over time steps.

The optimizer is trained using Meta-Loss, which is the expected loss of the optimizee over a fixed optimization horizon. By using Backpropagation Through Time (BPTT), the optimizer learns to navigate the loss landscape of the optimizee to find minima more rapidly than standard calculus-based methods.

Experimental Evaluation

The learned LSTM optimizer was evaluated across a diverse set of domains to test both its performance and its ability to generalize:

  • Synthetic Quadratics: A baseline test using 10-dimensional quadratic functions to verify the optimizer's ability to minimize simple convex surfaces.
  • MNIST: Training a Multi-Layer Perceptron (MLP) for digit recognition.
  • CIFAR-10: Training Convolutional Neural Networks (CNNs) for image classification.
  • Neural Art: A complex style transfer task where an image is optimized to match the artistic style of a reference painting.

Key Results

In nearly every test case, the learned optimizer demonstrated superior convergence speed and lower final loss compared to hand-designed baselines like Adam, RMSprop, and Nesterov Accelerated Gradient (NAG).

Performance comparison of the learned LSTM optimizer against hand-designed baselines across quadratic functions and MNIST.

Notably, the LSTM optimizer showed remarkable robustness. When trained on MNIST for 100 steps and then run for 200 steps, it continued to decrease the loss effectively, suggesting it had learned a generalizable optimization strategy rather than just memorizing a fixed sequence of steps. Furthermore, an optimizer trained on a simple 1-layer MLP was successfully applied to a 2-layer MLP, demonstrating significant transferability across different architectures.

Discussion and Limitations

While the results are promising, several challenges remain. Training the optimizer itself is computationally expensive due to the need to unroll the optimization process. Additionally, the optimizer's performance can be sensitive to the underlying dynamics of the optimizee; for instance, an optimizer trained on networks with Sigmoid activations may struggle with ReLU-based networks due to the shift in gradient distributions.

Despite these limitations, the transition from hand-designed to learned optimizers represents a significant step toward fully automated machine learning. Future work may explore more complex architectures that account for correlations between parameters, potentially surpassing the current coordinate-wise limitations.

Summary updated

BibTeX
@misc{andrychowicz2016learning,
  author = {Marcin Andrychowicz and Misha Denil and Sergio Gomez Colmenarejo and Matthew W. Hoffman and David Pfau and Tom Schaul and Nando de Freitas},
  title = {{Learning to learn by gradient descent by gradient descent}},
  year = {2016},
  eprint = {1606.04474},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1606.04474},
}
Figure