Testing with Generative AI study guide

Zero-Shot vs Few-Shot Prompting

In Generative AI testing, prompting is the primary interaction method. Zero-shot prompting provides no examples, expecting the model to rely on pre-trained knowledge. Few-shot prompting provides a few input-output examples to guide the model's logic and output format.

Practical example

Few-shot is critical in QA to stabilize an LLM's output format (e.g., forcing it to return strict JSON). If zero-shot fails to produce the desired structure, few-shot grounds the model by showing it exactly what success looks like.

Exam scenario and common trap

Scenario: A model fails to format its output as XML. The Trap: Assuming the model needs expensive fine-tuning. The Correct Answer: Implement Few-Shot prompting first. Providing 3 examples of the exact XML structure in the prompt is the standard fix.

Related syllabus sections cover this topic. Reference sections: 2.1.2. See the official ISTQB syllabus for exam scope. Examples are independent; QA-ace is not affiliated with ISTQB.