PTENES
Skip to content
MODULE 2 - FUNDAMENTAL TECHNIQUES

📚 Few-Shot Prompting

Provide 2-5 examples before asking for the response. The model learns the pattern and replicates it accurately.

2-5
Ideal Examples
3x
Better than Zero-Shot
90%
Consistency
📚

What Is Few-Shot?

"Few-shot examples" to guide the model

In Few-Shot Prompting, you show the model a few input → output examples before asking it to do your actual task. The model identifies the pattern and replicates it in its response.

📝 Basic Structure

// Example 1

Input: [example 1]

Output: [response 1]

// Example 2

Input: [example 2]

Output: [response 2]

// Your task

Input: [your question]

Output: ?

💡

Example: Data Extraction

Extract the name and job title:

Text: "João Silva is the company's new marketing director."

Name: João Silva | Title: Marketing Director

Text: "CEO Maria Santos announced the expansion."

Name: Maria Santos | Title: CEO

Text: "Pedro Lima, project coordinator, presented the report."

Name: ? | Title: ?

→ Model responds: Name: Pedro Lima | Title: Project Coordinator

⭐

Best Practices

💡 Use 3-5 examples - too little doesn’t establish a pattern; too much consumes tokens
💡 Examples should be representative - cover a variety of cases
💡 Keep consistent format among all the examples
💡 Sort by simplest to most complex

🚀 Next: Chain of Thought

Learn how to make the model "think out loud" about complex problems!

Go to Chain of Thought