Retry-with-Feedback Prompts
Send the document, the bad output and the exact error.
When Retry Actually Works
Structured extraction will sometimes return output that fails validation: a missing required field, a malformed date, a total that doesn't add up. The architect's question is: retry, or escalate?
Retry-with-feedback is the right tool for format, structural, and arithmetic errors. The information exists in the source — the model just rendered it wrong. A second attempt with precise correction usually fixes it.
It does NOT help when the information is simply absent from the source. No amount of retrying invents a phone number that was never on the invoice.
The Three Things You Must Send Back
A naive retry just says "that was wrong, try again." The model has no idea what was wrong, so it guesses — often producing a different wrong answer.
An effective retry-with-feedback prompt sends all three of these together:
- The original document — the model needs the source of truth again; it keeps NO state between calls.
- The bad output — the exact JSON it produced last time.
- The exact validation error — the precise, machine-generated message saying what failed and why.
Remove any one of these and the correction loop degrades into guessing.
All lessons in this course
- When Retry Helps (and When It Can't)
- Retry-with-Feedback Prompts
- Self-Correction
- Multi-Pass & Independent Review