Home Tutorials Prompt Engineering Module 3: Basic Prompting Techniques
Module 3: Basic Prompting Techniques

Module 3: Basic Prompting Techniques


📘 Module 3: Basic Prompting Techniques

How much guidance does an AI need? Depending on the complexity of your task, you can use different prompting techniques to guide the AI’s reasoning and format. Let’s explore the four fundamental techniques.


Technique 1: Zero-Shot Prompting

Definition: Asking the AI to perform a task straight away without providing any examples.

Best for: Common, straightforward tasks like standard translations, summaries, or general knowledge questions.


Prompt: "Translate this sentence to French: Hello, how are you?"
Output: "Bonjour, comment allez-vous?"
            

Technique 2: One-Shot Prompting

Definition: Giving the AI exactly one example of the desired format or logic before asking it to complete the final task.

Best for: Setting a specific syntax or pattern without overloading the prompt context.


Example: 
Cat → Chat
Dog → Chien

Prompt: "Complete the pattern: Bird → ?"
Output: "Oiseau"
            

Technique 3: Few-Shot Prompting

Definition: Providing a small cluster of examples (typically 2 to 5) to show patterns, nuances, or highly specific classification categories.

Best for: Sentiment analysis, custom tone matching, classification tasks, and nuanced data parsing.


Examples:
Positive: "I love this product!" → Sentiment: Positive
Negative: "This is terrible" → Sentiment: Negative
Neutral: "It's okay" → Sentiment: Neutral

Prompt: "What's the sentiment? 'Absolutely amazing experience!'"
Output: "Positive"
            

Technique 4: Chain of Thought (CoT)

Definition: Instructing the AI to break down its reasoning explicitly step-by-step instead of jumping straight to a final answer.

Best for: Math problems, logic puzzles, coding debugging, and complex, multi-layered decision making.

❌ Less Effective Approach:

Prompt: "What's 15% of 240?"

✅ Better Approach (CoT):


Prompt: "What's 15% of 240? Think step-by-step:
1. First find 10% 
2. Then find 5%
3. Add them together"

Output: 
1. 10% of 240 = 24
2. 5% of 240 = 12
3. 15% = 24 + 12 = 36
                

🎯 Practice Exercise 3

Task: Convert these zero-shot prompts into few-shot prompts:

  • "Classify this text: 'The movie was fantastic!'"
  • "Convert Celsius to Fahrenheit: 25°C"

Sample Answers

Few-shot sentiment classification:


Text: "I hated this" → Sentiment: Negative
Text: "It's amazing" → Sentiment: Positive
Text: "The movie was fantastic!" → Sentiment: ?
                

Few-shot temperature conversion:


0°C → 32°F
10°C → 50°F
20°C → 68°F
25°C → ?°F
                

🏋️ Test Yourself With Exercises

Take our quiz on Module 3: Basic Prompting Techniques to test your knowledge.

Browse Quizzes »