⚡0 XP🔥0

Iterating, Refining and Self-Critique

Lesson 10 of 19 ⏱ 5 min read ✎ 2 exercises ❓ 4-question quiz ▶ Runs Python

Treat prompting as a process - diagnose weak outputs, give precise feedback, ask the model to critique and improve its own work against a rubric, and compare prompt versions systematically.

Prompting is a conversation, not a single shot#

Professionals rarely get the perfect result from the first prompt. They follow a loop:

Write prompt → Read output → Diagnose what's wrong → Refine → Repeat

Usually 2-3 rounds are enough to get excellent output.

हिंदी में समझें

अच्छा prompt एक बार में नहीं बनता - यह एक प्रक्रिया (process) है: prompt लिखो → जवाब पढ़ो → कमी पहचानो → सुधार करो → दोबारा।

सबसे ज़रूरी बात: जब जवाब पसंद न आए, तो सिर्फ "और अच्छा करो" न कहें। साफ़ बताएं क्या गलत है और कैसा चाहिए - जैसे "यह बहुत लंबा है, 5 points में करो, और उदाहरण दुकानदारों से जुड़े रखो।"

Diagnosing weak output#

Problem Likely cause Fix
Too generic Missing context Add who/why/situation details
Wrong length No limit given Give a number: words, bullets, paragraphs
Wrong tone Audience not stated Name the reader and tone
Wrong format Format not specified Describe or show the format
Made-up facts No source material Paste sources; allow "I don't know"
Ignores part of task Too many tasks at once Number the steps or chain prompts
Inconsistent style No examples Add 2-3 examples (few-shot)

Giving good follow-up feedback#

Vague feedback gives random changes. Precise feedback gives precise improvements.

✗ Vague ✓ Precise
"Make it better." "Shorten to 80 words and make the first line a question."
"Not good." "The tone is too formal for Instagram - write like a friendly senior student."
"Change it." "Keep paragraphs 1 and 3. Rewrite paragraph 2 with a real example of automating Excel reports."
"Wrong." "The fee is Rs. 8,000, not Rs. 10,000, and the batch starts 5 January."
Tip

Tell the model what to keep as well as what to change - otherwise it may rewrite the good parts too.

Self-critique: let the model review its own work#

Ask the model to evaluate its output against clear criteria and then fix the problems.

Review the email you just wrote against these criteria:
1. Clear subject line
2. Mentions the new batch date (5 Jan) and fee (Rs. 8,000)
3. Under 120 words
4. One clear call-to-action
5. Friendly but professional tone

For each criterion, say Pass or Fail with a one-line reason.
Then rewrite the email to fix every Fail.

This works because reviewing is easier than creating - just like it's easier for you to spot mistakes in someone else's essay.

Reviewer role#

For important work, use a separate review prompt (or a new chat) with a critical role:

You are a strict editor for a professional training company. Here is a
course brochure draft. Find factual inconsistencies, unclear sentences,
and anything a parent might misunderstand. List problems first, then
suggest fixes.

<draft>
...
</draft>

A fresh chat reviews more objectively than the same chat that wrote the draft.

Rubrics - define "good" in advance#

A rubric is a checklist that defines a good output. Write it once and reuse it:

▶ Try it YourselfPython
Ctrl + Enter to run

Some criteria (like word count) can be checked by code; others (like tone) need human or AI judgement.

Testing prompt versions#

When a prompt will be reused many times (by your team, or in an app), test it properly:

  1. Collect 5-10 realistic test inputs, including tricky ones.
  2. Run prompt version A on all of them; score with your rubric.
  3. Change one thing (add examples, add a rule, change the format) → version B.
  4. Run B on the same inputs and compare scores.
  5. Keep the winner; save it in your prompt library with a version number.
Did you know?

This is exactly how companies build reliable AI features: a set of test cases ("evals"), a scoring method, and careful prompt versioning.

Ask the model to improve your prompt#

Models are good at writing prompts too:

Here is a prompt I use to generate quiz questions for my students.
Suggest improvements to make the questions more consistent in difficulty
and format. Then give me the improved prompt.

<prompt>
...
</prompt>

Then test the improved prompt - don't assume it's better.

Summary#

  • Prompting is iterative: write → read → diagnose → refine.
  • Give precise feedback: what to change, what to keep, and specific targets.
  • Self-critique: ask the model to check its work against criteria, then fix the failures.
  • Use rubrics to define "good"; test prompt versions on the same inputs, changing one thing at a time.

Practice Exercises

Write your code, then press Check. Your program is tested automatically.

1

Score against a rubric

Write score(text, rubric) where rubric is a dict of criterion -> function(text) -> bool. Return a tuple (passed, total) - how many criteria pass and how many there are.

Expected output:
(3, 3)
2

Failed criteria list

Write failed(text, rubric) that returns a list of criterion names that the text does not satisfy (in rubric order).

Quick Quiz

Q1.

The AI's answer is too generic. What is the best next message?

Q2.

What is self-critique prompting?

Q3.

Why use a rubric (list of criteria) when asking for a review?

Q4.

When testing two prompt versions, what should you do?