Unlock the full potential of large language models (LLMs) by mastering three core prompt engineering strategies: zero-shot, one-shot, and few-shot prompting. Each technique offers a different balance between simplicity and control, helping you guide an LLM toward your exact needs.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Prompt Engineering Techniques Overview
- Zero-Shot Prompting: Direct instruction, no examples.
- One-Shot Prompting: Single example to illustrate format or style.
- Few-Shot Prompting: Multiple examples demonstrating the pattern.
| Technique | Definition | Example Task |
|---|---|---|
| Zero-Shot | Direct instruction without examples. | Summarize this article in 100 words. |
| One-Shot | One sample input–output pair. | Example: “Hello → Hola”. Then translate “Hi”. |
| Few-Shot | Several input–output pairs in prompt. | Classifying animals by description. |
Choose zero-shot for quick tasks, one-shot when you need consistent formatting with minimal context, and few-shot for complex patterns or strict constraints.
1. Zero-Shot Prompting


- Translate a sentence from English to French.
- Summarize this article in 100 words.
- Answer: “What is the capital of Japan?”
- Write a Python function to reverse a string.

Zero-shot is fast to set up but may require more precise wording for specialized or nuanced tasks.
2. One-Shot Prompting

- Write a short story about a detective solving a mystery.
- Describe symptoms and treatments for seasonal allergies.
- Provide steps to make a classic margherita pizza.

3. Few-Shot Prompting

Including many examples can increase token usage and latency. Keep your prompt concise to stay within model limits.