Reading time: about 8 minutes · 1 December 2026 · ICML, 2017

This paper introduces MAML, a way to train a neural network’s initial parameters so that a small number of gradient steps, with only a few examples from a new task, produce good performance—and the same idea applies to classification, regression, and reinforcement learning.

Background

People can learn a new object or a new skill from a handful of examples. A deep network usually cannot: it needs many labeled samples, and if it is simply fine-tuned on a tiny new set it often overfits. Few-shot learning asks a model to adapt to a new task from only K examples per class, or a few trials. Meta-learning, or learning to learn, trains the model on a distribution of tasks so that this fast adaptation becomes the thing being optimized. During meta-training, each “training example” is itself a task: the model sees a small support set, adapts, and is judged on held-out examples from that same task. At meta-test time, the tasks are new.

Many successful few-shot methods are built for classification in particular. They may learn a comparison metric, as in Siamese or matching networks, or they may read a whole dataset with a recurrent or memory-augmented model. Those designs work well on character and image benchmarks, but they are not always easy to carry over to a new loss, a new architecture, or a problem such as policy learning, where the feedback is a reward rather than a class label.

If the adaptation step is just ordinary gradient descent, then any model already trained by gradients could, in principle, be prepared for fast fine-tuning. The question is what that preparation should optimize. Some internal features transfer more readily than others. One explicit goal is to find an initialization from which a small step along the new task’s gradient produces a large improvement, without inventing a new architecture or a learned update rule.

Problem

The problem, then, is to make fast adaptation general. The method should work with fully connected, convolutional, or recurrent networks, and with both supervised losses and reinforcement-learning objectives. It should not add a large set of extra parameters, and it should leave the user free to take one gradient step or many, and to use whatever amount of new data is available.

Formally, tasks are drawn from a distribution p(T). In the K-shot setting, the model must adapt to a new task Ti from only K samples and the corresponding loss. During meta-training, a task is sampled, the model is updated on those K points, and the meta-objective is the loss on a fresh set of points from the same task, evaluated after that update. The test error on sampled tasks is the training signal of the meta-learner. Held-out tasks are reserved for meta-testing.

Method

The algorithm is called model-agnostic meta-learning (MAML). It leaves the model fθ unchanged in form and instead learns an initialization θ such that one or more gradient steps on a new task move the parameters to a good place.

Figure 1. Diagram of MAML (Finn, Abbeel & Levine, 2017, Fig. 1). The initialization θ is trained so that a small gradient step on a new task loss moves the parameters toward a good solution θ*.

Figure 1. Diagram of MAML (Finn, Abbeel & Levine, 2017, Fig. 1). The initialization θ is trained so that a small gradient step on a new task loss moves the parameters toward a good solution θ*.

For a single inner step with step size α, the adapted parameters on task Ti are

θ′i = θ − α ∇θ LTi(fθ).

The meta-objective is the sum, over tasks drawn from p(T), of the loss of the adapted model fθ′, evaluated on a new set of examples from the same task. A meta-step then updates the original θ with step size β, using the gradient of that post-adaptation loss. Automatic differentiation can back-propagate through the inner gradient, which requires second derivatives, or Hessian-vector products. The authors also study a first-order approximation that drops those second derivatives but still evaluates the meta-gradient at the post-update parameters θ′.

Algorithm 1 (Finn, Abbeel & Levine, 2017). For each sampled task, the inner loop computes adapted parameters θ′ with step size α. The meta-update then changes the original θ using the post-adaptation losses, with step size β.

Algorithm 1 (Finn, Abbeel & Levine, 2017). For each sampled task, the inner loop computes adapted parameters θ′ with step size α. The meta-update then changes the original θ using the post-adaptation losses, with step size β.

The same structure covers several problem types. For regression the loss is mean-squared error; for classification it is cross-entropy. For reinforcement learning, the inner gradient is a policy-gradient estimate, because the expected reward is not differentiable through the environment, and the meta-optimizer can be a trust-region method. In all cases the learned object is only the initialization: after meta-training, adaptation is ordinary fine-tuning with any number of steps and any amount of data.

Experiments

The first demonstration is few-shot regression of sine waves. Each task is a sinusoid whose amplitude is drawn from [0.1, 5.0] and whose phase is drawn from [0, π]. Inputs are sampled from [−5.0, 5.0], and the loss is mean-squared error. The regressor is a network with two hidden layers of 40 units and ReLU activations. MAML is trained with one inner gradient step on K = 10 points, α = 0.01, and Adam as the meta-optimizer. At evaluation, a single meta-learned model is fine-tuned on K = 5, 10, or 20 points and compared with a model pretrained on all tasks and then fine-tuned, as well as with an oracle that receives the true amplitude and phase.

Few-shot classification uses Omniglot and MiniImagenet, in the N-way, K-shot protocol of Vinyals et al. (2016): N held-out classes are chosen, K examples of each are provided, and new instances of those classes must be labeled. Omniglot has 1,623 characters from 50 alphabets, with 20 drawings each; 1,200 characters are used for training, the rest for testing, with 90-degree rotation augmentation. MiniImagenet uses 64 / 12 / 24 classes for train / validation / test. The convolutional model follows the four-module, 3 × 3 setup of Vinyals et al., with 64 filters (32 on MiniImagenet), batch normalization and ReLU; Omniglot images are 28 × 28. A non-convolutional network with hidden sizes 256, 128, 64, 64 is also reported, for comparison with memory-augmented models.

Reinforcement-learning tasks are built from rllab continuous-control environments. The policy has two hidden layers of 100 units. Inner updates use vanilla policy gradient (REINFORCE); the meta-optimizer is TRPO, with Hessian-vector products estimated by finite differences. In 2D navigation, a point mass must reach a goal sampled in the unit square; observations are position, actions are velocity clipped to [−0.1, 0.1], the reward is negative squared distance, and episodes end at a distance of 0.01 or a horizon of 100. MAML is trained to maximize performance after one update on 20 trajectories, and is evaluated with up to four updates of 40 samples each. Locomotion tasks ask a planar cheetah or a 3D ant to run at a randomly chosen velocity (uniform on [0, 2] for the cheetah, [0, 3] for the ant) or in a randomly chosen forward or backward direction, with horizon 200 and 20 rollouts per step (40 for the ant direction task).

Results

On the sine task, the MAML initialization adapts to a new curve from as few as five points and can estimate parts of the wave where no points were given, which indicates that it has learned the periodic structure. A model pretrained on the same task distribution, then fine-tuned, does not extrapolate reliably from so few points and can overfit. Even though MAML was trained for performance after one step, the adapted model continues to improve over further gradient steps without collapsing to the tiny support set.

Figure 2. Few-shot sine-wave regression (Finn, Abbeel & Levine, 2017, Fig. 2). Left: a MAML initialization adapts from K = 5 or 10 points and can estimate parts of the curve where no points were given. Right: a model pretrained on the same task distribution, then fine-tuned, overfits and fails to extrapolate.

Figure 2. Few-shot sine-wave regression (Finn, Abbeel & Levine, 2017, Fig. 2). Left: a MAML initialization adapts from K = 5 or 10 points and can estimate parts of the curve where no points were given. Right: a model pretrained on the same task distribution, then fine-tuned, overfits and fails to extrapolate.

On held-out Omniglot characters, the convolutional MAML model reaches 98.7 ± 0.4% on 5-way 1-shot and 99.9 ± 0.1% on 5-shot, and 95.8 ± 0.3% and 98.9 ± 0.2% on 20-way 1-shot and 5-shot (95% confidence intervals over tasks). A non-convolutional MAML model already attains 89.7 ± 1.1% and 97.5 ± 0.6% on 5-way 1-shot and 5-shot, above the memory-augmented network of Santoro et al. (2016). On MiniImagenet 5-way classification, MAML reaches 48.70 ± 1.84% (1-shot) and 63.11 ± 0.92% (5-shot), above matching networks and the meta-learner LSTM. A first-order approximation is nearly the same, at 48.07 ± 1.75% and 63.15 ± 0.91%, and the authors report roughly a 33% speed-up in network computation by skipping the second-derivative backward pass. The paper notes that Omniglot train/test splits in prior work were not always available, so those numbers may not be strictly comparable.

Table 1. Few-shot classification on held-out Omniglot characters and the MiniImagenet test set (Finn, Abbeel & Levine, 2017, Table 1). Values are accuracies with 95% confidence intervals over tasks. Convolutional MAML reaches 98.7 ± 0.4% (5-way 1-shot) and 99.9 ± 0.1% (5-shot) on Omniglot, and 48.70 ± 1.84% / 63.11 ± 0.92% on MiniImagenet 5-way 1-shot / 5-shot. A first-order approximation is nearly the same. The paper notes that Omniglot splits may not be strictly comparable to prior work.

Table 1. Few-shot classification on held-out Omniglot characters and the MiniImagenet test set (Finn, Abbeel & Levine, 2017, Table 1). Values are accuracies with 95% confidence intervals over tasks. Convolutional MAML reaches 98.7 ± 0.4% (5-way 1-shot) and 99.9 ± 0.1% (5-shot) on Omniglot, and 48.70 ± 1.84% / 63.11 ± 0.92% on MiniImagenet 5-way 1-shot / 5-shot. A first-order approximation is nearly the same. The paper notes that Omniglot splits may not be strictly comparable to prior work.

In 2D navigation and in the cheetah and ant locomotion tasks, a MAML initialization adapts to a new goal position, velocity, or direction substantially faster than conventional pretraining or random initialization, with good performance in two or three gradient steps. On these harder control problems, pretraining is sometimes worse than starting from scratch. Each RL gradient step, unlike the supervised cases, requires new samples from the environment.

Figure 5. Continuous-control adaptation on half-cheetah and ant velocity and direction tasks (Finn, Abbeel & Levine, 2017, Fig. 5). MAML reaches good returns in two or three gradient steps, faster than conventional pretraining or random initialization. Each gradient step requires new environment samples. Random baselines on the goal-velocity tasks are omitted because their returns are much worse (below −200 for the cheetah and below −25 for the ant).

Figure 5. Continuous-control adaptation on half-cheetah and ant velocity and direction tasks (Finn, Abbeel & Levine, 2017, Fig. 5). MAML reaches good returns in two or three gradient steps, faster than conventional pretraining or random initialization. Each gradient step requires new environment samples. Random baselines on the goal-velocity tasks are omitted because their returns are much worse (below −200 for the cheetah and below −25 for the ant).

Analysis

MAML’s useful claim is not only the classification accuracies, which are comparable to or slightly above specialized few-shot methods, but that the same training idea transfers to regression and to policy gradient RL without a new architecture. The learned object is an initialization, so the number of parameters is just that of the underlying model, and adaptation can continue for more than the single step used in meta-training.

The first-order results on MiniImagenet suggest that much of the benefit comes from evaluating the meta-objective at the post-update parameters, rather than from the second-order terms that arise when differentiating through the inner step. That is consistent with the observation that ReLU networks are often locally close to linear. For RL, the same sensitivity viewpoint explains why a carefully prepared initialization can move a high-dimensional policy with very little new experience, and why pretraining on a mixture of tasks is not automatically a good starting point.

Summary

MAML meta-trains a model’s initial weights so that a few gradient steps on a new task, with only a small amount of new data, produce good generalization. The same procedure covers sine-wave few-shot regression, Omniglot and MiniImagenet classification—where it matches or exceeds strong specialized baselines—and accelerated adaptation of continuous-control policies, without adding parameters beyond the model being trained.

References

Finn, C., Abbeel, P., & Levine, S. (2017). Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks. In Proceedings of the 34th International Conference on Machine Learning (PMLR 70:1126–1135). https://proceedings.mlr.press/v70/finn17a.html

Vinyals, O., Blundell, C., Lillicrap, T., Kavukcuoglu, K., & Wierstra, D. (2016). Matching networks for one shot learning. In Advances in Neural Information Processing Systems.

Ravi, S., & Larochelle, H. (2017). Optimization as a model for few-shot learning. In International Conference on Learning Representations.

Santoro, A., Bartunov, S., Botvinick, M., Wierstra, D., & Lillicrap, T. (2016). Meta-learning with memory-augmented neural networks. In International Conference on Machine Learning.

Lake, B. M., Salakhutdinov, R., & Tenenbaum, J. B. (2011). Omniglot. As cited in Finn et al. (2017).

Figures and Table 1 are from Finn, Abbeel & Levine (2017), PMLR 70:1126–1135.