Few-shot learning
Few-shot learning is a branch of machine learning concerned with getting a model to recognise or perform something new from only a handful of labelled examples, rather than thousands.
Conventional supervised learning needs many labelled examples of every category it must recognise. Few-shot learning aims to cope with only a few per category. One-shot learning is the special case of a single example, and zero-shot learning the extreme in which the model gets no examples of the new category at all. Google's machine learning glossary notes that the approach is often used for object classification.
The trick is to learn from many other tasks first. A few-shot system is trained across lots of small problems drawn from categories it has plenty of data for, so it gets good at the general skill of telling things apart from little evidence. In 2017 Jake Snell, Kevin Swersky and Richard Zemel's Prototypical Networks learned a space in which each class is represented by a prototype, and a new example is labelled by whichever prototype it sits closest to. The same year Chelsea Finn, Pieter Abbeel and Sergey Levine's MAML took a different route, training a model's starting parameters so that a few gradient steps on a small amount of new data give good results.
A concrete case: a factory adds a new product line and wants a camera to spot a new kind of defect, but has only five photos of it. Rather than gather thousands more, a few-shot model compares new images with those five examples in a feature space it learned from other defects and other products.
Since 2020 the term has also been used for something different in language models. OpenAI's GPT-3 paper, Language Models are Few-Shot Learners, used few-shot to mean placing a few examples in the prompt with no change to the model's weights. The authors noted the link to few-shot learning in the older sense: in both, the system has learned from a broad range of tasks and then adapts quickly to a new one. In AI news today, few-shot usually refers to that prompting technique.
Few-shot methods matter wherever labelled data is scarce or expensive, such as medical imaging, specialised language tasks or new products. They are not free accuracy. Results generally trail models trained on plenty of task-specific data, and the GPT-3 paper itself reported that its few-shot results were much worse than the best fine-tuned models of the time.
It is teaching a machine learning model to handle a new category or task from just a few examples. The model manages this because it was first trained on many similar tasks, so it has learned how to learn from little evidence. The difference is how many examples of the new category the model gets: none for zero-shot, exactly one for one-shot and a handful for few-shot. With no examples, a zero-shot model has to rely on other information, such as a description of the category. They are related but not the same. Classic few-shot learning is a training approach, often for image classification, that builds models able to learn new classes from few examples. Few-shot prompting puts a few examples in a language model's prompt without changing the model at all; the GPT-3 paper popularised the term in that sense. Many real problems have little labelled data, because examples are rare or labelling needs experts, as in medical imaging. Few-shot methods let a system handle new categories without collecting and labelling thousands of new examples, though accuracy is usually lower than with plenty of data.Common questions
What is few-shot learning in simple terms?
What is the difference between zero-shot, one-shot and few-shot learning?
Is few-shot learning the same as few-shot prompting?
Why is few-shot learning useful?
Search for "few-shot learning", "meta-learning", "prototypical networks" or "MAML" for the training-based meaning, and "few-shot prompting" for the language model meaning, since the two are often mixed up. Reliable sources include the original papers on arXiv, survey papers on few-shot learning and machine learning course material from universities. Check which sense of the term an article is using before comparing results.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.