This repository contains implementations of popular meta-learning algorithms, designed to help machines quickly adapt to new tasks using only a small amount of data. The implemented algorithms include:
- Reptile: A simple and efficient gradient-based meta-learning method.
- Model-Agnostic Meta-Learning (MAML): A widely-used meta-learning algorithm for fast adaptation.
- MAML Enhanced: A customized version of MAML, incorporating:
- Meta-Curvature (MC): Introduces learnable transformations of gradients, improving optimization in the meta-learning process.
- Layer-Specific Learning Rates (LSLR): Adjusts learning rates for each layer dynamically, enhancing training efficiency.
These implementations have been tested primarily on the Sinusoid dataset, a common benchmark for evaluating meta-learning methods.
Meta-learning often referred to as "learning to learn," is a subfield of machine learning that focuses on enabling models to adapt quickly to new tasks using limited data. Unlike traditional learning methods, which train a model to perform a single task meta-learning trains a model to develop a generalized strategy that works across a variety of tasks. This approach is particularly useful in scenarios where data is scarce or tasks are highly diverse.
https://arxiv.org/abs/1803.02999
... 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.
https://arxiv.org/abs/1703.03400
MAML is a meta-learning algorithm that aims to train models that can rapidly adapt to new tasks with few examples. The core idea is to optimize the initialization of the model so that, after a few gradient steps on a new task, the model's performance is maximized. By training on a variety of tasks and optimizing for fast adaptation, MAML enables models to generalize well to unseen tasks. This work has been widely adopted in the field of meta-learning due to its effectiveness in few-shot learning scenarios.
Inspired by How to Train Your MAML, This Below is a high-level diagram illustrating the workflow of MAML Enhanced, including Meta-Curvature and LSLR:
Implementation of Layer-Specific Learning Rates in MAML Framework
Implementation of Meta Curvature in MAML Framework
- Inner Loop: Task-specific adaptation using gradient descent, where Meta-Curvature transforms the gradients.
- Outer Loop: Meta-updates using aggregated loss across tasks, with LSLR fine-tuning learning rates for each layer.
Install the required dependencies with:
pip install -r requirements.txt
You can run experiments on the Sinusoid dataset using the provided python notebook.
This script might or might not suitable with your use case so please modify each method script to cater your needs.
- Support for additional datasets and tasks.
- Benchmarking against state-of-the-art algorithms.
-
Finn, Chelsea, et al. Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks. (2017)
Read Paper -
Nichol, Alex, and John Schulman. Reptile: A Scalable Metalearning Algorithm. (2018)
Read Paper -
Park, Eunbyung, et al. Meta-Curvature. (2019)
Read Paper -
Antoniou, Antreas, et al. How To Train Your MAML. (2019)
Read Paper