
Hugging Face Blog
路 1 min read
Few-shot learning in practice: GPT-Neo and the 馃 Accelerated Inference API
In many Machine Learning applications, the amount of available labeled data is a barrier to producing a high-performing model. The latest developments in NLP show that you can overcome this limitation by providing a few examples at inference time with a large language model - a technique known as Few-Shot Learning. In this blog post, we'll explain what Few-Shot Learning is, and explore how a large language model called GPT-Neo, and the 馃 Accelerated Inference API, can be used to generate your own predictions.
What is Few-Shot Learning?
Few-Shot Learning refers to the practice of feeding a machine learning model with a very small amount of training data to guide its predictions, like a few examples at inference time, as opposed to standard fine-tuning techniques which require a relatively large amount of training data for the pre-trained model to adapt to the desired task with accuracy.
This technique has been mostly used in computer vision, but with some of the latest Language Models, like EleutherAI GPT-Neo and OpenAI GPT-3, we can now use it in Natural Language Processing (NLP).
In NLP, Few-Shot Learning can be used with Large Language Models, which have learned to perform a wide number of tasks implicitly during their pre-training on large text datasets. This enables the model to generalize, that is to understand related but previously unseen tasks, with just a few examples.
Few-Shot NLP examples consist of three main components:
- Task Description: A short description of what the model should do, e.g. "Translate English to French"
- Examples: A few examples showing the model what it is expected to predict, e.g. "sea otter => loutre de mer"
- Prompt: The beginning of a new example, which the model should complete by generating the missing text, e.g. "cheese => "
Image from Language Models are Few-Shot Learners
OpenAI showed in the GPT-3 Paper that the few-shot prompting ability improves with the number of language model parameters.
Original source
This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.
Read the full story on huggingface.co


