Menu

Glossary

Few-Shot Learning

Few-shot learning is a technique where a language model performs a task from a handful of labeled examples placed directly in the prompt, with no retraining. In commercial real estate document extraction, a few sample clauses paired with their correct field values teach the model to pull the same fields from a new lease or offering memorandum.

How Few-Shot Learning Works

Few-shot learning is the middle mode on a spectrum of three ways to direct a model: zero-shot, few-shot, and fine-tuning. Zero-shot gives the model only an instruction. Few-shot adds a small set of worked examples inside the prompt. Fine-tuning instead retrains the model's weights on a labeled dataset before any prompt is sent.

The term was defined by Tom Brown and colleagues at OpenAI in "Language Models are Few-Shot Learners" (Brown et al., NeurIPS 2020), the paper that introduced GPT-3, a 175-billion-parameter model. The authors tested three conditions: zero-shot with no demonstrations, one-shot with a single demonstration, and few-shot with 10 to 100 demonstrations placed in the context window. They reported that few-shot prompting consistently beat zero-shot, and that larger models made better use of the in-context examples.

The examples never change the model. They sit in the prompt as a pattern the model imitates, which is why the method is also called in-context learning. For a lease-field extraction task, the pattern is a set of clause-to-value pairs.

Element

Role in the prompt

Instruction

States the task, such as "extract the base rent"

Demonstrations

Two to five clause snippets with their correct field values

Query

The new clause to extract from

Completion

The model returns the value in the demonstrated format

Why Few-Shot Learning Matters

Few-shot learning matters because it turns a general model into a task-specific extractor in minutes, with no labeled dataset and no training run. A team abstracting a new lease type can write three example clauses, drop them in the prompt, and get structured output the same afternoon. Building a fine-tuned model for the same task would need hundreds to thousands of labeled samples first.

The trade-off is a ceiling. Because the examples live in a finite context window, only a handful fit, and the model learns the pattern shallowly rather than from many labeled cases. Brown et al. showed few-shot performance rising with model size and example count, yet on many tasks a fine-tuned smaller model still matched or exceeded it. As a working rule, few-shot learning is the fastest way to a usable extractor and the slowest way to the last few points of accuracy.

Example

Few-shot learning is clearest when the same CRE extraction task is run three ways. An asset manager needs the annual base rent pulled from a batch of retail leases, each phrasing the figure differently. The table below uses representative ranges, not measured benchmarks, to show the trade-off between accuracy and setup cost.

Approach

Setup cost

Typical accuracy (illustrative)

Zero-shot

One instruction, minutes

Lower; format drifts on odd phrasings

Few-shot

Three example clauses, an hour

Higher; matches the demonstrated format

Fine-tuned

Hundreds of labeled leases, days to weeks

Highest on the trained clause types

Zero-shot returns "$612,000" on some leases and "six hundred twelve thousand" or a monthly figure on others, because nothing pins the format. Few-shot adds three demonstrations that each map a clause to a clean annual dollar value, so the model returns "$612,000" consistently. Fine-tuning can push accuracy higher on the exact clause language it trained on, but only after someone labels the training set. For a first pass across a new document type, few-shot reaches a working result far faster.

Variations and Edge Cases

Few-shot learning is a family of prompting choices, not a single recipe. How many examples are shown, how they are ordered, and how representative they are all move accuracy. The variants below cover the common cases in document extraction.

Variant

Behavior

One-shot

A single demonstration; fixes format but not edge cases

Zero-shot

No demonstrations; fastest, least reliable on odd phrasing

Example selection

Demonstrations chosen to resemble the target clause raise accuracy

Order sensitivity

Reordering the same examples can shift the output

Context limit

Too many demonstrations crowd out the document being extracted

Few-Shot Learning vs Fine-Tuning

Few-shot learning is often confused with fine-tuning, and the difference is where the learning lives. Few-shot learning is a prompt technique: the examples sit in the context window at query time and the model's weights never change, so a new clause type is handled the moment you write examples for it. Fine-tuning is a training technique: it updates the model's weights on a labeled dataset, so a new clause type requires collecting data and running training again.

Few-shot suits fast coverage of many document types with no dataset. Fine-tuning suits a stable, high-volume task where the last points of accuracy justify the labeling effort. Many extraction pipelines start few-shot and fine-tune only the fields that reach production scale.

Frequently Asked Questions

What is few-shot learning in simple terms? Few-shot learning is a method where an AI model learns a task from a few examples written into the prompt, with no retraining. It shows the model two to five worked cases, then asks it to handle a new one in the same pattern.

How many examples does few-shot learning need? There is no fixed number, but few-shot typically means a small handful. In the GPT-3 paper, Brown et al. defined the few-shot condition as 10 to 100 demonstrations in the context window, while one-shot uses a single example and zero-shot uses none.

Is few-shot learning better than fine-tuning for lease extraction? It depends on scale. Few-shot learning is faster to deploy and needs no labeled dataset, which suits new or low-volume document types. Fine-tuning can reach higher accuracy on a stable, high-volume task, but only after someone labels the training data.

Related Terms

Get Started

Upload your lease documents. Rets AI does the rest.

Get Started

Upload your lease documents. Rets AI does the rest.