liveBook · Manning

Few-shot learning

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.

How 24 Manning books explain it

Software Testing with Generative AI

Few-shot prompting is a prompting technique that supplies a small number of explicit examples to clarify instructions and guide a generative model's output.

How it is used
Guides LLMs toward usable test charters, questions, code risks, test data, and bug-investigation ideas.
How deep it goes
Demonstrates prompt construction, examples, delimiters, context, and result review but stops short of guaranteeing correct outputs.
Examples
Uses booking-date charters, user-story questions, code-risk reports, SQL records, and report-calendar test ideas.
What you can do after
Apply it via prompts to elicit consistently formatted testing artifacts and then evaluate, refine, or discard the results.

Read how Software Testing with Generative AI explains few-shot learning →

Natural Language Processing in Action, Second Edition

Few-shot learning is adapting a model to perform a task from a small number of examples supplied at inference time, often in the prompt.

How it is used
Uses few-shot learning to steer a language model’s behavior from examples supplied in a conversational prompt.
How deep it goes
Defines prompt-contained examples and examines a tutoring failure without explaining the learning mechanism.
Examples
Examines a math tutor that incorrectly approves 12 as the next answer after 2, 4, 6, 8.
What you can do after
Evaluate and understand few-shot responses by testing repeatedly and scoring them against application goals.

Read how Natural Language Processing in Action, Second Edition explains few-shot learning →

AI Agents and Applications

Prompt examples are illustrative instances supplied in a prompt to guide a language model toward a desired task behavior or output pattern.

How it is used
Guides language models toward task behavior and output patterns using examples embedded in prompts.
How deep it goes
Demonstrates examples, prompt structure, and LangChain implementation, then contrasts successful classification with an incorrect two-shot response.
Examples
Uses number classification, palindrome summation, research-assistant selection, and table schemas with sample records.
What you can do after
Apply it via LangChain’s FewShotPromptTemplate to separate examples from their formatting and prompt structure.

Read how AI Agents and Applications explains few-shot learning →

Build an Advanced RAG Application (From Scratch)

Few-shot learning is adapting a model's behavior to a task by providing a small number of examples in its input context.

How it is used
Guides language-model responses toward desired formats and contextually relevant patterns through prompt examples.
How deep it goes
Defines few-shot prompting, contrasts it with zero-shot prompting, and demonstrates a runnable hotel-response prompt.
Examples
Demonstrates New York, Tokyo, and Paris hotel descriptions to establish and continue a response pattern.
What you can do after
Apply it via prompt examples to elicit structured, contextually relevant responses for a specific use case.

Read how Build an Advanced RAG Application (From Scratch) explains few-shot learning →

Effective Conversational AI

Few-shot prompting is the practice of providing a language model with a small number of example demonstrations in a prompt to guide its response.

How it is used
Guides language-model outputs toward desired utterances, formats, or conversation summaries by placing demonstrations in the prompt.
How deep it goes
Defines shot counts and works through prompting examples, while emphasizing output review rather than model internals.
Examples
Shows login utterance demonstrations, a password-fragment cue, and an example summary for human-agent handoff.
What you can do after
Practice/perform example-led prompting, refine generated utterances, and measure whether augmented intent data improves chatbot accuracy.

Read how Effective Conversational AI explains few-shot learning →

LLMs in Production

Few-shot learning is the adaptation or prediction of a model from only a small number of labeled examples.

How it is used
Uses few-shot prompting to adapt language-model behavior when labeled examples are scarce or fine-tuning is undesirable.
How deep it goes
Defines few-shot prompting, works through sentiment classification, and discusses its limitations in a coding copilot.
Examples
Uses labeled review sentiment and a coding copilot with plain-English instruction examples.
What you can do after
Evaluate few-shot prompts for sentiment classification and coding assistance, including their fit with a model’s training.

Read how LLMs in Production explains few-shot learning →

Retrieval Augmented Generation, The Foundational Ideas

Few-shot prompting conditions a model with a small set of input-output examples that demonstrate the desired task or format.

How it is used
Frames task adaptation with few examples, both as prompt demonstrations and as limited labeled data for RAG fine-tuning.
How deep it goes
Defines prompt-based N-shot learning, then gives architectural and fine-tuning guidance for low-data RAG without deriving training objectives.
Examples
Uses two English-to-French demonstrations, a 64-example question-answering comparison, and corpus-specific summarization prompts.
What you can do after
Apply it via prompting for task demonstrations, or evaluate RAG fine-tuning choices when only a small labeled set is available.

Read how Retrieval Augmented Generation, The Foundational Ideas explains few-shot learning →

Introduction to Generative AI, Second Edition

Few-shot prompting is a technique that guides a model by providing a small number of task-specific examples in the input.

How it is used
Uses few-shot prompting to guide task formats and structured tool calls through examples in the input.
How deep it goes
Defines few-shot prompting and compares it with zero-shot prompting and fine-tuning, without implementation-level detail.
Examples
Illustrates translation with English–Spanish example pairs and describes system prompts demonstrating tool invocations.
What you can do after
Practice few-shot prompting by supplying examples and refining prompts based on model responses.

Read how Introduction to Generative AI, Second Edition explains few-shot learning →

Build AI-Enhanced Web Apps

Few-shot learning is a technique in which a model performs or adapts to a task by inferring the desired behavior from a small number of examples.

How it is used
Uses example-guided prompts to adapt model responses to tasks in web applications without model fine-tuning.
How deep it goes
Provides a prompt-construction procedure and compares few-shot prompting with zero-shot learning and fine-tuning.
Examples
Demonstrates a programming-language list and customer-support interactions for technical, billing, and general inquiries.
What you can do after
Practice constructing and refining example-guided prompts for new user requests.

Read how Build AI-Enhanced Web Apps explains few-shot learning →

Generative AI in Action

Few-shot learning is the adaptation of a model to a task by providing a small number of task-specific examples at use time.

How it is used
Uses a small set of task examples to guide a model’s response to a new input.
How deep it goes
Explains inference-time conditioning and demonstration design, while noting that the reason in-context learning works is not fully known.
Examples
Illustrates sentiment labeling, Celsius-to-Fahrenheit conversion, and defining invented words from demonstrations.
What you can do after
Apply few-shot prompting by supplying input-output demonstrations and testing their selection and order.

Read how Generative AI in Action explains few-shot learning →

Building Specialized AI Systems

Few-shot learning is the ability to perform a new task from a small number of examples provided at inference time.

How it is used
Guides new task behavior from a few prompt examples when training data is limited, including alongside retrieval for knowledge access.
How deep it goes
Defines inference-time adaptation through prompt examples and contrasts it with parameter-updating fine-tuning, but omits implementation procedure.
Examples
Uses prompt-provided examples and combines them with retrieved information in limited-data RAG workflows.
What you can do after
Apply it via carefully crafted examples to guide model behavior without full parameter updates when data is limited.

Read how Building Specialized AI Systems explains few-shot learning →

The Art of AI Product Development

Few-shot prompting is prompting a model with a small number of input-output examples to guide its behavior on a new input.

How it is used
Improves difficult or underperforming tasks by steering models with demonstrations, after simpler zero-shot prompting proves insufficient.
How deep it goes
Explains demonstrations, curation, retrieval, and trade-offs, while stopping short of detailed model internals.
Examples
Uses sentiment classification, LinkedIn webinar announcements, product descriptions, and question answering to demonstrate examples and retrieval.
What you can do after
Apply few-shot prompting by curating, formatting, and retrieving relevant demonstrations for new inputs.

Read how The Art of AI Product Development explains few-shot learning →

Data Analysis with LLMs

Few-shot learning is an approach in which a model infers a task from a small number of examples specifying inputs and desired outputs.

How it is used
Improves task performance by placing a few correctly solved examples inside a prompt.
How deep it goes
Explains example selection, prompt structure, Python construction, and evaluation, without discussing model internals.
Examples
Uses car detection with binary labels and movie-review sentiment classification with positive and negative labels.
What you can do after
Apply it by constructing example-based prompts with explicit instructions, labels, and output formats.

Read how Data Analysis with LLMs explains few-shot learning →

Time Series Forecasting Using Foundation Models

A few-shot prompt is a model input that includes a small number of examples to demonstrate the desired task or output behavior.

How it is used
Guides general-purpose language models toward forecasting or anomaly-detection behavior through demonstrated inputs and outputs.
How deep it goes
Explains prompt construction and embeds it in preprocessing and output-parsing functions, but does not establish broad model superiority.
Examples
Uses numerical sequence forecasts and binary anomaly labels as concrete demonstrations.
What you can do after
Apply it via prompt templates and forecasting functions that produce more consistently parseable LLM outputs.

Read how Time Series Forecasting Using Foundation Models explains few-shot learning →

The Complete Obsolete Guide to Generative AI

Few-shot learning is adapting a model to a task by conditioning it on a small number of task-specific examples or demonstrations.

How it is used
Guides language models toward a desired task, format, or style by placing examples in prompts.
How deep it goes
Defines few-shot learning, contrasts it with zero-shot prompting, and illustrates prompting examples while naming meta-learning and metric-based methods without detailing them.
Examples
Uses English-to-French translation pairs, article-summary demonstrations, and a dialogue-writing prompt comparison.
What you can do after
Apply it via prompts by supplying a few representative demonstrations before a new task input.

Read how The Complete Obsolete Guide to Generative AI explains few-shot learning →

Transformers in Action

Few-shot learning is the adaptation of a model to a new task using only a small number of task-specific examples.

How it is used
Guides pretrained language models on new tasks using a small set of task-specific examples.
How deep it goes
Explains example-based prompting through a classification prompt and points to more advanced techniques for reasoning tasks.
Examples
Uses labeled movie-review snippets to classify the sentiment of “The movie was not bad.”
What you can do after
Apply few-shot prompting by supplying a task instruction, target input, labels, and labeled examples.

Read how Transformers in Action explains few-shot learning →

Learn Generative AI with PyTorch

A prompting approach that provides exactly one example to condition a large language model on the task.

How it is used
Uses multiple labeled examples to condition large language models for classification and other task-specific responses.
How deep it goes
Explains prompting distinctions, formatting, and a sentiment example, but does not descend into model internals.
Examples
Demonstrates sentiment labels, movie reviews, consistent separators, and a runnable LLM invocation.
What you can do after
Apply it via a structured prompt to classify new text according to demonstrated examples.

Read how Learn Generative AI with PyTorch explains few-shot learning →

AI for Everyday IT

Few-shot prompting is a technique that supplies an AI model with a small number of examples in the prompt to guide its behavior on a task.

How it is used
Guides an AI model by supplying several examples that demonstrate desired patterns and variations.
How deep it goes
Defines the technique and demonstrates it with an exercise using two invented poetry styles.
Examples
Uses Halo and Lemon, invented poetry styles with distinct structures, in a prompt about Mittens the pizza-loving cat.
What you can do after
Practice tailoring generated poems by providing style examples and requesting new poems that follow them.

Read how AI for Everyday IT explains few-shot learning →

Build a Large Language Model (From Scratch)

The ability to learn a new task from only a few examples rather than extensive training data.

How it is used
Uses a pretrained GPT-like model to infer and perform new tasks from a few examples included in the input.
How deep it goes
Defines few-shot and contrasts it with zero-shot learning, but stops short of prompt construction or implementation details.
Examples
Uses target examples embedded in an input prompt and contrasts them with example-free zero-shot inputs.
What you can do after
Apply it via GPT-like LLM inputs that provide a few task examples without retraining or changing model architecture.

Read how Build a Large Language Model (From Scratch) explains few-shot learning →

Understanding AI

Few-shot prompting is a prompting technique in which a model receives multiple examples before performing a task.

How it is used
Uses multiple demonstrations to guide a language model toward a particular format, style, classification pattern, or level of consistency.
How deep it goes
Explains the technique through definition, comparison, use cases, and one worked classification example, without covering underlying model internals.
Examples
Demonstrates sentiment labels for vehicle reviews and contrasts task-only, single-example, and multiple-example prompts.
What you can do after
Apply it via prompt examples to improve consistency when instructions alone leave format, style, or classification ambiguous.

Read how Understanding AI explains few-shot learning →

AI Agents in Action

A few-shot model is a model that can learn or identify a target category from a small number of examples.

How it is used
Uses a few examples in an LLM prompt to guide its handling of unfamiliar patterns or content.
How deep it goes
Defines zero-, one-, and few-shot learning, then demonstrates a prompt template and embedding-similarity evaluation workflow.
Examples
Uses invented words in example sentences and proposes comparing prompts through scientific-article summaries.
What you can do after
Apply few-shot prompting in a prompt_flow workflow and compare predicted and expected outputs using embedding similarity.

Read how AI Agents in Action explains few-shot learning →

Sutskever's List

A learning or prompting approach in which a model performs a task from a small number of examples supplied during evaluation or adaptation.

How it is used
Uses a small number of examples to guide task performance without task-specific fine-tuning.
How deep it goes
Connects few-shot learning to reasoning scaffolds but does not detail how to construct or select examples.
What you can do after
Apply few-shot learning to scaffold reasoning, while recognizing that performance remains brittle when rules change.

Read how Sutskever's List explains few-shot learning →

Enterprise RAG

Few-shot learning is adaptation of a model's behavior from a small number of examples provided as part of an input.

How it is used
Uses miniature examples during prompt tuning to correct model behavior after retrieval succeeds but the answer remains wrong.
How deep it goes
Explains example placement, prompt shortening, and feedback reuse, but stops short of model-training internals.
Examples
Demonstrates a metric-units requirement with a user question and an assistant answer about product weight.
What you can do after
Apply it via prompt tuning by converting recurring user complaints into concise input-output examples.

Read how Enterprise RAG explains few-shot learning →

Deep Learning with R, Third Edition

Few-shot learning is adapting or directing a model to perform a task from only a small number of examples.

How it is used
Teaches models new tasks through a few prompted demonstrations rather than task-specific fine-tuning.
How deep it goes
Defines prompted learning and contrasts it with gradient descent, but stops short of implementation details or formal analysis.
Examples
Uses English-to-French translation demonstrations for sea otter, peppermint, plush giraffe, and cheese.
What you can do after
Apply it via prompting by supplying a few task examples and requesting the corresponding output.

Read how Deep Learning with R, Third Edition explains few-shot learning →

Also covered in

What to know first

Related concepts

Questions about few-shot learning

What is few-shot learning?

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.

Which Manning books explain few-shot learning?

Software Testing with Generative AI, Natural Language Processing in Action, Second Edition, AI Agents and Applications, Build an Advanced RAG Application (From Scratch), Effective Conversational AI, LLMs in Production, Retrieval Augmented Generation, The Foundational Ideas, Introduction to Generative AI, Second Edition and 16 more.

What should I know before learning few-shot learning?

Manning books that teach few-shot learning usually introduce language model, prompt, fine-tuning and token first.

What is the difference between few-shot learning and zero-shot learning?

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. 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 few-shot learning a kind of?

Few-shot learning is a kind of in-context learning. In-context learning is a model’s adaptation of its behavior to examples, instructions, or other information in its input context without updating its parameters.

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.