Skip to main content
There are three fundamental techniques you can use when prompting LLMs. Understanding when and how to use each will help you craft more effective prompts.

Zero-shot Prompting

Zero-shot prompting means asking the model to perform a task without providing any examples. Since these models have been trained on massive datasets, their internal knowledge makes them capable of performing a large number of tasks without demonstrations. Think of it like: Asking a guitar player to play the piano, even though they’ve never played piano before. They’d apply their previous knowledge about music and instruments to figure it out. Example: Prompt:
Classify the text into the categories of satisfied, neutral or unsatisfied.

Text: I was happy with the customer support today.
Output:
Satisfied
When to use: Perfect for general tasks like classification, translation, and answering questions with established knowledge. Most prompts we use are, by default, zero-shot prompts.

Few-shot Prompting

Few-shot prompting means providing demonstrations of how to perform a task. Instead of relying only on the AI model’s general training, you give specific examples that guide the model to perform your exact task with higher quality. Think of it like: Showing a guitarist a few piano pieces before asking them to play piano for the first time. Example: Prompt:
I was happy with the customer support today - satisfied
The product is horrible! - very unsatisfied
This is one of the best products I have ever used - very satisfied
This is such a great product! -
Output:
Very Satisfied
When to use:
  • Complex or nuanced tasks where format matters
  • When you need consistent output structure
  • 3-4 examples typically work best
Important limitation: For complex reasoning tasks, few-shot prompting hits its limits. In those cases, combine it with chain-of-thought principles for better results.

Chain-of-Thought Prompting

Chain-of-thought prompting improves reasoning quality by forcing the model to externalize its thinking process, essentially making it “show its work.” This is especially useful for complex or edge-case problems where the model might otherwise hallucinate or produce logically inconsistent results. Three proven techniques:

1. Direct Step-by-Step Instructions

Add “Think step by step” to your prompt. This simple phrase triggers the model to break down complex problems into logical components rather than jumping to conclusions.

2. Provide a Logical Framework

Instead of hoping the model figures out the right approach, give it the exact framework to follow. This reduces reasoning errors by constraining the solution path. Example: Vague prompt:
Analyze the impact of climate change on polar bear populations.
Structured prompt:
Analyze the impact of climate change on polar bear populations using this framework:
1. Current polar bear population status
2. Climate change factors affecting Arctic habitat
3. Direct impacts (habitat loss, hunting changes)
4. Indirect impacts (food chain disruption)
5. Future population projections

3. XML Tags for Process Separation

Use <thinking></thinking> and <answer></answer> tags to separate reasoning from final output. This prevents the model from mixing its working process with the polished result, especially useful for complex multi-step problems. Learn more about XML tags here.

Quick Comparison

TechniqueBest ForComplexity
Zero-shotGeneral tasks, classification, translationSimple
Few-shotTasks requiring specific format or nuanced outputMedium
Chain-of-thoughtComplex reasoning, multi-step problemsAdvanced

Combining Techniques

You can combine these techniques for even better results:
  • Use few-shot examples with chain-of-thought instructions for complex reasoning tasks
  • Apply chain-of-thought principles to zero-shot prompts when dealing with edge cases
  • Structure few-shot examples using chain-of-thought frameworks for consistent reasoning