2.3 Prompt Engineering: Zero-Shot, Few-Shot, and Chain-of-Thought
Master in-context learning techniques to guide foundation models toward accurate, structured outputs without modifying model weights.
🎯 Key AWS AI Exam Takeaways
- Zero-Shot Prompting provides direct instructions with no prior demonstration examples.
- Few-Shot Prompting includes 2–5 exemplar input/output pairs to establish format and style.
- Chain-of-Thought (CoT) prompting instructs the model to reason step-by-step, dramatically boosting accuracy on complex logic.
Prompt engineering is the practice of crafting effective input instructions to guide foundation models toward desired responses. In Zero-Shot Prompting, the user presents the task instructions and target input directly, relying completely on the model's pre-trained parametric knowledge.
When zero-shot prompts fail to produce the required format or tone, Few-Shot Prompting introduces a small number of input-output exemplars directly into the prompt context. This in-context demonstration guides the model's structural syntax without requiring any gradient updates to model weights.
For multi-step mathematical, logical, or analytical deduction, Chain-of-Thought (CoT) prompting directs the model to 'think step-by-step'. By allocating output tokens to intermediate reasoning steps before declaring a final answer, the model avoids hasty statistical traps and significantly elevates reasoning accuracy.
⚠️ Common Pearson VUE Exam Traps
- Few-shot prompting does NOT fine-tune or permanently modify model weights; it operates entirely in runtime memory.
- Do not use chain-of-thought when low latency is the top priority, as extra reasoning tokens increase inference time.
Knowledge Checkpoint
A supply chain analyst needs an LLM to solve a complex multi-step routing optimization and inventory calculation problem. Previous direct prompts frequently yielded incorrect final answers. The analyst adds the phrase: 'Think through this step-by-step and show your reasoning before giving the final answer.' Which technique is being applied?