Parottasalna Course Notes
Prompt Engineering

It seems there are names for "way of asking questions", called as Prompt Engineering

Prompting is the process of giving specific instructions, questions, or examples to a Large Language Model (LLM) like ChatGPT to guide its output toward the desired goal.

In other words, its about how you are making conversation with an LLM.

Goal of Prompting

  • To clarify the task for the AI.
  • To control the format, tone, and depth of the output.
  • To encourage reasoning or multi-step thinking.
  • To reduce hallucination by narrowing the context.

TypeDescriptionExample
Zero-ShotNo examples given“Summarize this text.”
One-ShotOne example given“Example: Dog → perro; Cat → ?”
Few-ShotMultiple examples“Translate the following… cat→chat, dog→chien…”
Chain-of-ThoughtAsk to reason step by step“Think step by step.”
Role-BasedAssign an identity“You are a Python teacher.”
Self-ReflexiveAsk model to review itself“Check and improve your answer.”

Below are some examples , just for reference. I hope we are not moving to do a GridSearch to find which prompt works better ? Who Knows ???

1. Zero Shot Prompting

Ask the model to perform a task without prior examples.

Examples

  1. “Write a poem about deep learning.”
  2. “Summarize this paragraph in 2 lines.”
  3. “Explain quantum computing in simple terms.”
  4. “Generate a SQL query to find all customers who made purchases in the last month.”

2. One-Shot Prompting

Provide one example to show the expected format.

Examples

  1. Example
    Q: What is the capital of Japan?
    A: Tokyo
    Q: What is the capital of Italy? ➜ Output: Rome
  2. Example
    English → Spanish
    cat → gato
    dog → ? ➜ Output: perro
  3. Example
    Input: “Increase brightness”
    Output: “Adjusting display to +10% brightness”
    Input: “Lower volume” → ? ➜ Output: “Decreasing sound by 10%”

3. Few-Shot Prompting

Give multiple examples to teach the model a consistent pattern.

Examples

  1. Sentiment Classification
    • “I love this movie!” → Positive“This is terrible.” → Negative“It’s okay, not great.” → Neutral“The acting was amazing!” → ?
    ➜ Positive
  2. SQL Generation
    • “List all employees.” → SELECT * FROM employees;“ List all products.” → SELECT * FROM products;“List all customers.” → ?
    ➜ SELECT * FROM customers;

4. Chain-of-Thought Prompting (CoT)

Ask the model to think step by step before answering.

Examples

  1. “If 4 pens cost ₹20, how much do 10 pens cost? Think step by step.”
    ➜ Step: 1 pen = ₹5 → 10 × 5 = ₹50
  2. “Why does the sun appear red during sunset? Explain step by step.”
    ➜ Step 1: Sunlight passes through thicker atmosphere → Step 2: Blue light scatters → Step 3: Red light reaches eyes.
  3. “You have 12 marbles, give 4 to a friend. How many left? Explain.”
    ➜ Step: 12 − 4 = 8 marbles.

5. ReAct Prompting (Reason + Act)

Combine reasoning and action explicitly.

Examples

  1. “You’re a travel planner. Think about ideal locations for a short vacation from Chennai. Then list 3 options.”
  2. “You are an SRE. Think about why the API latency is high. Then suggest 3 mitigation steps.”
  3. “You are a data analyst. Think about how to visualize daily user logins. Then produce the Matplotlib code.”

6. Self-Consistency Prompting

Ask for multiple reasoning paths to get the most reliable answer.

Examples

  1. “What is 25% of 160? Give 3 reasoning paths and pick the best.”
    ➜ All lead to 40.
  2. “How many minutes in 3.5 hours? Solve in 2 ways and choose consistent.”
    ➜ 3.5×60 = 210.
  3. “If the train leaves at 3 PM and travels 2.5 hours, what time will it reach?”
    ➜ 5:30 PM via all methods.

7. Socratic Prompting

Use a question-driven approach to guide understanding.

Examples:

  1. “What happens when we drop an object? Why? What is that force called?”
  2. “If databases use indexes, what is their purpose? How do they help?”
  3. “If a model overfits, what could that mean about its training data?”

Originally published on parottasalna.com.

Related posts