Notes: All Prompting Types

ShubhamShubham
6 min read

AI models have all the knowledge about the world that are available on the internet. So, it becomes.. I might say little tricky to extract the information from the AI. Your AI companion doesn’t know in which format your answer.

Suppose you asked “What is Love?”.

AI models do’t have personality that developed on its past incidents or its course curriculum. Neither it is coming from a community those has believe system on something. It can’t tell you like “Umm.. According to me.. “. No, it can’t!

It has all the knowledge from the internet. It knows what are the points of people on love. There are many possible ways to answer this. Philosophically, Scientifically or Like my friend who says “There is no such thing as love”.

Prompting is the key

Just like communication is the key among humans. Prompting sets the clear boundaries and what you actually expect from them. No, I am not talking love language. It’s how prompting works.

Let’s just jump directly to the types

Types of Prompting

Zero-shot Prompting

In this prompting technique, you didn’t give any example. You just give the content and in return you aspect magic will happen.

Prompt:

Classify the text into neutral, negative or positive. 
Text: I think the vacation is okay.
Sentiment:

Output:

Neutral

Just direct questioning no example nothing.

Few-shot Prompting

In this prompting technique you give some examples of output that how you want your output. It could be a specific format or specific tone anything that will guide the AI model to understand how the next prediction should be.

Prompt:

Translate the following English sentences to French:
"Good morning" → "Bonjour"
"How are you?" → "Comment ça va ?"
"Thank you" →

Output:

Merci

Here we gave some example that how should the translating perform and with language. So, the model know what output should look like

Chain-Of-Thought Prompting

It is a way to get better answers by asking the model to show its thinking step-by-step before giving the final answer. Here is the example of addition question and we asked AI model to show the steps of thinking.

Prompt:

Question:
If there are 5 pencils and you buy 7 more, how many pencils do you have?

Output:

Answer: 
First, I start with 5 pencils. Then I buy 7 more pencils.
Adding them together, 5 + 7 = 12.
So, the answer is 12.

This prompt includes steps of reasoning, encouraging the model to "think aloud" before giving the final answer.

Self-Consistency Prompt

In this approach, we prompt the AI model multiple times and select the answer that receives the majority of votes. This method ensures a more accurate output. The Self-Consistency Prompt generates several possible answers and chooses the most common one.

For example: Which is greater? 9.8 or 9.11.

According to math 9.8 is greater but, in terms of indexing of a book topic 9.8 comes before 9.11 right? So, in that case 9.11 is greater. This type of question can be solved by Self-Consistency Prompt.

Prompt:

If a train has 5 cars and each car holds 80 passengers, how many passengers can the train carry?

Instead of asking once and satisfy with the answer. We will run Chain-Of-Thought multiple time and then pick most common one.

Run 1:
There are 5 train cars, and each holds 80 passengers. So, 5 × 80 = 400.
Answer: 400

Run 2:
We multiply the number of cars (5) by the passengers per car (80), which gives 400.
Answer: 400

Run 3:
Each car has 80 people, and there are 5 cars: 80 + 80 + 80 + 80 + 80 = 400.
Answer: 400

Run 4:
Number of passengers = 5 cars × 80 passengers = 400.
Answer: 400

Run 5:
There are 5 coaches. Each can seat 80. 5 × 80 = 400.
Answer: 400

Instruction Prompting

This is the type of prompting where we give model a clear and explicit command or we can say instruction. In this we don’t give example so it is like a zero sort prompting but with an instruction Here is the example.

Prompt:

Summarize the following paragraph in one sentence.

Paragraph:
Artificial intelligence is a field of computer science that focuses on building machines that can mimic human intelligence, such as learning, reasoning, and problem-solving.

Output:

Artificial intelligence involves creating machines that replicate human intelligence and thinking abilities.

Direct Answer Prompting

It is a type of prompting where we expect to get a simple concise answer without any explanation, reasoning or examples. For example:

Prompt:

What is the capital of India?

Output:

New Delhi

Persona based Prompting

Persona-based prompting is a way to get responses in a certain tone or style, like a specific person. We want the model to take on a certain identity or role, such as a doctor, teacher, coach, developer, or historical figure, while answering.

Prompt:

You are a senior Python developer. Explain how list comprehensions work to a beginner.

Output:

Sure! In Python, a list comprehension is a concise way to create lists. Instead of writing a for loop, you can write everything in a single line like this:
squares = [x**2 for x in range(10)]
This means: for each x in range(10), take x squared, and put it in the list. It's shorter, more readable, and Pythonic!

Role-Playing Prompting

As name explains, we give AI model a character and situation for acting in the situation. It’s dynamic, interactive, and often includes dialogue or storytelling.

Prompt:

You are a customer support agent at an e-commerce company. A user is angry because their order arrived late. Handle the situation politely.

Output:

"I'm really sorry to hear that your order arrived late. I completely understand how frustrating that must be. Let me check your order details and see what I can do to make this right for you."

The major difference between role-playing and persona is that In Persona Prompting we just set the tone and way of talking according to a personality. But in Role-Playing, we give the situation for act. Like how a doctor will ask question if a patient has stomach pain.

Contextual Prompting

Contextual Prompting means giving the model a background information or a situation before asking a question. This helps it understand the context and give a more relevant answer.

Prompt:

I’m writing an email to my boss to ask for a day off because my grandmother is sick. Make it polite.

Output:

Dear [Boss's Name], I hope this message finds you well...
...

I don't think I should give each and every output

Multimodal Prompting

This is interesting. Multimodal Prompting means giving a model different types of input, like text, images, audio, or video, and asking it to respond by using what it learns from all these inputs.

Prompt:

(Upload an image of a traffic jam)
Text: “Explain what’s happening in this picture.”

Output:

There is heavy traffic on the road. Cars are stuck and not moving. This looks like a traffic jam during rush hour.

Conclusion

There are lots of ways to give prompt to a AI model. But, it’s not like this is best and that is not. All the prompting techniques is useful and works better according to our needs. Sometime we just want quick answer or sometime accurate answer.

Whichever AI model prompting makes our lives easier, we should use that. We shouldn't be restricted to just one method, as that would be unwise.

0
Subscribe to my newsletter

Read articles from Shubham directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shubham
Shubham