You want to have a good process to make your prompt iteratively better because, odds are, your first prompt won’t work as you wish.
You can approach prompt development as an iterative loop:
- Idea
- Implementation (code/data/prompt)
- Experimental Result
- Error Analysis (analyze why the prompt does not give the desired output)
- Iterate (refine the idea and the prompt)
- Repeat
It’s more important to have a good iterative process than trying to develop the perfect prompt right out of the gate.
Go back to the key principles of writing clear and specific instructions and giving the model time to think. You may have to refine the initial instructions to be more precise. For example, suppose you’re looking to summarize a product description. In that case, you may need to specify the intended audience, length of the text, including product numbers at the end, etc., rather than simply asking for the model to summarize a description.
You could also ask for the model to do things such as include a table that gives the product dimensions or format the output in HTML for a website by putting the description in a <div> element.
So, to summarize the iterative prompt development process:
- Try something
- Analyze where the result does not give what you want
- Clarify instructions and/or give the model more time to think.
- Refine prompts with a batch of examples.