<div class="statcounter"><a title="Web Analytics" href="https://statcounter.com/" target="_blank"><img class="statcounter" src="https://c.statcounter.com/12795394/0/d64e9537/1/" alt="Web Analytics" referrerPolicy="no-referrer-when-downgrade">

AI Quick Tips 265: Prompt iteration strategies

AI Quick Tips

A lot of people, including me, recommend iterating as part of prompt engineering.  

For those of you who haven’t lived in tech and math circles, and might not have heard “iterating” before, here is an AI-generated definition (that I agree with) -

Iteration is the process of repeating a sequence of operations or instructions to achieve a desired result, often used in mathematics and computer science. Each repetition is called an iteration, and the outcome of one iteration typically serves as the starting point for the next.


The short version of that is to do things more than once (it leaves out some important information, though).


Now that we are all on the same page, one of the questions that I don’t think gets asked as much as it should is “Are there any recommended strategies for how to iterate?”.  Short answer - yes.  Again, it leaves out some details I think.


The following examples are from Google.  I’ve found that each of these strategies has worked well with other vendor’s models though.

Prefer video? Watch here:



Use different phrasing

Using different words or phrasing in your prompts often yields different responses from the model even though they all mean the same thing.  If you’re not getting the expected results from your prompt, try rephrasing it.

  • Version 1 - How do I bake a pie?
  • Version 2 - Suggest a recipe for a pie
  • Version 3 - What a good pie recipe?


Switch to an analogous task

If you can’t get the model to follow your instructions for a task, try giving it instructions for an analogous task that achieves the same result.


This prompt tells the model to categorize a book by using predefined categories:

Prompt: Which category does the Odyssey belong to:

Thriller
Sci-fi
Mythology
Biography


Response
: The Odyssey belongs to the category of **mythology**.

Here's why:

* **Mythology:** The Odyssey tells the story of Odysseus, a hero from Greek mythology, and his

journey home after the Trojan War. It features gods, monsters, and supernatural events common to

Greek mythology.

 

The response is correct, but the model didn't stay within the bounds of the options. You also want to model to just respond with one of the options instead of in a full sentence. In this case, you can rephrase the instructions as a multiple-choice question and ask the model to choose an option.

Prompt: Multiple choice problem: Which of the following options describes the book The Odyssey?

    • Thriller
    • Sci-fi
    • Mythology
    • Biography

Response: The correct answer is mythology


Change the order of prompt content

The order of the content in the prompt can sometimes affect the response.  Try changing the content order and see how that affects the response.

  • Version 1
    • [examples]
    • [context]
    • [input]
  • Version 2
    • [input]
    • [examples]
    • [context]
  • Version 3
    • [examples]
    • [input]
    • [context]

An illustration of a multi-armed, orange robot floating in a swirling digital space, holding a wrench and surrounded by various AI tools and interfaces. The tools include orbs labeled ChatGPT, Gemini, and Claude, alongside screens displaying code, a chat interface, and images. Two small cat-like creatures are also observing the activity. This image represents the complexity and variety of the AI ecosystem.

Don’t Just Read About It. Watch the Chaos Unfold.

Quick demos, smarter AI tricks, and zero “smash that like button” energy.

Comments

Related posts