Prompting Techniques

Shubham SinghalShubham Singhal
4 min read

General / Zero-shot Prompting

A zero-shot prompt is the simplest type of prompt. We only give a simple description of a task. This input could be anything: a question, a start of a story, or instructions.

The name zero-shot stands for ’no examples’.

Prompt-1

what is 2+2?

Prompt-2

Translate “How are you” in Hindi.

Prompt-3

Classify movie reviews as Positive, Neutral, or Negative. Review: This movie story is good, but it should have more comedy. Sentiment:

One-shot prompting

You give one example of how the task should be done.

Few-shot prompting

You provide a few (typically 2–5) examples to guide the model's output.

Problems of Few-shot Prompting

Bad performance with arithmetic problems.

Do not have common sense.

Does not perform well to Symbolic Reasoning.

Chain of Thought (CoT) Prompting

Chain of Thought (CoT) prompting is a technique to guide the LLM step by step.

Prompt-1 (Zero-shot + CoT)

When I was 3 years old, my partner was 3 times my age. Now, I am 20 years old. How old is my partner? Let's think step by step.

Prompt-2 (One-shot + CoT)

Q: When my brother was 2 years old, I was double his age. Now I am 40 years old. How old is my brother? Let's think step by step.

A: When my brother was 2 years, I was 2 * 2 = 4 years old. That's an age difference of 2 years and I am older. Now I am 40 years old, so my brother is 40 - 2 = 38 years old. The answer is 38.

Q: When I was 3 years old, my partner was 3 times my age. Now, I am 20 years old. How old is my partner? Let's think step by step.

A:

Note:- In technical terms, It uses a simple ‘greedy decoding’ strategy to generate reasoning steps like a human solving a problem, limiting its effectiveness.

Self-consistency Prompting

It is an approach that simply calls language model multiple times on the same prompt and take the result that is most consistent as the final answer as that it is looks like.

Idea here is like - To confirm something we look on multiple sources and most common information we use. We think it’s accurate.

  1. Sample different Reasoning

  2. Use chain of thought

  3. Select most consistent answers

📘 Instruction Prompting

This is when you tell the model what to do using clear instructions.

🧠 Focus: Explain the task.

Example:

"Summarize the following paragraph in one sentence."
"Classify the sentiment of this review as Positive, Negative, or Neutral."

📌 Used in:

  • Zero-shot or few-shot tasks

  • Tasks that benefit from clarity and guidance

Direct Answer Prompting

This is when you just ask the question or give the input, expecting the model to respond without needing task instructions.

🧠 Focus: Just give the input and expect a straight output.

Example:

"What is the capital of France?"
"When I was 3, my partner was 3 times my age. I’m 20 now. How old is my partner?"

📌 Used when:

  • The task is obvious

  • You're aiming for quick, simple answers

Persona Based Prompting

You give the AI a set of characteristics or a personality to adopt.

Example:

"You are a friendly and optimistic travel agent who loves recommending hidden gems."

Focus: The personality traits, style, and background the AI should maintain.

Role Prompting

You ask the AI to act as a specific character or role in a scenario.

Example:

"Pretend you're a medieval knight advising a young squire."

Focus: The scenario or role the AI is playing in a dynamic interaction.

🧩 Contextual Prompting

This is when you include relevant background information or context in the prompt to help the model generate better answers.

🧠 Focus: Give context to guide the response.

Example:

"Jane is allergic to nuts. Her friend offers her a peanut butter sandwich. What should Jane do?"
The model uses the context (Jane's allergy) to give a smart answer.

📌 Common in:

  • Reading comprehension

  • Reasoning tasks

  • Dialogue systems (where prior conversation matters)

🎨 Multimodal Prompting

This is when you give the model inputs in more than one format, like text + image, or text + audio, etc.

🧠 Focus: Combine multiple input types.

Example:

(Show an image of a street sign) + "What does this sign mean?"
or
(Upload a chart) + "Summarize the key trend in this chart."

📌 Common in:

  • Visual question answering (VQA)

  • Image captioning

  • Multimodal chat (like ChatGPT with image input)

0
Subscribe to my newsletter

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

Written by

Shubham Singhal
Shubham Singhal