Author's profile photo

Aylwin's tech blog

Sprinkle a bit of curiosity in everything I do 🧪

Types of prompting to improve LLM output

2026-03-07

How can we phrase prompts in ways to get reliably good results. There are some established techniques that have empirically improved AI response as follows:

  1. Zero-shot prompting: Give AI a task with no examples.

     Write a polite text message to my coach saying I can’t make training tonight.
  1. K-shot prompting: Give AI a task with at least one example.

     Classify each message as: (A) urgent, (B) soon, (C) can wait.
     Example: “Project due in 2 hours” -> A
     Example: “Can you send that file by tomorrow?” -> B
     Now classify: “Whenever you get time, review my draft.”
  2. Zero-shot Chain of thought prompting: Instruct AI to reason step-by-step but give no examples.

     A gym membership costs $40 per month plus a $60 sign-up fee.
     If I paid $180 total, how many months did I pay for?
     
     Think step by step before giving the final answer.
  3. Multi-shot chain of thought prompting: Instruct AI to reason step-by-step with examples that include reasoning steps. In other words, you teach AI ‘how to think’ by example.

     I want you to debug code using the same reasoning style as the examples below.
     For each case:
     -Identify the likely cause of the bug
     -Explain why it happens
     -Provide the corrected code
     -Briefly state how to avoid this mistake in the future
     
     Example 1:
     Code:
     numbers = [1, 2, 3]
     print(numbers[3])
     
     Analysis:
     Cause: Index out of range error.
     Why: List indices go from 0 to 2. Index 3 does not exist.
     Fix: 
     print(numbers[2])
     Avoid: Always check list length or use len() before indexing.
     
     Now debug:
     total = 0
     for i in range(1, 5):
         total = total + i
     print(i)
     Use the same reasoning structure.
  4. Tool: Instruct AI to use tool to provide a accurate and valid response.

     Look up the opening hours for the nearest public library to Parramatta NSW and tell me if it’s open this Saturday afternoon.
  5. RAG (Retrieval-Augmented Generation): RAG is a method that lets AI answer questions using specific, retrieved documents instead of relying only on its internal training data.

    Retrieved Context + User prompt = RAG Prompt.

    Example of RAG Prompt:

     Answer using ONLY the information provided below.
     If the information is insufficient, say so.
     
     Context:
     Premium subscriptions include unlimited downloads and priority support.
     Refunds are available within 14 days of purchase.
     After 14 days, refunds are not permitted.
     
     Question: I bought premium 20 days ago. Can I get a refund?
  6. Reflexion: Reflexion prompting is a structured self-review loop where the model improves its own answer through critique and revision.

    Example 1:

     Solve this logic problem.
     After giving your answer, list possible mistakes in your reasoning.
     Then re-solve it more carefully.
    Example 2:
     Recommend whether I should lease or buy a car.
     Then identify assumptions you made in your reasoning.
     Then provide a revised recommendation considering alternative assumptions.