Memory-based Optimization Methods for Model-Agnostic Meta-Learning

Bokun Wang, Zhuoning Yuan, Yiming Ying, Tianbao YangarXiv 2021

Abstract

In recent years, model-agnostic meta-learning (MAML) has become a popular research area. However, the stochastic optimization of MAML is still underdeveloped. Existing MAML algorithms rely on the "episode" idea by sampling a few tasks and data points to update the meta-model at each iteration. Nonetheless, these algorithms either fail to guarantee convergence with a constant mini-batch size or require processing a large number of tasks at every iteration, which is unsuitable for continual learning or cross-device federated learning where only a small number of tasks are available per iteration or per round. To address these issues, this paper proposes memory-based stochastic algorithms for MAML that converge with vanishing error. The proposed algorithms require sampling a constant number of tasks and data samples per iteration, making them suitable for the continual learning scenario. Moreover, we introduce a communication-efficient memory-based MAML algorithm for personalized federated learning in cross-device (with client sampling) and cross-silo (without client sampling) settings. Our theoretical analysis improves the optimization theory for MAML, and our empirical results corroborate our theoretical findings.

Introduction

Model-Agnostic Meta-Learning (MAML) is a versatile framework for "learning to learn," enabling models to adapt rapidly to new tasks with minimal data. However, MAML's nested optimization structure—where the meta-gradient depends on task-specific gradients—presents significant challenges for standard stochastic gradient descent. Existing theoretical guarantees often necessitate impractically large batch sizes of tasks ($B$) or data points ($K$) per iteration to ensure convergence. This requirement is particularly problematic in continual learning and federated learning (FL), where data availability and connectivity are constrained.

Methodology: The Power of Memory

To overcome the limitations of large-batch requirements, this work introduces a "memory-based" approach. The core idea is to maintain a personalized model (memory) for each task, which is updated via momentum.

MOML and MOMLv2

In the centralized setting, MOML (Memory-Based MAML) maintains an estimator for each task's adapted model. Instead of re-estimating the gradient from scratch using a massive batch, MOML uses a moving average of historical stochastic updates. This "memory" allows the algorithm to accumulate information over time, effectively achieving the benefits of a large batch size while only sampling a constant number of tasks ($B=O(1)$) and data points ($K=O(1)$) per iteration. MOMLv2 extends this to handle more realistic scenarios with unbounded gradients.

Algorithm 1: MOMLv1 pseudocode showing the momentum-based update of personalized models.

LocalMOML for Federated Learning

For decentralized settings, LocalMOML adapts the memory-based approach to personalized federated learning. It allows clients to perform multiple local updates before communicating with a central server. Crucially, LocalMOML supports client sampling, ensuring convergence even when only a subset of devices is active in any given round.

Theoretical and Empirical Results

The proposed algorithms represent a significant theoretical advancement, providing the first convergence proofs for MAML-style objectives using $O(1)$ tasks and samples.

Comparison of MOML and LocalMOML against state-of-the-art algorithms in single-node and federated settings. Note the $O(1)$ data point requirement for the proposed methods.

Key Findings

  • Efficiency: As shown in the comparison table, MOML and LocalMOML achieve competitive sample and communication complexities while maintaining a constant number of data points per iteration ($K=O(1)$), unlike previous methods like Per-FedAvg or BSGD which often require $O(\epsilon^{-2})$.
  • Performance:
    • Sinewave Regression: MOMLv1 demonstrates significantly faster convergence than NASA and BSGD when using small batches.
  • Image Classification: On CIFAR-100 one-shot classification, MOMLv2 reached 40.82% accuracy, outperforming BSGD.
  • Federated Learning: LocalMOML achieved 56.45% accuracy on a 5-shot CIFAR-100 task, a notable improvement over Per-FedAvg (53.37%).

Conclusion

By integrating momentum-based memory into the MAML framework, MOML and LocalMOML bridge the gap between theoretical convergence and practical constraints. These methods enable efficient meta-learning in resource-constrained environments like cross-device federated learning and continual learning. While the centralized version introduces memory overhead proportional to the number of tasks, the federated approach naturally distributes this burden across clients, making it a scalable solution for large-scale personalized learning.

Summary updated

BibTeX
@misc{wang2021memory,
  author = {Bokun Wang and Zhuoning Yuan and Yiming Ying and Tianbao Yang},
  title = {{Memory-based Optimization Methods for Model-Agnostic Meta-Learning}},
  year = {2021},
  eprint = {2106.04911},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2106.04911},
}
Figure