Prompt Engineering· Lesson 5 of 7
- 1Anatomy of a Prompt — What It's Made Of6 min
- 2Few-Shot — Teach by Example7 min
- 3Structured Output — Make It Return JSON7 min
- 4Chain of Thought — Let It Reason Step by Step8 min
- 5Prompt Iteration — Improving It in Passes6 min
- 6Role & Persona — Tell It Who to Be7 min
- 7Prompt Injection Basics — When Input Turns Against You8 min
Prompt Iteration — Improving It in Passes
In one line · A first prompt is rarely the final one; improving it is iterative: try, see what's wrong, change one thing, and compare.
People give up on a prompt after one failed try and say 'the model is dumb'. The problem is usually the wording, and the fix is a small deliberate tweak.
Like tuning a SQL query: you run it, look at the result, change one condition, and run again — you don't rewrite it from scratch each time.
Treat each version of the prompt as a small commit: one clear change, so if it breaks you know what to revert.
Reply too long? Add 'in one sentence'. Still too formal? Add 'in a friendly tone'. Change one thing at a time so you know what actually moved the needle.
Work it like any debugging loop: fix a small test set (5-10 real inputs), run the prompt over it, and note the recurring failures. Change one thing aimed at the most common failure, rerun on the same set, and compare. The fixed set is the key — without it you're judging by feel, and since model output is probabilistic, a single example can fool you in either direction.
🧪 Try it yourself: take the weak prompt in the linked exercise and fix 5 test inputs. Do 3 passes: change exactly one thing per pass, and score all five before and after. At the end, look at the log: which change actually made the biggest difference?
- Changing 3 things at once, so when results improve (or break) you can't tell which change did it.
- Judging a tweak from one example — a better result can be pure sampling luck.
- Keeping no versions of old prompts, so when a tweak breaks something that worked, there's nothing to roll back to.
Any prompt headed for production, and any prompt with shaky results or failures on specific kinds of inputs.
If you've reworded 5-6 times and results haven't budged, stop rewording — the problem is usually deeper: you need examples (few-shot), missing context (RAG), or the task is beyond the model itself.