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 19 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 →

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 →

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
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
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 →

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 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 →

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 →

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.