Zero-shot learning
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.
Build AI Drug Discovery Pipelines
Zero-shot transfer is the application of a model to a task or modality without task-specific labeled examples for that application.
- How it is used
- Uses pretrained protein models to screen mutation effects and therapeutic candidates without further training.
- How deep it goes
- Explains masked-position probability comparisons and log-odds scoring, without providing a complete mutation-scoring implementation.
- Examples
- Illustrates an alanine-to-cysteine substitution at position 42 and a predicted mutation landscape.
- What you can do after
- Evaluate mutation plausibility to prioritize variants for laboratory testing.
Read how Build AI Drug Discovery Pipelines explains zero-shot learning →
Introduction to Generative AI, Second Edition
Zero-shot learning is performing a task without task-specific labeled examples or demonstrations.
- How it is used
- Introduces zero-shot prompting as a way to request a task directly without demonstrations.
- How deep it goes
- Defines zero-shot and few-shot prompting and illustrates their differences without implementation details.
- Examples
- Illustrates menu classification and describes DetectGPT for detecting machine-generated text.
- What you can do after
- Apply it via ChatGPT to classify menu items without providing demonstrations.
Read how Introduction to Generative AI, Second Edition explains zero-shot learning →
Starting Data Analytics with Generative AI and Python
A zero-shot learning model performs a task or makes predictions for categories without task-specific examples for those categories during inference.
- How it is used
- Uses zero-shot learning to classify sentiment when task-specific labeled data is scarce.
- How deep it goes
- Demonstrates a classification pipeline and evaluation, without detailing the model’s internal mechanisms.
- Examples
- Classifies Portuguese reviews as positive or negative and compares results with review scores and alternative sentiment methods.
- What you can do after
- Apply it via Hugging Face Transformers to filter reviews by predicted sentiment and compare performance against a reference.
Read how Starting Data Analytics with Generative AI and Python explains zero-shot learning →
Sutskever's List
A zero-shot setting evaluates a model on a task or query without providing task-specific examples in the input.
- How it is used
- Tests what a language model can do without task-specific training or examples, while exposing failures on unfamiliar query forms.
- How deep it goes
- Illustrates the setting through GPT-2 tasks and a GPT-4 reversal probe, without specifying metrics or a formal evaluation protocol.
- Examples
- Uses headline-to-article generation, reading comprehension, and opposite-direction questions about Tom Cruise’s mother.
- What you can do after
- Evaluate/understand zero-shot claims by separating an answer given without a prompt demonstration from one enabled by a supplied fact.
Retrieval Augmented Generation, The Foundational Ideas
Zero-shot retrieval is retrieval performed without relevance-labeled examples or task-specific fine-tuning of the retriever.
- How it is used
- Addresses query–document mismatch in retrieval-augmented generation when relevant documents are missed or ranked too low.
- How deep it goes
- Works through HyDE’s generate–embed–search procedure and an implementation sketch, while leaving broader pipeline integration beyond the simplified code.
- Examples
- Uses a missed deployment document, a LangChain embedding example and benchmark comparisons with BM25, Contriever and supervised dense retrieval.
- What you can do after
- Apply it via LangChain’s HypotheticalDocumentEmbedder and evaluate its retrieval gains against the extra LLM call and wrong-framing risk.
Read how Retrieval Augmented Generation, The Foundational Ideas explains zero-shot learning →
LLMs in Production
A learning or inference setting in which a model performs a task without being given task-specific examples.
- How it is used
- Deploys large language models for specialized tasks through simple prompts instead of task-specific fine-tuning.
- How deep it goes
- Defines zero-shot prompting and contrasts it with one-shot and few-shot prompting, but does not detail implementation procedures.
- Examples
- Uses specialized tasks performed through simple prompts and highlights unintended outputs from generative models.
- What you can do after
- Evaluate/understand when a language model can attempt a novel task without labeled examples or fine-tuning.
Knowledge Graphs and LLMs in Action
Zero-shot learning is performing a task without task-specific examples, relying on a task description and pretrained knowledge.
- How it is used
- Uses task descriptions to extract domain-specific knowledge from unstructured data without supplying task examples.
- How deep it goes
- Defines the technique and gives an iterative validation workflow, but stops short of implementation details or formal analysis.
- Examples
- Uses contextual interpretation of titles and organizations, plus mini-knowledge-graph inspection, as practical extraction examples.
- What you can do after
- Apply it via prompt engineering, inspect intermediate knowledge graphs, and recognize when fine-tuning is preferable.
Read how Knowledge Graphs and LLMs in Action explains zero-shot learning →
Generative AI in Action
Zero-shot learning is the ability to perform a task or recognize classes not directly represented in task-specific training examples by relying on broader learned associations or descriptions.
- How it is used
- Adapts language and vision models to new tasks through instructions, semantic associations, or text-image representations without task-specific examples.
- How deep it goes
- Explains generalization mechanisms, contrasts few-shot and transfer learning, and demonstrates an API call without mathematical derivation or model internals.
- Examples
- Uses English-to-German translation, Spanish translation through Azure OpenAI, and CLIP image labeling from natural-language class names.
- What you can do after
- Apply it via an instruction prompt or CLIP-style text-image comparison when suitable task examples or fine-tuning resources are unavailable.
Read how Generative AI in Action explains zero-shot learning →
Hugging Face in Action
Zero-shot classification is the assignment of labels to inputs without task-specific labeled examples during model adaptation or inference.
- How it is used
- Applies pretrained models to classify new text or images against user-supplied labels without task-specific labeled examples.
- How deep it goes
- Explains the distinction from one-shot learning and demonstrates high-level pipeline calls, stopping short of model internals.
- Examples
- Demonstrates politics-oriented paragraph classification and airplane recognition using candidate labels.
- What you can do after
- Apply zero-shot text or image classification through Hugging Face Transformers pipelines and inspect returned scores.
Read how Hugging Face in Action explains zero-shot learning →
Transformers in Action
Zero-shot learning is the ability to perform a task or recognize classes without task-specific examples during adaptation or inference.
- How it is used
- Deploys pretrained transformers on unseen tasks without task-specific retraining or examples.
- How deep it goes
- Defines generalization beyond training and contrasts few-shot learning, but stops short of implementation procedures or model internals.
- What you can do after
- Evaluate whether pretrained-model generalization can replace task-specific training while accounting for domain and deployment constraints.
Read how Transformers in Action explains zero-shot learning →
Build a Large Language Model (From Scratch)
A learning setup where a model handles a task without having seen any task-specific examples beforehand.
- How it is used
- Frames GPT text completion as a way to perform unseen tasks without task-specific examples or model changes.
- How deep it goes
- Defines generalization to unseen tasks and contrasts few-shot prompting, but does not explain internal mechanisms.
- Examples
- Uses translation, summarization, fiction writing, and computer-code generation as examples of GPT capabilities.
- What you can do after
- Evaluate how GPT-like models can perform tasks from instructions alone, without retraining or task-specific examples.
Read how Build a Large Language Model (From Scratch) explains zero-shot learning →
Reinforcement Learning from Human Feedback
Zero-shot evaluation measures a model on questions or tasks without providing task-specific examples in the prompt.
- How it is used
- Evaluates instruction-tuned models on unseen questions without task-specific demonstrations, approximating open-ended usage.
- How deep it goes
- Defines the evaluation setup and motivation, but stops short of detailing implementation beyond sampling and exact-match terminology.
- Examples
- Uses an unanswered capital-of-France prompt and contrasts generation sampling with temperature-zero multiple-choice evaluation.
- What you can do after
- Evaluate model generalization on unseen questions without supplying task-specific prompt examples.
Read how Reinforcement Learning from Human Feedback explains zero-shot learning →
Also covered in
- Machine Learning System Design
- Data Analysis with LLMs
- The Complete Obsolete Guide to Generative AI
- AI Agents in Action
- Grokking AI Algorithms, Second Edition
- AI Agents and Applications
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.
- 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.
- BERTBERT (Bidirectional Encoder Representations from Transformers) is a pretrained Transformer encoder language model that produces contextual text representations using information from both directions.
- natural language processingNatural language processing is the field of computing concerned with computational methods for analyzing, interpreting, transforming, and generating human language in text or speech.
Related concepts
- few-shot learningcontrasts with · 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.
- 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.
- DetectGPTincludes · DetectGPT is a zero-shot method for detecting machine-generated text by analyzing changes in language-model likelihoods under perturbations.
- NLIuses · Natural language inference is the task of determining whether a hypothesis is entailed by, contradicts, or is neutral with respect to a premise expressed in natural language.
- one-shot learningcontrasts with · One-shot learning is a machine-learning setting in which a system learns or adapts to perform a task from a single example.
- pretraininguses · Pretraining is the initial training of a model on broad data to learn general patterns or capabilities before adaptation to specific tasks or domains.
Questions about zero-shot learning
What is zero-shot learning?
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.
Which Manning books explain zero-shot learning?
Build AI Drug Discovery Pipelines, Introduction to Generative AI, Second Edition, Starting Data Analytics with Generative AI and Python, Sutskever's List, Retrieval Augmented Generation, The Foundational Ideas, LLMs in Production, Knowledge Graphs and LLMs in Action, Generative AI in Action and 4 more.
What should I know before learning zero-shot learning?
Manning books that teach zero-shot learning usually introduce language model, fine-tuning, BERT and natural language processing first.
What is the difference between zero-shot learning and few-shot learning?
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 learning is an approach in which a model is guided to perform or adapt to a task from only a small number of examples.
What kinds of zero-shot learning are there?
Kinds of zero-shot learning include DetectGPT.
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.











