One-shot learning
One-shot learning is a machine-learning setting in which a system learns or adapts to perform a task from a single example.
Knowledge Graphs and LLMs in Action
One-shot learning is performing a task after receiving one task-specific example.
- How it is used
- Deploys one example to guide domain-specific knowledge extraction and knowledge-graph construction with a pretrained language model.
- How deep it goes
- Defines the prompting pattern, gives iteration and validation advice, and stops short of solving complex reasoning ambiguities.
- Examples
- Uses contextual interpretations of “Prof. Chem.” and “Stanford,” plus mini-knowledge-graph inspection.
- What you can do after
- Apply it via prompt engineering, validate outputs through small knowledge graphs, and switch to fine-tuning when necessary.
Read how Knowledge Graphs and LLMs in Action explains one-shot learning →
Fight Fraud with Machine Learning
One-shot learning is a learning setting in which a model must recognize or learn a new pattern from a single example.
- How it is used
- Uses a single example in prompt engineering to adapt ChatGPT's phishing classification to a previously missed pattern.
- How deep it goes
- Defines one-shot and few-shot learning, demonstrates prompt-based correction, and names Siamese networks without detailing their implementation.
- Examples
- Uses a misclassified phishing email, a genuine-and-phishing demonstration pair, and a specific ghost-domain pattern.
- What you can do after
- Apply it via prompt engineering to classify phishing emails after supplying representative genuine and phishing examples.
Read how Fight Fraud with Machine Learning explains one-shot learning →
Also covered in
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- promptA prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- fine-tuningFine-tuning is the continued training of a pretrained model on targeted data or objectives to adapt its parameters or behavior to a task, domain, or use.
- pretrainingPretraining is the initial training of a model on broad data to learn general patterns or capabilities before adaptation to specific tasks or domains.
Related concepts
- machine learningkind of · Machine learning is a field of computational methods in which systems learn patterns or relationships from data to make predictions, decisions, or other outputs.
- prompt engineeringused by · Prompt engineering is the deliberate design and refinement of inputs, instructions, and context to guide an AI model’s behavior or outputs.
- zero-shot learningcontrasts with · Zero-shot learning is the application of a model to a task or classes without task-specific examples or demonstrations, relying on prior learned knowledge and available task information.
- few-shot learningalternative to · Few-shot learning is an approach in which a model is guided to perform or adapt to a task from only a small number of examples.
- one-shot promptinguses · One-shot prompting is a prompting technique that provides a language model with a single task-related example to guide its response.
- shot learningkind of · A prompting approach that provides zero or more examples to guide the output behavior of a language model.
Questions about one-shot learning
What is one-shot learning?
One-shot learning is a machine-learning setting in which a system learns or adapts to perform a task from a single example.
Which Manning books explain one-shot learning?
Knowledge Graphs and LLMs in Action and Fight Fraud with Machine Learning.
What should I know before learning one-shot learning?
Manning books that teach one-shot learning usually introduce language model, prompt, fine-tuning and pretraining first.
What is the difference between one-shot learning and zero-shot learning?
One-shot learning is a machine-learning setting in which a system learns or adapts to perform a task from a single example. Zero-shot learning is the application of a model to a task or classes without task-specific examples or demonstrations, relying on prior learned knowledge and available task information.
What is one-shot learning a kind of?
One-shot learning is a kind of machine learning. Machine learning is a field of computational methods in which systems learn patterns or relationships from data to make predictions, decisions, or other outputs.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

