liveBook · Manning

Few-shot learning

Few-shot learning is the adaptation or performance of a model on a task using only a small number of task-specific examples.

How 18 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 in-prompt examples to guide language-model responses in a conversational task.
How deep it goes
Defines in-prompt learning and examines a chatbot failure, but does not provide a systematic few-shot prompting recipe.
Examples
Shows a number-sequence tutor approving 12 while identifying 10 as the next value.
What you can do after
Apply it via LangChain prompts, then evaluate generated answers against explicit task requirements.

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 a model toward a task-specific response pattern by placing several examples alongside the prompt’s instructions and input.
How deep it goes
Defines the technique, works through classification and an unsuccessful two-shot attempt, then shows LangChain implementation; does not explain model internals.
Examples
Uses divisibility-based number labels, a failed palindrome sum, research-assistant selection, and SQL prompts containing schema and sample records.
What you can do after
Apply it via LangChain’s FewShotPromptTemplate to keep examples separate from a reusable prompt, then test whether outputs follow the intended pattern.

Read how AI Agents and Applications 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 a few examples to elicit task-specific behavior from an LLM when extensive labeled data is unavailable.
How deep it goes
Works through a labeled sentiment prompt and discusses model-fit limits, but does not detail a few-shot training procedure.
Examples
Demonstrates positive-or-negative review labeling and examines mismatched examples in a coding copilot.
What you can do after
Apply it via few-shot prompting to specify a task and output format, then assess whether the examples suit the model.

Read how LLMs in Production 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
Guides a language model’s task or output format by placing a small set of examples in its prompt.
How deep it goes
Defines and illustrates example-based prompting and contrasts it with zero-shot prompting and fine-tuning, without specifying a fixed example count.
Examples
Uses paired English–Spanish translations and sample tool invocations to show how examples establish a pattern.
What you can do after
Apply it via prompts containing a few task examples, then check responses and refine the prompt.

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
Guides AI responses in web applications by supplying a few examples of the desired task behavior.
How deep it goes
Provides a prompt-building procedure and examples, but does not descend into model training internals.
Examples
Uses a programming-language list and customer-support exchanges for technical, billing, and general inquiries.
What you can do after
Apply it via JavaScript prompts to shape chatbot responses, then review outputs and adjust the examples or instructions.

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
Guides an LLM toward a task by placing a few input–output demonstrations before a new input.
How deep it goes
Explains inference-time conditioning and demonstration design without deriving the model mechanisms behind in-context learning.
Examples
Uses tweet sentiment labels, invented-word definitions, and temperature conversion to illustrate learning from examples.
What you can do after
Practice/perform it by supplying consistent, relevant input–output examples and testing their order and label balance.

Read how Generative AI in Action 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 transformers toward new tasks using a small number of task-specific examples.
How deep it goes
Defines the technique and works through a labeled prompt, but does not detail a training procedure.
Examples
Uses a positive-or-negative movie-review prompt and a SuperGLUE comparison across model sizes.
What you can do after
Apply it via few-shot prompting by placing labeled examples alongside a new input.

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 AI responses by demonstrating task patterns, variations, preferences, or presentation requirements.
How deep it goes
Explains the technique through multiple examples and temporary pattern learning without developing model internals.
Examples
Uses invented Halo and Lemon poetry styles, syllable and rhyme constraints, and a cat-themed generation task.
What you can do after
Apply few-shot prompting to generate new content that follows demonstrated patterns and customized preferences.

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 →

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 →

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 →

Related concepts

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.