A zero-shot prompt gives instructions only. A few-shot prompt adds a handful of input and output examples that demonstrate the pattern. Neither changes the model's weights.

How examples steer a fixed model

Prompt engineering (zero/few-shot)Diagram with these labels, in reading order: provides instruction; provides context; produces output; User Instruction; (Zero-shot); Few-shot Examples; (Input→Output); Model Processing; (In-context Learning); Generated Output; (Response).provides instructionprovides contextproduces outputUser Instruction(Zero-shot)Few-shot Examples(Input→Output)Model Processing(In-context Learning)Generated Output(Response)
Prompt Engineering Workflow

Few-shot prompting relies on in-context learning: the model adjusts to the pattern in the examples placed in front of it. If you want summaries, show a few source texts with their summaries. With a few well-chosen examples, the model picks up the format and the reasoning. Verbose or poorly chosen examples blur the pattern and produce irrelevant output.

Zero-shot relies on what the model learned in training. It fits well-defined tasks, such as basic question answering or common knowledge queries.

Because parameters stay fixed, iteration is quick. If summaries come back too long, change the examples or the instructions and test again.

In practice, a summarizer prompt with three source texts and their summaries can show the model the expected length, style and content more precisely than an instruction. Together the examples act as a specification of the output format.

Prompts as probabilistic configuration

A prompt works like configuration or a domain-specific language that sets runtime behavior. The analogy breaks on predictability. Prompts are natural language, so the same prompt can return different output on each run, and a small change in wording can change the response a lot. Logic in code behaves consistently. A prompt needs testing against the model's actual behavior, and that requires understanding both the phrasing and how the model interprets it.

Phrasing matters Subtle wording changes can shift model output significantly, so test every edit.

If your prompts stop giving satisfactory results, request volume is high, and you need low latency, fine-tuning is worth weighing. Until then, keep tuning the prompt, because that costs the least in time and development effort.

Try few-shot before fine-tuning

Fine-tuning retrains the model on a dataset. That takes data collection, compute and a slow deployment, and even a small adjustment has a long turnaround. Few-shot prompting often reaches acceptable results, and you can edit a prompt to cover a new edge case in minutes.

  • Zero-shot: straightforward tasks the model already handles.
  • Few-shot: specific formats, nuances or edge cases.
  • Fine-tuning: a last resort, once prompting is exhausted and you have high request volume or need low latency.

Example scenario: irrelevant outputs on a zero-shot prompt

Suppose 30% of outputs are irrelevant because the model misreads the intent. The figure is illustrative. Without examples, a zero-shot prompt depends on pretrained knowledge that may not match the task's nuances.

Prompt engineering (zero/few-shot)Diagram with these labels, in reading order: if unclear; if examples insufficient; assess output; if irrelevant; implement fix; Prompt Clarity Check; Zero-shot Instructions; Review; Few-shot Examples; Evaluation; Output Relevance; Assessment; Revise Prompt Structure; Test New Prompt.if unclearif examples insufficientassess outputassess outputif irrelevantimplement fixPrompt Clarity CheckZero-shot InstructionsReviewFew-shot ExamplesEvaluationOutput RelevanceAssessmentRevise Prompt StructureTest New Prompt
Debugging prompt engineering failures
  1. Check the prompt structure for clarity and specificity.
  2. Log outputs for a sample of inputs to find the common misclassifications.
  3. Test the zero-shot prompt against a few-shot version with different example sets.

Adding relevant examples improves accuracy and makes the prompt longer. Monitor accuracy metrics and user feedback on the results.

Back to the knowledge baseRequest an assessment