How well you can write prompts for ChatGPT, Claude, or Gemini has an enormous impact on the output you receive.
I've done the research for you, examining research papers and studies to present the 10 most important and well-known prompting techniques.
In this article, you'll learn exactly what lies behind terms like "Zero-Shot Prompting," "Chain-of-Thought," or "Self-Consistency."
I'll also show you through examples how to apply these techniques in practice.
- 10 scientifically proven prompting techniques from Zero-Shot to Chain-of-Thought for better AI outputs
- Chain-of-Thought only works optimally with 100B+ parameters and improves performance by up to 40%
- Each LLM needs adapted prompts: Claude loves structured tags, Gemini hierarchical lists, ChatGPT Markdown formatting
1. Zero-Shot Prompting
In Zero-Shot Prompting, you give the AI language model a task without first showing examples of how the task should be solved. The model must generate a solution in response to your instruction without any training.
This allows you to test the language model's capabilities and get a quick overview of which tasks it's suited for. However, results are often not optimal and can be improved through other techniques.
Here's an example of a Zero-Shot Prompt:
Write a poem about a sunset at the sea.
The poem should contain the following words:
reddish, shimmer, gentle, waves, sand, seagulls.2. Few-Shot Prompting
Few-Shot Prompting is a technique where you give the language model one or more examples showing how a task should be solved. This essentially trains the model at the moment of the query and provides a template for it to follow.
This method leads to significantly better and more specific results than Zero-Shot Prompting. However, it also requires more preparation since you first need to create suitable examples. Experiment with different Few-Shot prompts to continuously optimize the quality of generated texts.
Here's what a Few-Shot Prompt might look like:
Task: Add a creative addition to these greetings.
Example 1:
Hello! - Hello, great to see you!
Example 2:
Good morning! - Good morning, I wish you a fantastic start to the day!
Example 3:
Hi! - Hi, how are you doing on this wonderful sunny day?
Now you:
Welcome! - 3. Chain-of-Thought (CoT) Prompting
Chain-of-Thought (CoT) Prompting is a powerful method where you ask the AI model to explain its thought process when solving a task. Instead of just generating an answer, the model describes step by step how it arrived at the solution.
By verbalizing the solution path, errors in logic or understanding of the task can be uncovered. CoT Prompting is particularly suited for complex problems that require multiple thinking steps. Results are often better than with standard prompts, and you can better understand the language model's capabilities.
Here's an example of a CoT Prompt:
Question: A farmer has 10 cows, 5 pigs, and 20 chickens.
How many legs do all the animals have together?
Step 1: Calculate the number of legs for each animal type.
- Cows have 4 legs each. 10 cows x 4 legs = 40 legs
- Pigs also have 4 legs each. 5 pigs x 4 legs = 20 legs
- Chickens have 2 legs each. 20 chickens x 2 legs = 40 legs
Step 2: Add all legs together.
40 + 20 + 40 = 100
Answer: All animals have 100 legs together.Here's a more detailed example of a prompt with and without Chain-of-Thought (CoT) Prompting:
Without CoT:
Question: A rectangle has a length of 12 cm and a width of 5 cm. A square has the same perimeter as the rectangle. What is the area of the square?
Answer:With CoT:
Question: A rectangle has a length of 12 cm and a width of 5 cm. A square has the same perimeter as the rectangle. What is the area of the square?
Step 1: Calculate the perimeter of the rectangle.
- Formula for perimeter of a rectangle: P = 2 * (length + width)
- Perimeter of the rectangle: P = 2 * (12 cm + 5 cm) = 2 * 17 cm = 34 cm
Step 2: Determine the side length of the square.
- Since the square has the same perimeter: Perimeter of square = 34 cm
- Formula for perimeter of a square: P = 4 * side length
- 34 cm = 4 * side length
- Side length = 34 cm / 4 = 8.5 cm
Step 3: Calculate the area of the square.
- Formula for area of a square: A = side length²
- Area of the square: A = (8.5 cm)² = 72.25 cm²
Answer: The area of the square is 72.25 cm².4. Self-Consistency
Self-Consistency is a technique that builds on CoT prompting. Here, multiple prompts with slightly varied formulations or examples are sent to the language model. The model generates an answer for each prompt and then selects the answer that occurs most frequently.
By considering multiple solution paths and selecting the most consistent answer, errors can be reduced and accuracy improved. Self-Consistency is particularly suited for tasks where there are multiple possible solutions or where the prompt formulation can influence the answer.
Here's an example of Self-Consistency:
Question: Anna is 3 years older than Ben and 2 years younger than Clara.
Ben is 5 years younger than Clara. How old is Anna?
Prompt 1:
Step 1: Find Clara's age relative to Ben.
- Clara is 5 years older than Ben.
Step 2: Find Anna's age relative to Clara.
- Anna is 2 years younger than Clara.
Step 3: Express Anna's age in terms of Ben's age.
- If Clara is 5 years older than Ben and Anna is 2 years younger than Clara, then Anna is 3 years older than Ben.
Prompt 2:
Step 1: Define a variable for Ben's age.
- Let x be Ben's age.
Step 2: Express Clara's age using the variable.
- Clara is 5 years older than Ben, so her age is x + 5.
Step 3: Express Anna's age in terms of the variable.
- Anna is 2 years younger than Clara, so Anna's age is (x + 5) - 2 = x + 3.
Step 4: Formulate the result.
- Anna is 3 years older than Ben.
Prompt 3:
Step 1: Note the given information.
- Anna is 3 years older than Ben.
- Anna is 2 years younger than Clara.
- Ben is 5 years younger than Clara.
Step 2: Combine the information.
- If Ben is 5 years younger than Clara and Anna is 2 years younger than Clara, then Anna is 3 years older than Ben.
Consistent Answer: Anna is 3 years older than Ben.5. Automatic Chain-of-Thought (Auto-CoT)
Automatic Chain-of-Thought (Auto-CoT) is an evolution of Chain-of-Thought Prompting where examples for Few-Shot prompting are automatically generated. Instead of manually creating examples that demonstrate the solution path, these are generated by a language model.
The advantage of this method is that the effort of creating high-quality Few-Shot prompts is reduced. The automatically generated examples can be used to guide the model and improve result quality without requiring manual curation.
Here's an example of Auto-CoT:
Question: Laura has a box with 12 red, 8 blue, and 6 green beads.
She takes out 3 red, 2 blue, and 1 green bead.
What is the probability that she draws a red bead next?
Automatically generated examples:
Example 1:
- Originally there were 10 red and 5 blue marbles in the box.
- 3 red and 2 blue marbles were removed.
- There are still 7 red and 3 blue marbles remaining.
- The probability of drawing a red marble is 7/(7+3) = 7/10.
Example 2:
- There were 15 red, 10 yellow, and 5 green candies in the bag.
- 5 red and 3 yellow candies were eaten.
- Now there are 10 red, 7 yellow, and 5 green candies remaining.
- The probability of choosing a red candy is 10/(10+7+5) = 10/22.
Step 1: Calculate the number of remaining beads.
- Red beads: 12 - 3 = 9
- Blue beads: 8 - 2 = 6
- Green beads: 6 - 1 = 5
Step 2: Calculate the total number of remaining beads.
- Total: 9 + 6 + 5 = 20
Step 3: Calculate the probability of drawing a red bead.
- Probability = Number of remaining red beads / Total number of remaining beads
- Probability = 9 / 20 = 0.45
Answer: The probability of drawing a red bead next is 0.45 or 45%.6. Program-of-Thoughts (PoT)
Program-of-Thoughts (PoT) is a prompting technique based on the idea that complex problems are often easier to solve when broken down into smaller sub-steps. In PoT, the language model is asked to generate a program or algorithm that solves the problem step by step.
Unlike Chain-of-Thought, where the model describes the solution path in natural language, PoT uses a more structured, pseudocode-like representation. Each step is treated as an independent function or method that solves a specific aspect of the problem. By combining these sub-steps, a complete solution is achieved.
Here's an example of Program-of-Thoughts:
Question: A bakery sells cakes for 12 euros each and cookies for 2 euros each.
A total of 32 items are sold and total revenue is 100 euros.
How many cakes and how many cookies were sold?
Program-of-Thoughts:
def solve_bakery_problem(total_items, total_revenue, cake_price, cookie_price):
for num_cakes in range(total_items + 1):
num_cookies = total_items - num_cakes
revenue = num_cakes * cake_price + num_cookies * cookie_price
if revenue == total_revenue:
return num_cakes, num_cookies
return "No solution found."
# Problem parameters
total_items = 32
total_revenue = 100
cake_price = 12
cookie_price = 2
# Call the function with the problem parameters
num_cakes, num_cookies = solve_bakery_problem(total_items, total_revenue, cake_price, cookie_price)
print(f"{num_cakes} cakes and {num_cookies} cookies were sold.")
Answer: 5 cakes and 27 cookies were sold.7. Least-to-Most Prompting
Least-to-Most Prompting is a technique where a complex problem is broken down into several simpler sub-problems. The language model is first asked to identify and solve the sub-problems before tackling the overall solution.
The name "Least-to-Most" refers to the model starting with the simplest sub-problems and then working its way to the more complex aspects. Through the step-by-step solution of sub-problems, the model can develop a better understanding of the overall problem and generate a more precise answer.
Here's an example of Least-to-Most Prompting:
Question: A train travels from City A to City B, covering a distance of 320 km.
The train's speed is 80 km/h.
In City B, the train takes a 30-minute break before traveling back to City A at 100 km/h.
How long does the entire journey including the break take?
Step 1: Break down the problem into sub-problems.
- Calculate the travel time from City A to City B.
- Calculate the travel time from City B to City A.
- Add the break time to the total travel time.
Step 2: Solve the sub-problems.
Sub-problem 1: Travel time from City A to City B
- Distance: 320 km, Speed: 80 km/h
- Travel time = Distance / Speed
- Travel time = 320 km / 80 km/h = 4 hours
Sub-problem 2: Travel time from City B to City A
- Distance: 320 km, Speed: 100 km/h
- Travel time = Distance / Speed
- Travel time = 320 km / 100 km/h = 3.2 hours
Sub-problem 3: Total travel time including break
- Travel time from A to B: 4 hours
- Travel time from B to A: 3.2 hours
- Break time: 30 minutes = 0.5 hours
- Total journey time = Travel time A to B + Travel time B to A + Break time
- Total journey time = 4 hours + 3.2 hours + 0.5 hours = 7.7 hours
Step 3: Formulate the answer.
The entire journey including the break takes 7.7 hours or 7 hours and 42 minutes.8. Chain-of-Symbol (CoS)
Chain-of-Symbol (CoS) is a prompting technique aimed at improving language models' ability to process and generate symbolic information. In CoS, symbols or tokens are used to represent relationships, hierarchies, or sequences instead of natural language.
By using symbols, the model can better capture and process complex relationships and structures. This is particularly useful for tasks requiring precise representation of information, such as mathematical equations, chemical formulas, or programming code.
Here's an example of Chain-of-Symbol Prompting:
Question: Given the following chemical reaction equation:
2 H2 + O2 → 2 H2O
Convert this equation to a symbolic representation and calculate the mass of H2O
when 4 g H2 and 32 g O2 react.
Symbolic representation:
- Hydrogen (H2): [H:2]
- Oxygen (O2): [O:2]
- Water (H2O): [H:2][O:1]
Reaction equation:
2 [H:2] + [O:2] → 2 [H:2][O:1]
Given masses:
- m([H:2]) = 4 g
- m([O:2]) = 32 g
Molar masses:
- M([H:2]) = 2 g/mol
- M([O:2]) = 32 g/mol
- M([H:2][O:1]) = 18 g/mol
Molar amounts of reactants:
- n([H:2]) = m([H:2]) / M([H:2]) = 4 g / 2 g/mol = 2 mol
- n([O:2]) = m([O:2]) / M([O:2]) = 32 g / 32 g/mol = 1 mol
Limiting reagent:
- Ratio of molar amounts: n([H:2]) : n([O:2]) = 2 : 1
- Compared to the stoichiometric ratio of 2 : 1, neither substance is in excess.
- Both reactants are completely consumed.
Molar amount of product:
- n([H:2][O:1]) = 2 * min(n([H:2]) / 2, n([O:2])) = 2 * min(2 mol / 2, 1 mol) = 2 mol
Mass of product:
- m([H:2][O:1]) = n([H:2][O:1]) * M([H:2][O:1]) = 2 mol * 18 g/mol = 36 g
Answer: When 4 g H2 and 32 g O2 react, 36 g H2O is produced.9. Structured Chain-of-Thought (SCoT)
Structured Chain-of-Thought (SCoT) is an extension of Chain-of-Thought Prompting where the language model's response is generated in a structured form. Instead of describing the thought process in flowing text, SCoT uses a predefined structure like a list, table, or diagram.
By specifying a structure, the model can be made to organize its response better and highlight important information. This improves clarity and makes it easier for users to understand and follow the response.
Here's an example of Structured Chain-of-Thought Prompting:
Question: A sports store sells tennis balls in packs of 4.
A pack costs $8.99. A tennis club wants to buy tennis balls
worth a maximum of $500 for a tournament.
How many tennis balls can the club buy and how much money is left over?
Answer:
Given information:
- Tennis balls are sold in packs of 4.
- One pack costs $8.99.
- The tennis club's budget is $500.
Solution steps:
1. Calculate the maximum number of packs that can be bought with the budget.
* Maximum number of packs = Budget / Price per pack
* Maximum number of packs = $500 / $8.99 ≈ 55.62
* Since only whole packs can be bought, round down: 55 packs
2. Calculate the number of tennis balls contained in 55 packs.
* Tennis balls per pack = 4
* Total number of tennis balls = Number of packs × Tennis balls per pack
* Total number of tennis balls = 55 × 4 = 220
3. Calculate the actual cost for 55 packs and the remaining budget.
* Actual cost = Number of packs × Price per pack
* Actual cost = 55 × $8.99 = $494.45
* Remaining budget = Budget - Actual cost
* Remaining budget = $500 - $494.45 = $5.55
Result:
- The tennis club can buy 220 tennis balls (55 packs).
- $5.55 remains from the budget.10. Plan-and-Solve (PS)
Plan-and-Solve (PS) is a prompting technique that focuses on solving complex problems by first creating a plan and then executing it step by step. In PS, the language model is asked to analyze the problem, develop a solution plan, and then implement this plan step by step.
The main advantage of PS is that it allows the model to develop a structured approach to complex problems. By creating a plan, the model can identify the most important steps and focus on the essential aspects of the problem.
Here's an example of Plan-and-Solve Prompting:
Question: A hiker covers a distance of 18 km in one day.
He starts at 8:30 AM and takes a 15-minute break in the first 2 hours.
After covering half the distance, he takes a 30-minute lunch break.
Afterward, he continues at a speed 1.5 km/h faster than in the morning.
At 4:00 PM he reaches his destination. What was the hiker's average speed?
Answer:
Plan:
1. Calculate the effective hiking time without breaks.
2. Determine the morning speed.
3. Calculate the afternoon speed.
4. Determine the average speed for the entire distance.
Step 1: Calculate effective hiking time
- Total time: 8:30 AM to 4:00 PM = 7 hours 30 minutes
- Breaks: 15 minutes in the morning, 30 minutes at midday
- Effective hiking time = Total time - Breaks
- Effective hiking time = 7 hours 30 minutes - 45 minutes = 6 hours 45 minutes = 6.75 hours
Step 2: Determine morning speed
- Morning distance: Half of total distance = 18 km ÷ 2 = 9 km
- Morning time: 2 hours - 15 minutes break = 1.75 hours
- Morning speed = Morning distance ÷ Morning time
- Morning speed = 9 km ÷ 1.75 hours ≈ 5.14 km/h
Step 3: Calculate afternoon speed
- Afternoon speed = Morning speed + 1.5 km/h
- Afternoon speed = 5.14 km/h + 1.5 km/h = 6.64 km/h
Step 4: Determine average speed
- Average speed = Total distance ÷ Effective hiking time
- Average speed = 18 km ÷ 6.75 hours ≈ 2.67 km/h
The hiker traveled at an average speed of about 2.67 km/h.Sources
- Schulhoff, S., Ilie, M., Balepur, N., Kahadze, K., Liu, A., Si, C., … & Resnik, P. (2024). The Prompt Report: A Systematic Survey of Prompting Techniques.
- Vatsal, S., & Dubey, H. (2024). A Survey of Prompt Engineering Methods in Large Language Models for Different NLP Tasks.






