Prompt Engineering
This domain tests your ability to design, evaluate, and refine prompts for large language models (LLMs). It covers the major prompting techniques, control parameters, safety considerations, and output-formatting strategies used in production AI systems. At 22% of the exam, it is the single largest domain—expect roughly one in five questions to originate here. Questions test both conceptual recognition ("which technique is this?") and applied judgment ("given this requirement, which approach is correct?").
Zero-Shot Prompting
Zero-shot prompting means giving the model a direct instruction with no examples. The model relies entirely on pre-trained knowledge and the instruction itself.
Structure: [Instruction] + [Input]
Example:
Classify the sentiment of the following review as Positive, Negative, or Neutral.
Review: "The battery life is disappointing."
When to use it:
- Tasks the model handles well from training (translation, summarization, classification of common categories)
- When no labeled examples are available
- When latency and token cost must be minimized
| Characteristic | Zero-Shot | Few-Shot |
|---|---|---|
| Examples in prompt | None | 1–N |
| Token cost | Lowest | Higher |
| Output format control | Weak | Strong |
| Best for | Well-known tasks | Novel formats or edge tasks |
| Failure mode | Inconsistent format, wrong label set | Example bias, token overuse |
Common traps:
- Examiners may describe a prompt with only instructions and ask which technique it is—zero-shot, not "basic prompting."
- Zero-shot does NOT mean the model has no knowledge; it means the prompt contains no examples.
- Choosing zero-shot when the task requires a very specific output format is a common wrong-answer scenario—few-shot is better there.
Worked scenario: A developer needs to extract city names from unstructured text. The model keeps returning full sentences instead of just city names. The fix is not to use chain-of-thought—it is to switch to few-shot prompting to demonstrate the exact output format required.
Few-Shot Prompting
Few-shot prompting embeds one or more input–output examples in the prompt before the actual query. The model infers the task pattern from these demonstrations.
Structure: [Instruction (optional)] + [Example 1: Input → Output] + ... + [Example N: Input → Output] + [Actual Input]
One-shot = exactly 1 example. Few-shot = 2–N examples (typically 3–10).
Key principles:
- Examples must be representative of the range of inputs.
- Example format must match desired output format exactly.
- Order of examples can affect output; place the most relevant example last (recency bias in attention).
- Overly similar examples can cause the model to ignore edge cases (example bias).
| Number of Examples | Term | Use Case |
|---|---|---|
| 0 | Zero-shot | General tasks, cost-sensitive |
| 1 | One-shot | Quick format demonstration |
| 2–10 | Few-shot | Custom formats, classification with specific labels |
| Hundreds–thousands | Fine-tuning | Not a prompting technique—requires training |
Common traps:
- Few-shot is not fine-tuning. Fine-tuning updates model weights; few-shot does not.
- Adding more examples always helps—false. Beyond ~10 examples, gains plateau and token costs rise; poorly chosen examples hurt performance.
- "In-context learning" is the technical name for what few-shot prompting achieves—expect both terms on the exam.
Worked scenario: A company wants an LLM to output customer complaints in a structured Category | Severity | Summary pipe-delimited format. Zero-shot keeps returning prose. The correct approach is few-shot prompting with 3–5 examples showing the exact pipe-delimited format.
Sign in and enroll free to read the full guide
11 more sections (about 2,743 words) continue below. This course is free: enroll from the course page to unlock every guide.