Zero-shot vs few-shot
- Zero-shot — just instructions, no examples. Try this first; modern models are strong zero-shot and it's cheapest.
- Few-shot — include a handful of input→output examples in the prompt. Use it when the task has a specific format, tone, or edge-case handling that's easier to show than describe. Examples are the highest-bandwidth way to convey "do it like this."
Few-shot guidance: use diverse, representative examples (including edge cases), keep formatting consistent across them (the model imitates the format precisely), and 3–5 is usually enough — more isn't always better and costs tokens.
Chain-of-thought (CoT)
For tasks needing reasoning (math, logic, multi-step analysis), asking the model to "think step by step" before answering improves accuracy — it allocates compute to intermediate steps instead of jumping to an answer. Modern reasoning models do this internally, but explicit CoT still helps non-reasoning models and gives you a visible reasoning trace.
Caveat: for simple, direct tasks CoT adds latency and cost for no benefit — reserve it for genuinely multi-step problems. And CoT reasoning is not always faithful (the stated reasoning may not be the real cause of the answer) — treat it as a helpful nudge, not a guarantee.
Structured output for reasoning
A strong pattern: have the model reason in a scratchpad, then emit the final answer separately (e.g. reasoning in a <thinking> block, answer in an <answer> block, or a structured-output field). You get the accuracy benefit of CoT while parsing only the clean final answer.