Skip to content

Bitcoin accepted at checkout  |  Ships from Laval, QC, Canada  |  Expert support since 2016

Few-Shot Prompting

Sovereign AI

Definition

Few-shot prompting is a technique in which you include a small number of worked examples — typically two to a handful — directly inside the prompt before posing the actual question. Each example pairs an input with its desired output, demonstrating the pattern you want. The model then generalises from those demonstrations to handle a new, unseen input, all without any change to its underlying weights. It is the prompt-engineering equivalent of showing rather than telling.

How it works

Because the examples live in the prompt rather than in training, few-shot prompting is a form of in-context learning: the model learns the task at inference time from the context window alone. A sentiment-classification prompt, for instance, might show three correctly labelled sentences (positive, negative, neutral) and then ask the model to label a fourth. Seeing the format and the decision boundary, the model usually produces output matching the demonstrated style. The quality of the examples matters more than their quantity: they should cover the tricky cases, not just the easy ones, use exactly the output format you want back, and stay consistent with each other — a stray inconsistency teaches the model the wrong lesson as efficiently as a good example teaches the right one. Example order can matter too, with models often weighting later examples more heavily.

When to use it

Few-shot prompting shines when a task is hard to describe in words but easy to show, or when you need output in a strict, machine-parseable format — JSON with particular fields, a fixed labelling scheme, a house style. It generally outperforms zero-shot prompting on such tasks, though not always: for very capable models on simple tasks, examples add token cost and latency without improving results. The minimal version, supplying exactly one example, is one-shot prompting. The main costs are context budget — every example consumes tokens on every single call — and the risk of overfitting the model to the examples' surface quirks rather than the underlying task. When a task outgrows what a handful of examples can teach, the next step up is fine-tuning, which bakes the pattern into the weights and frees the context window entirely.

Why it matters for local models

For sovereign Bitcoiners running smaller, self-hosted models through Ollama or llama.cpp, few-shot prompting is disproportionately valuable: a compact local model that struggles with a bare instruction often performs reliably once shown a few examples, closing much of the gap to larger hosted models on narrow tasks at zero incremental cost. The trade-off bites harder locally too — smaller context windows mean examples compete with the actual work for space — so the craft is choosing the two or three examples that earn their tokens. Build a small library of proven example sets for your recurring tasks and reuse them; it is the cheapest performance upgrade available to a local stack.

Crafting examples that earn their tokens

A short checklist covers most of the craft. Make every example airtight — the model will reproduce your mistakes with perfect fidelity. Match the output format exactly to what you want parsed downstream, including whitespace and field names. Cover the boundary cases: if a classifier must sometimes answer "none of the above," show it an example that does, or it never will. Keep examples mutually consistent in tone and format, and keep them representative — three examples of easy inputs teach nothing about the hard ones. Finally, re-test the set when you change models; examples tuned to one model's quirks can mislead another. Treat a proven example set like tested code: version it, reuse it, and change it deliberately.

Few-shot prompting is a foundational tool within broader prompt engineering practice, alongside the system prompt that frames every exchange.

In Simple Terms

Few-shot prompting is a technique in which you include a small number of worked examples — typically two to a handful — directly inside the…

Explore the Full Glossary

Browse all Bitcoin mining terms from A to Z. Whether you are a beginner or expert, deepen your understanding of the mining ecosystem.

Mining Glossary

ASIC Miner Database

Compare 500+ miners with real-time profitability data, home mining scores, and detailed specs.

Compare Miners