Meta-Learning with Adjoint Methods

Shibo Li, Zheng Wang, Akil Narayan, Robert Michael Kirby, Shandian ZhearXiv 2021

Abstract

Model-Agnostic Meta-Learning (MAML) is a powerful framework for few-shot learning, but it faces significant scaling bottlenecks due to the memory-intensive nature of backpropagating through long optimization trajectories. We introduce Adjoint Model-Agnostic Meta-Learning (A-MAML), a method that treats the inner-loop optimization as an Ordinary Differential Equation (ODE). By employing the adjoint method, A-MAML computes meta-gradients with constant memory overhead relative to the number of adaptation steps, enabling the model to capture long-term learning dynamics that were previously computationally inaccessible.

The Scaling Problem in Meta-Learning

The core idea of MAML is to find a model initialization that can be adapted to a new task with just a few gradient steps. However, calculating the gradient of the validation loss with respect to this initialization requires backpropagating through the entire "inner-loop" optimization path.

When this path is long—spanning hundreds of steps—the computation graph grows exponentially, leading to massive memory consumption. To mitigate this, researchers often limit MAML to a handful of steps or use first-order approximations (FOMAML) and implicit methods (iMAML). Unfortunately, these workarounds often sacrifice accuracy or require restrictive regularizers that bias the learning process.

Methodology: A-MAML

A-MAML reinterprets gradient descent as the evolution of a dynamical system. By viewing model parameters as states evolving over time, we can apply techniques from optimal control to optimize the meta-learning objective.

The ODE Perspective

We treat the parameter updates as an ODE system where the state $\mathbf{u}(t)$ represents the model parameters at time $t$. Standard gradient descent is essentially a Forward Euler discretization of this continuous process.

The Adjoint Method

Instead of storing the entire computation graph for backpropagation, A-MAML uses the adjoint method. This approach requires only two passes through an ODE solver:

  1. Forward Pass: Solve the "Forward ODE" to determine the final adapted parameters.
  2. Backward Pass: Solve a companion "Adjoint ODE" backward in time to compute the necessary gradients.
The A-MAML framework: The forward pass evolves model parameters via a Forward ODE, while the adjoint ODE runs backward to compute meta-gradients efficiently.

Computational Efficiency

To avoid the prohibitive cost of calculating the full Hessian matrix, A-MAML utilizes a Hessian-vector product trick. This ensures that the second-order meta-gradients have the same computational complexity as standard first-order gradient calculations. Furthermore, to ensure numerical stability during the backward pass, the method tracks intermediate states and employs second-order solvers like the Modified Euler method.

Experimental Results

The authors evaluated A-MAML across synthetic regression, collaborative filtering, and few-shot image classification tasks.

Key Findings

  • Memory Efficiency: In synthetic 2D regression tests, standard MAML exhausted GPU memory at 200 adaptation steps. In contrast, A-MAML successfully handled over 500 steps while utilizing less than 25% of the memory required by MAML.
  • Superior Accuracy: By enabling longer training trajectories, A-MAML consistently achieved lower error rates (nRMSE) than FOMAML and Reptile. On the Omniglot image classification benchmark, it reached a high accuracy of 96.79%.
  • Flexibility: Unlike iMAML, which requires proximal regularization to ensure gradient accuracy, A-MAML works with standard loss functions and is compatible with common techniques like early stopping.

Conclusion and Future Work

A-MAML provides a scalable solution to the memory bottleneck in meta-learning. By leveraging the adjoint method, it allows for deep inner-loop optimizations without the linear memory growth typical of standard backpropagation. Future research will focus on extending A-MAML to conditional meta-learning, where task-specific metadata can be used to further refine the initialization process.

Summary updated

BibTeX
@misc{li2021meta,
  author = {Shibo Li and Zheng Wang and Akil Narayan and Robert Michael Kirby and Shandian Zhe},
  title = {{Meta-Learning with Adjoint Methods}},
  year = {2021},
  eprint = {2110.08432},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2110.08432},
}
Figure