Source-linked AI summary

On First-Order Meta-Learning Algorithms

Alex Nichol, Joshua Achiam, John Schulman

arXiv:1803.02999v3cs.LG

TL;DR

The paper asks how to learn an initialization that enables rapid adaptation to unseen tasks from limited data. It analyzes first-order meta-learning, introduces Reptile, and reports empirical evidence and theoretical analysis of within-task generalization. The paper concludes that Reptile and related first-order methods provide simple approaches to learning such initializations, while some settings and regularization questions remain unresolved.

  • Problem

    Meta-learning seeks an agent that learns quickly on previously unseen tasks, addressing the large data requirements of systems trained from scratch.

  • Method

    The paper analyzes first-order initialization-based meta-learning, introduces Reptile, and updates an initialization toward parameters obtained after training on sampled tasks.

  • Results

    Empirical evaluation on Mini-ImageNet and Omniglot provides insights into implementation best practices, while the analysis shows that first-order MAML and Reptile optimize for within-task generalization.

  • Takeaways & Limitations

    First-order meta-learning methods offer simple gradient-based approaches for learning initializations that can be fine-tuned quickly on new tasks.

  • Takeaways & Limitations

    Applying Reptile to reinforcement learning produced negative results because joint training was a strong baseline, and regularization remained an open question amid a large training-testing error gap.

Abstract

from arXiv · show

This paper considers meta-learning problems, where there is a distribution of tasks, and we would like to obtain an agent that performs well (i.e., learns quickly) when presented with a previously unseen task sampled from this distribution. We analyze a family of algorithms for learning a parameter initialization that can be fine-tuned quickly on a new task, using only first-order derivatives for the meta-learning updates. This family includes and generalizes first-order MAML, an approximation to MAML obtained by ignoring second-order derivatives. It also includes Reptile, a new algorithm that we introduce here, which works by repeatedly sampling a task, training on it, and moving the initialization towards the trained weights on that task. We expand on the results from Finn et al. showing that first-order meta-learning algorithms perform well on some well-established benchmarks for few-shot classification, and we provide theoretical analysis aimed at understanding why these algorithms work.

1 Introduction

The paper frames meta-learning as learning to adapt quickly to new tasks from limited data, motivated by humans’ rapid learning and the limitations of learning from scratch. It introduces first-order approaches, including Reptile, and reports empirical and theoretical contributions.

  • Motivation: Machine-learning systems often require substantially more data than humans to reach comparable performance on new tasks.Examples include human recognition of new object categories from a few images and rapid novice progress in Frostbite.
  • Meta-learning setup: Meta-learning optimizes a fast-learning algorithm over a distribution of training tasks so the resulting agent performs well on held-out tasks.The setup samples training and test task sets and evaluates average performance on previously unseen tasks.
  • Approach: Initialization-based meta-learning learns parameters that can be fine-tuned on a new task, unlike approaches that encode the learning algorithm in recurrent-network weights without test-time gradient descent.The paper contrasts this approach with recurrent-network methods and conventional pretraining, which lacks a guarantee of producing a good fine-tuning initialization.
  • Contributions: The paper highlights first-order MAML’s simpler implementation and introduces Reptile as an equally simple algorithm that does not require a per-task training-test split.Reptile is described as closely related to FOMAML and particularly similar to joint training.
  • Contributions: The authors provide theoretical analysis showing that first-order MAML and Reptile optimize for within-task generalization.They also evaluate implementation practices empirically on Mini-ImageNet and Omniglot.

2 Meta-Learning an Initialization

MAML learns an initialization whose task-specific adaptation uses training data while performance is evaluated on separate test data. First-order MAML simplifies the outer update by ignoring the update operator’s parameter dependence.

  • MAML objective: MAML seeks an initialization φ that yields low loss after k task-specific updates for a randomly sampled task.The update operator applies k updates using data sampled from that task.
  • MAML objective: MAML adapts on training samples A and evaluates loss on test samples B, making the objective analogous to cross-validation for within-task generalization.The separate sets distinguish adaptation data from evaluation data.
  • MAML optimization: MAML optimizes the resulting loss with stochastic gradient descent through the meta-learning update.The section introduces the corresponding gradient-based optimization procedure.
  • First-order approximation: FOMAML treats the inner-loop gradients as constants and replaces the update operator’s Jacobian with the identity operation.This removes the second-order derivative contribution from the outer-loop gradient.
  • First-order approximation: FOMAML can be implemented by sampling a task, applying the inner update to obtain eφ, and computing the gradient at the adapted parameters.The supplied implementation passage explicitly begins this three-stage procedure.

3 Reptile

Reptile learns an initialization by repeatedly training on sampled tasks and moving the initialization toward the resulting task-adapted parameters. Although one-step Reptile matches joint-training SGD, multiple steps produce a different update with higher-order structure.

  • Algorithm: Reptile learns an initialization that can be optimized quickly at test time and generalizes from few examples of a new task.Its goal is shared with MAML but uses a first-order gradient-based training process.
  • Algorithm: Reptile’s serial algorithm initializes φ, samples a task, performs k SGD or Adam steps, and updates φ toward the adapted parameters eφ.The update is φ ← φ + ϵ(eφ − φ).
  • Algorithm: The displacement φ − eφ can be treated as a gradient and supplied to an adaptive optimizer such as Adam.The paper also defines a natural scaling by the SGD stepsize α.
  • Relation to joint training: For k = 1, batched Reptile corresponds to stochastic gradient descent on the expected task loss, making it equivalent to joint training in that case.The equivalence is stated for a single gradient-descent step.
  • Relation to joint training: For k > 1, Reptile’s expected update differs from the expected-loss gradient and includes second- and higher-order terms.The paper therefore states that Reptile converges to a solution different from the minimizer of Eτ[Lτ].
  • Relation to joint training: The batched version is closely related to SimuParallelSGD, which averages parameters after local worker updates rather than averaging gradients.The relationship differs by the Reptile stepsize and task sampling.

4 Case Study: One-Dimensional Sine Wave Regression

The sine-wave case study shows why task-aware meta-learning can outperform joint training when the average task function is uninformative. MAML and Reptile learn representations that adapt from sparse sampled points to the full target function.

  • Task setup: The case study uses one-dimensional sine-wave regression, where joint training cannot learn a useful initialization but meta-learning methods can.The problem is designed so that the contrast between joint training and meta-learning is explicit.
  • Task setup: Tasks are sine waves defined by amplitude a and phase b, sampled from a ∼ U([0.1, 5.0]) and b ∼ U([0, 2π]).Each learner receives sampled x-values and corresponding y-values, then predicts the whole function.
  • Why joint training fails: The average task function is zero everywhere, so minimizing the expected loss produces the uninformative zero function f(x) = 0.Random phase causes Eτ[fτ(x)] = 0.
  • Meta-learning behavior: MAML and Reptile produce initial outputs near zero while learning internal representations that adapt to approximate the sampled target function.This contrasts the initialization’s output with the post-adaptation behavior.
  • Meta-learning behavior: After Reptile training, the network quickly converges to a sampled sine wave and infers values away from the sampled points.Figure 1 compares this behavior with MAML and a randomly initialized network after 32 gradient steps on 10 sampled points.

5 Analysis

The analysis explains Reptile and related first-order methods through two complementary views: Taylor expansions of their updates and convergence toward task-solution manifolds. Their updates combine expected-loss optimization with a within-task generalization term, while the manifold argument motivates proximity to solutions across tasks but is explicitly informal.

  • Leading Order Expansion of the Update: Taylor expansions show that Reptile and MAML share leading terms: expected-loss minimization plus within-task generalization.The generalization term increases inner products between gradients from different minibatches of the same task.
  • Leading Order Expansion of the Update: AvgGrad moves the initialization toward the minimum of the expected loss over tasks.This is the joint-training component of the analyzed meta-gradients.
  • Leading Order Expansion of the Update: AvgGradInner increases inner products between gradients from different minibatches of a task, improving within-task generalization.The analysis identifies this higher-order term as the mechanism supporting fast learning.
  • Leading Order Expansion of the Update: For k ≥ 2, the relative weight of AvgGradInner increases linearly with the stepsize α and iteration count k, with MAML > FOMAML > Reptile.The Taylor approximation is valid only when αk is small.
  • Finding a Point Near All Solution Manifolds: The manifold interpretation is informal and should be treated as less reliable than the Taylor-series analysis.The paper distinguishes minimizing expected distance from minimizing expected loss, whose minimizers may form a high-dimensional manifold.
  • Finding a Point Near All Solution Manifolds: Reptile can be interpreted as stochastic gradient descent on expected distance to task-specific optimal-solution manifolds.In practice, it approximates projection onto a task’s solution set by running k gradient-descent steps from the initialization.

6 Experiments

The experiments compare Reptile and FOMAML on few-shot classification and probe how inner-loop gradient combinations, sampling, and hyperparameters affect performance. Reptile and FOMAML perform similarly overall, but shared-tail FOMAML is sensitive to minibatch overlap while Reptile and separate-tail FOMAML remain stable.

  • 6.1 Few-Shot Classification: Reptile and FOMAML achieve very similar performance on Omniglot and Mini-ImageNet, with Reptile slightly better on Mini-ImageNet and slightly worse on Omniglot.
  • 6.1 Few-Shot Classification: Transduction gives a performance boost in all evaluated cases, highlighting the relevance of batch normalization during testing.
  • 6.2 Comparing Different Inner-Loop Gradient Combinations: Two-step Reptile performs worse than two-step FOMAML, but all methods improve as the number of inner-loop minibatches increases.
  • 6.2 Comparing Different Inner-Loop Gradient Combinations: Reptile benefits more from summing all inner-loop gradients than FOMAML benefits from using only the final gradient, suggesting value in many inner-loop steps.
  • 6.3 Overlap Between Inner-Loop Mini-Batches: Shared-tail FOMAML degrades when its final minibatch overlaps earlier batches, whereas separate-tail FOMAML and Reptile maintain performance across inner-loop settings.
  • 6.3 Overlap Between Inner-Loop Mini-Batches: Shared-tail FOMAML degrades with cycling or random minibatch sampling as overlap increases, although random sampling produces a more gradual decline.
  • 6.3 Overlap Between Inner-Loop Mini-Batches: Shared-tail FOMAML remains equally poor across the tested step-size sweep, weakening the explanation that its degradation is caused only by a lower effective step size.

7 Discussion

The discussion presents Reptile as a simple first-order meta-learning algorithm and explains its effectiveness through two theoretical perspectives. These analyses connect its updates to within-task generalization and proximity to task-specific solution manifolds.

  • Reptile differs subtly from joint training while using only first-order gradient information, like first-order MAML.
  • A Taylor expansion shows that SGD supplies a MAML-like second-order term maximizing agreement between gradients from different minibatches of the same task.
  • A second informal explanation is that Reptile finds an initialization close in Euclidean distance to the optimal solution manifolds of training tasks.
  • The Taylor analysis suggests that ordinary stochastic gradient descent may automatically perform a MAML-like update that improves generalization between minibatches.

8 Future Work

Future work targets unresolved questions about Reptile’s generalization, architecture, regularization, and applicability beyond few-shot classification.

  • The paper proposes studying whether SGD can automatically optimize for generalization and whether this effect can be amplified outside meta-learning.
  • Reptile’s reinforcement-learning application produced negative results because joint training was a strong baseline, motivating algorithmic modifications.
  • The authors propose testing whether deeper classifier architectures improve Reptile’s few-shot learning performance.
  • The authors identify a large training–testing error gap and propose evaluating regularization as a possible way to improve few-shot performance.
  • They also propose evaluating Reptile for few-shot density modeling.

A Hyper-parameters

The experiments use simplified and shared hyper-parameter choices, with outer step sizes annealed linearly to zero; the appendix lists settings for each comparison.

  • All experiments linearly annealed the outer step size to zero and estimated confidence intervals from three random seeds.
  • The authors simplified hyper-parameters after finding that most had little effect on performance during CMA-ES optimization.
  • Table 3 lists Reptile hyper-parameters for the Omniglot comparison between algorithms.
  • Table 4 lists Reptile hyper-parameters for the Mini-ImageNet comparison between algorithms.
  • Tables 5 and 6 provide hyper-parameters for Sections 6.2 and 6.3, respectively, with outer step sizes annealed to zero during training.
  • Figure 4c reports an inner learning rate of 3 × 10−3 for the displayed settings.
Loading 1803.02999v3…