techlist.io
OpenAI2018-03-063 min read

Curated summary

Reptile: A scalable meta-learning algorithm

Read original(opens in new tab)

Reptile: A Simple, Scalable Meta-Learning Algorithm

Reptile is a meta-learning algorithm that finds a neural network initialization from which new tasks can be learned quickly from few examples. It works by repeatedly sampling a task, running standard SGD on it, and moving the initial parameters toward the adapted result. Mathematically it resembles first-order MAML, but it needs only black-box access to an optimizer such as SGD or Adam, and it achieves similar performance with lower computational cost.

Meta-Learning and the Few-Shot Setting

  • Meta-learning takes a distribution of tasks, each a learning problem, and produces a learner that generalizes from a small number of examples.
  • A well-studied case is few-shot classification, where the learner sees only 1–5 examples per class before classifying new inputs.

How Reptile Differs from MAML

  • MAML unrolls and differentiates through the gradient descent computation graph, which requires second derivatives.
  • Reptile runs ordinary SGD on each task and never builds a computation graph or computes second derivatives, so it uses less computation and memory.
  • The update moves the initialization toward the task-adapted parameters. Treating that difference as a gradient allows plugging it into a more sophisticated optimizer such as Adam.

Why It Works

  • With one SGD step per task (k=1), the method reduces to joint training on the mixture of all tasks. Joint training learns little when zero-shot learning is impossible, such as when output labels are randomly permuted.
  • Reptile requires multiple steps (k>1), where the update depends on higher-order derivatives of the loss.
  • A Taylor-series analysis shows that the Reptile update maximizes the inner product between gradients from different minibatches of the same task, which corresponds to better generalization. The authors suggest this may also help explain the generalization of SGD outside meta-learning.
  • Reptile and MAML produce similar updates, containing the same two terms with different weights.

Experimental Results

  • On the Omniglot and Mini-ImageNet few-shot classification benchmarks, Reptile and MAML perform similarly.
  • Reptile converges faster because its update has lower variance.
  • Summing different combinations of SGD minibatch gradients yields a family of algorithms. Using only the second gradient corresponds to first-order MAML. Including more gradients speeds learning through variance reduction, and using only the first gradient makes no progress, as the analysis predicts.

Implementations

  • The official implementation uses TensorFlow and includes code to replicate the Omniglot and Mini-ImageNet experiments.
  • A smaller JavaScript implementation fine-tunes a TensorFlow-pretrained model and powers the interactive 1-shot classification demo.
  • A minimal PyTorch example performs few-shot regression on random sine waves from 10 (x, y) pairs.

Relationship to Prior Work

The authors note that first-order MAML and Reptile are more closely related than the names suggest. They take different perspectives but compute similar updates. Reptile's contribution builds on Shortest Descent and on avoiding second derivatives in meta-learning. The post's first paragraph was updated to reflect this.

Continue with another curated summary.