4.4.6 · D3Alignment, Prompting & RAG

Worked examples — Zero-shot and few-shot prompting

2,546 words12 min readBack to topic

Building the one tool we will reuse: a toy probability model

Before any example, we earn the one piece of maths this page leans on.

Figure — Zero-shot and few-shot prompting

We will score a prompt by one number: , the probability the model assigns to the right answer token. Higher is better. That's the whole measuring stick.

Everything below is: set up the buckets, see where the water goes, pick the winner.


The scenario matrix

Every prompting decision falls into one of these cells. The examples afterwards each hit at least one.

# Cell (scenario class) The stress it puts on the prompt
A Zero-shot, common task Is instruction alone enough? (baseline)
B Zero-shot fails on format Right idea, wrong shape of output
C Few-shot fixes format Demos teach the schema
D Rare / novel label Label never named in pretraining
E Label imbalance in demos Demos bias toward majority label
F Diminishing returns (big ) Accuracy plateaus vs token cost
G Degenerate: vs jump The very first example's leverage
H Limiting case: context window overflow Too many shots don't fit
I Real-world word problem Cost/accuracy trade under a budget
J Exam-style twist Corrupted labels — do demos still help?

The worked examples


Figure — Zero-shot and few-shot prompting



Figure — Zero-shot and few-shot prompting




Recall Rapid self-check

In Example 2, what made zero-shot's wrong? ::: the The bucket (a sentence-start, i.e. wrong format) held the most water, not a wrong idea. In Example 4, why did adding examples hurt? ::: 4-vs-1 label imbalance taught a skewed label-prior, so the model copied the majority label. In Example 6, why floor the division? ::: a partial demo can't be included; only whole demos fit. In Example 5, roughly where do returns flatten? ::: around to ; per-token gain collapses after that. In Example 8, what part of the gain survives random labels? ::: the format / label-space / input-distribution part ( of ).


Connections

Concept Map

yes

no

format

rare label

Task query

Zero-shot works

Use zero-shot cheap

Why it fails

Add demos to fix shape

One demo names label

Balance demo labels

Pick small k

Check context window

Price token vs error cost