As more data, better algorithms, and higher computing power continue to shape the future of artificial intelligence (AI), reliable machine learning models have become paramount to optimise outcomes. OpenAI’s meta-learning algorithm, Reptile, is one such model designed to perform a wide array of tasks.
For those unaware, meta-learning refers to the idea of ‘learning to learn by solving multiple tasks, like how humans learn. Using meta-learning, you can design models that can learn new skills or adapt to new environments rapidly with a few training examples.
In the recent past, the meta-learning algorithm has had a fair bit of success as it can learn with limited quantities of data. Unlike other learning models like reinforcement learning, which uses reward mechanisms for each action, meta-learning can generalise to different scenarios by separating a specified task into two functions.
The first function often gives a quick response within a specific task, while the second function includes the extraction of information learned from previous tasks. It is similar to how humans behave, where they often gain knowledge from previous unrelated tasks or experiences.
Typically, there are three common approaches to meta-learning.
- Metric-based: Learn an efficient distance metric
- Model-based: Use (recurrent) network with external or internal memory
- Optimisation-based: Optimise the model parameters explicitly for fast learning
Source: Model-Agnostic Meta-Learning for Fast Adaptation Of Deep Networks
For instance, the above image depicts the model-agnostic meta-learning algorithm (MAML) developed by researchers at the University of California, Berkeley, in partnership with OpenAI. The MAML optimises for a representation θ that can quickly adapt to new tasks.
On the other hand, Reptile utilises a stochastic gradient descent (SGD) to initialise the model’s parameters instead of performing several computations that are often resource-consuming. In other words, it also reduces the dependency of higher computational hardware requirements, if implemented in a machine learning project.
How Reptile works
Reptile repeatedly samples a task, performs stochastic gradient descent (SGD), and updates the initial parameters towards the final parameters learned task. SGD is an interactive method for optimising an objective function with suitable smoothness properties.
Source: On First-Order Meta-Learning Algorithms
Reptile can be regarded as an application of the shortest descent algorithm to the meta-learning setting and is similar to the first-order MAML that only needs black-box access to an optimiser such as SGD or Adam, with equal computational efficiency and performance.
Moreover, experts believe the Reptile algorithm is not necessarily superior to MAML in terms of learning performance, but it’s relatively simple to implement since it relies on SGD.
Source: On First-Order Meta-Learning Algorithms
Use cases
In a blog post, ‘Reptile: A Scalable Meta-Learning Algorithm,’ OpenAI published an implementation of Reptile based on TensorFlow, which is currently available GitHub. It also includes the code for replicating the experiments on Omniglot and Mini-ImageNet.
Another example to understand Reptile usage is the few-shot classification of the Omniglot dataset, which has close to 1,623 characters taken from 50 different alphabets with 20 examples for each character. The code helps users visualise some examples from the dataset, build the model, train them and visualise results of labels effortlessly.
The above examples show how Reptile effectively solves multiple problems, improving the result as per the defined indexes and loops. Reptile and MAML yield similar performance on the Omniglot and Mini-ImageNet benchmarks for few-shot classification. Reptile also converges to the solution faster, since the update has lower variance.