Prompting Techniques

Prompting Techniques

🧠 Advanced Prompting Techniques

1. What is a Prompt?

A prompt is the instruction or input you give to an AI model.

2. What is Temperature?

Temperature controls how creative or random the AI response is.

Value Behavior
0.0 Exact and predictable
0.3 Controlled output
0.7 Balanced
1.0 Creative
1.5+ Highly random

3. What are Tokens?

Tokens are small pieces of text.

  • 1 token ≈ 0.75 words
  • 100 tokens ≈ 75 words

4. Context Window

The maximum number of tokens a model can process at once.

How AI Generates Output

  1. You give a prompt
  2. Text converts into tokens
  3. Context limit checked
  4. Temperature applied
  5. Response generated

Prompt Types -:

Multi-Instruction Prompt

Give multiple instructions clearly.

Example:


You are a startup expert.

Give 3 business ideas.

Constraints:

  • Budget under ₹5000
  • Suitable for students

Format:

  1. Idea
  2. Cost
  3. Difficulty

Then: Select best idea and explain why

Role + Persona

Role + Persona Pattern (Prompt Template)


Role: You are a [profession/expert role]

Persona: You are [personality traits, tone, style]

Task: [What you want the AI to do]

Constraints:

  • [Constraint 1]
  • [Constraint 2]
  • [Constraint 3]

Format:

  1. [Output point 1]
  2. [Output point 2]
  3. [Output point 3]

Additional Instruction: [Any extra instruction like tone, length, examples]

Chain-of-Thought

Chain-of-Thought Prompt Technique


Definition:

Chain-of-Thought (CoT) is a prompting technique where the AI is guided to think step-by-step before giving the final answer. It helps improve reasoning, accuracy, and problem-solving by breaking complex tasks into smaller logical steps.

Example:

Prompt:

"A shopkeeper buys a product for ₹100 and sells it for ₹150. What is the profit percentage? Think step by step."

Response:

  1. Cost Price = ₹100
  2. Selling Price = ₹150
  3. Profit = ₹150 - ₹100 = ₹50
  4. Profit Percentage = (50 / 100) × 100 = 50%
  5. Final Answer: 50%

Summary:

Chain-of-Thought prompting improves results by encouraging step-by-step reasoning. It is especially useful for math problems, logic questions, and complex decision-making tasks.

Self-Consistency

Self-Consistency Prompt Technique


Definition:

Self-Consistency is a prompting technique where the AI generates multiple possible answers using different reasoning paths and then selects the most common or consistent final answer. This improves accuracy, especially for complex reasoning tasks.

Example:

Prompt:

"If a number is doubled and then increased by 10, the result is 30. What is the number? Solve using different approaches."

Response:

  1. Method 1: Let number = x → 2x + 10 = 30 → 2x = 20 → x = 10
  2. Method 2: Reverse steps → 30 - 10 = 20 → 20 ÷ 2 = 10
  3. Method 3: Try values → 10 works correctly
  4. Final Answer: 10 (consistent across methods)

Summary:

Self-Consistency improves reliability by comparing multiple reasoning paths and choosing the most consistent answer. It is useful for math, logic, and decision-making problems.

Few-Shot Learning

Few-Shot Learning Prompt Technique


Definition:

Few-Shot Learning is a prompting technique where you provide a small number of examples in the prompt so the AI can understand the pattern and generate similar outputs. It helps guide the model without needing large amounts of data or training.

Example:

Prompt:

Convert sentences into emojis:

  • I am happy → 😊
  • I love pizza → 🍕❤️
  • I am sad → 😢

Now convert: I am excited

Response:

🎉😄

Summary:

Few-Shot Learning works by showing a few examples to guide the AI. It improves output quality and consistency, especially for formatting, pattern-based tasks, and structured responses.

Zero-Shot Prompting

Zero-Shot Prompting


Definition:

Zero-Shot Prompting is a technique where you ask the AI to perform a task without giving any examples. The model relies on its general knowledge and understanding to generate the correct output directly.

Example:

Prompt:

"Translate this sentence into Hindi: I am learning AI."

Response:

"मैं AI सीख रहा हूँ।"

Summary:

Zero-Shot Prompting is simple and fast because no examples are required. It works well for common tasks like translation, summarization, and basic questions, but may be less accurate for complex or highly specific tasks compared to few-shot methods.

Output Format Control

Output Format Control


Definition:

Output Format Control is a prompting technique where you clearly specify how you want the AI’s response to be structured or formatted. This ensures the output is organized, consistent, and easy to use.

Example:

Prompt:

"List 3 fruits with their benefits. Format the answer in a table with columns: Fruit, Benefit."

Response:

Fruit Benefit
Apple Good for heart health
Banana Provides quick energy
Orange Rich in Vitamin C

Summary:

Output Format Control helps you get structured results like tables, lists, JSON, or bullet points. It is very useful for coding, data handling, and creating clean, readable content.

Tree of Thoughts

Tree of Thoughts Prompt Technique


Definition:

Tree of Thoughts (ToT) is a prompting technique where the AI explores multiple possible solutions step-by-step like branches of a tree, evaluates each path, and then selects the best outcome. It is useful for complex problems that require deeper reasoning and comparison.

Example:

Prompt:

"You have ₹500. Choose the best way to earn profit. Think of multiple options and select the best one."

Response:

  • Option 1: Buy snacks and sell at school → Small but quick profit
  • Option 2: Print notes and sell → Low cost, steady demand
  • Option 3: Buy craft materials and sell handmade items → Higher effort, higher margin

Evaluation:

  • Option 1: Easy but limited growth
  • Option 2: Low investment and consistent income
  • Option 3: Time-consuming but scalable

Final Decision:

Option 2 (Print notes and sell) is the best choice due to low cost and steady demand.

Summary:

Tree of Thoughts improves decision-making by exploring multiple ideas, comparing them, and selecting the best solution. It is ideal for planning, strategy, and complex problem-solving tasks.

Prompt Chaining

Prompt Chaining


Definition:

Prompt Chaining is a technique where a complex task is broken into smaller steps, and each step is handled by a separate prompt. The output of one prompt becomes the input for the next, creating a chain of prompts to achieve the final result.

Example:

Task: Create a blog post

  1. Prompt 1: Generate 3 blog topic ideas
  2. Prompt 2: Select one topic and create an outline
  3. Prompt 3: Expand the outline into full content
  4. Prompt 4: Format the content into HTML

Result:

A complete, structured blog post created step-by-step using multiple prompts.

Summary:

Prompt Chaining helps manage complex tasks by dividing them into smaller, manageable steps. It improves clarity, accuracy, and overall output quality.

Anti-Hallucination

Anti-Hallucination Prompt Technique


Definition:

Anti-Hallucination is a prompting technique used to reduce incorrect or made-up information in AI responses. It works by instructing the AI to stay within known facts, avoid guessing, and clearly state when it is unsure.

Example:

Prompt:

"Explain quantum computing in simple terms. If you are not sure about any part, say 'I don't know' instead of guessing."

Response:

  • Quantum computing uses principles of physics to process information.
  • It works with quantum bits (qubits) instead of regular bits.
  • Some advanced details are complex, and I don't know all specifics.

Summary:

Anti-Hallucination improves reliability by encouraging the AI to avoid guessing and focus only on accurate, known information. It is useful for research, technical, and factual tasks.

Multi-Role Prompting

Multi-Role Prompting


Definition:

Multi-Role Prompting is a technique where the AI is asked to take on multiple roles or perspectives to analyze a problem and generate a more balanced and detailed response. Each role provides its own viewpoint before reaching a final conclusion.

Example:

Prompt:

"Should a student start a business? Answer as a teacher, a parent, and an entrepreneur."

Response:

  • Teacher: Focus on studies first, but small learning projects are good.
  • Parent: Ensure stability and balance between risk and education.
  • Entrepreneur: Starting early gives real-world experience and skills.

Final Conclusion:

A student can start a small business while managing studies, gaining experience without high risk.

Summary:

Multi-Role Prompting improves decision-making by combining different perspectives. It is useful for debates, planning, and complex problem analysis.

💡 If you found this helpful, share it and start experimenting!

0 Comments