Skip to main content

Command Palette

Search for a command to run...

Brewing Prompting Techniques — One Prompt at a Time ☕🤖

Published
4 min read
Brewing Prompting Techniques — One Prompt at a Time ☕🤖

Now that we understand how GenAI models work internally, it’s time to learn how to talk to them properly. This is where prompting techniques come in.

Each technique below helps guide the model in a different way—just like adjusting ingredients while making chai.


1. Zero-Shot Prompting

Zero-shot prompting means asking the model to perform a task without giving any examples.

The model relies purely on its pre-trained knowledge.

Example:

“Summarize the following article in 5 bullet points.”

Other common uses:

  • “Translate this sentence to French.”

  • “Explain recursion in simple terms.”

In simple words:
You ask directly, and the model answers directly.


2. Few-Shot Prompting

Few-shot prompting involves giving the model a few examples before asking the real question. This helps the model understand the expected pattern.

Example:

Input: Apple  
Output: A sweet fruit rich in fiber.

Input: Car  
Output: A vehicle used for transportation.

Input: Laptop  
Output:

The model now understands you want short, descriptive definitions.

In simple words:
You show the model how to answer before asking.


3. Chain-of-Thought (CoT) Prompting

Chain-of-Thought (CoT) prompting, introduced by Wei et al. (2022), helps large language models solve complex problems by breaking reasoning into intermediate steps instead of jumping directly to an answer.

This technique is especially useful for:

  • Math and logic problems

  • Multi-step reasoning

  • Decision-making tasks

Few-Shot CoT Example

Prompt:

The odd numbers in this group add up to an even number:
4, 8, 9, 15, 12, 2, 1.
A: Adding the odd numbers (9, 15, 1) gives 25. False.

The odd numbers in this group add up to an even number:
15, 32, 5, 13, 82, 7, 1.
A:

Output:

Adding the odd numbers (15, 5, 13, 7, 1) gives 41. False.

Even one reasoning example helps the model learn the logic pattern.

Zero-Shot CoT Prompting

Introduced by Kojima et al. (2022), Zero-shot CoT works by simply adding:

“Let’s think step by step.”

Example:

I bought 10 apples, gave away 4, bought 5 more, and ate 1.
How many apples do I have?
Let's think step by step.

Output:
✅ 10 apples (correct reasoning)


4. Self-Consistency Prompting

Self-consistency, proposed by Wang et al. (2022), improves Chain-of-Thought prompting by not relying on a single answer. Instead, the model generates multiple reasoning paths and selects the most common (consistent) answer.

Why It Helps: Even with step-by-step reasoning, a model can make mistakes. Self-consistency reduces errors by comparing multiple outputs.

In simple words: Ask the model to think several times, then trust the answer it repeats most.

Example

Question: “When I was 6, my sister was half my age. Now I’m 70. How old is my sister?”

Outputs: 67, 67, 35

Final answer: 67 (majority wins)

Best used for: math, logic, and reasoning-heavy tasks.


5. Instruction Prompting

Instruction prompting gives the model clear, explicit instructions about what to do.

Example:

“Write a 200-word blog post explaining embeddings for beginners.
Use simple language and examples.”

This works best when you specify:

  • Task

  • Length

  • Audience

  • Tone

In simple words:
Clear instructions = better output.


6. Direct Answer Prompting

Direct answer prompting asks the model to skip explanations and give only the final answer.

Example:

“What is the square root of 144?
Answer with only the number.”

Useful for:

  • Factual questions

  • Quick lookups

  • APIs

In simple words:
No explanation—just the result.


7. Persona-Based Prompting

Persona-based prompting tells the model to respond as a specific person or personality.

Example:

“Explain prompt engineering as if you are Hitesh Choudhary teaching beginners.”

This controls:

  • Teaching style

  • Tone

  • Language choice

In simple words:
You decide who the model sounds like.


8. Role-Playing Prompting

Role-playing prompting assigns the model a job or role.

Example:

“You are a senior interviewer at Google.
Ask me Python interview questions.”

Used widely in:

  • Mock interviews

  • Learning simulations

  • Training bots

In simple words:
The model plays a role, not just answers.


9. Contextual Prompting

Contextual prompting provides background information before asking a question.

Example:

“Based on the following job description, suggest interview questions.”

Or:

“Using the attached article, answer the following question.”

This improves:

  • Relevance

  • Accuracy

  • Depth

In simple words:
Give context before expecting good answers.


10. Multimodal Prompting

Multimodal prompting uses more than just text—like images, audio, or video.

Example:

  • Upload an image → “Describe what’s happening in this image.”

  • Upload a screenshot → “Explain this error and how to fix it.”

Used in:

  • Image captioning

  • Visual debugging

  • Design feedback

In simple words:
The model doesn’t just read—it sees and hears too.


Final Sip ☕

Prompting techniques are tools, not rules. The best results come from mixing and experimenting with them based on your use case.

Just like chai tastes different with small ingredient changes, your prompts shape the AI’s output more than the model itself.

More GenAI brewing soon ☕🚀