How it works
Reflection splits a single response into two roles the model plays in sequence: a generator that drafts an answer, and a critic that reviews that draft against stated criteria. The critique feeds back into a revision, and the loop repeats until the output passes or a budget is exhausted.
A typical pass looks like this:
- Generate a candidate answer or action from the task and context.
- Critique it against explicit criteria — correctness, completeness, format, constraints, or a rubric. The critique should name specific defects, not offer a grade.
- Revise the candidate using the critique as instructions.
- Stop when the critique finds nothing actionable, or when an iteration budget or wall-clock limit is hit.
The critique step is where the leverage lives. A vague "make it better" prompt produces cosmetic churn; a concrete checklist — did every claim carry a source, does the code compile, does the JSON validate — produces targeted repair. Reflection is strongest when the critic can lean on something external: test results, a schema validator, a linter, or retrieved evidence. When the critique is grounded in a signal the generator cannot fake, revision converges. When it is pure introspection, it drifts.
Why it matters in an agent harness
Inside a harness, reflection is a containment mechanism you place before a side effect, not a general quality knob. The value is that it moves error correction to a point where mistakes are still cheap — before a file is written, an API is called, or a diff is applied.
That placement gives you concrete properties:
- Failure containment. A self-check that gates a tool call catches malformed arguments, unsatisfied preconditions, or off-spec output before it becomes an irreversible action.
- Observability. Each critique is a legible artifact. Logging the draft, the critique, and the revision gives you a trace of why the agent changed its answer, which is far more debuggable than a single opaque generation.
- Evaluation surface. A structured critique doubles as an eval signal. You can score whether the critic caught real defects and whether revisions actually resolved them.
The cost is real and must be budgeted: reflection multiplies tokens and latency per task. Every extra pass is another chance for the model to introduce a new defect while fixing an old one. In a harness you bound it explicitly — a fixed iteration cap, a convergence check, and a rule that a failed self-check parks or escalates rather than looping forever.
Reflection vs Evaluator-optimizer
The two are often conflated, but the distinction changes how you wire the loop.
| Reflection | Evaluator-optimizer | |
|---|---|---|
| Critic | Same agent, second pass | Separate evaluator role or model |
| Coupling | Shares context and blind spots | Independent context, often a different model |
| Cost | One agent, more turns | Two roles, coordination overhead |
| Best when | Fast in-loop repair against a checklist | Judgment needs an independent viewpoint |
Reflection is the lightweight case: the model reviews itself. Evaluator-optimizer promotes the critic to a distinct component so its judgment does not inherit the generator's assumptions. If your failures come from the generator being confidently wrong, a separate evaluator earns its coordination cost. If your failures are careless slips the same model can spot on a second read, plain reflection is cheaper and enough.
The Rifty take
We treat reflection as a bounded gate, not an open-ended "think harder" loop. We optimize for a critique anchored to something external — a validator, a test, retrieved evidence — because unanchored self-review mostly launders the model's original confidence. We accept the token and latency cost only where it sits in front of a side effect, and we cap iterations hard: a self-check that cannot converge should escalate or park, never spin. Reflection improves an answer; it does not manufacture proof the evidence never supplied.
Common failure modes
- Correlated blind spots. A critic that shares the generator's context misses the same errors it made. Ground the critique in an external signal, or move to a separate evaluator.
- Sycophantic revision. The model rewrites to match the critique's wording without fixing the substance. Score whether defects were actually resolved, not whether a revision happened.
- Unbounded loops. Without an iteration cap or convergence check, reflection burns budget and can oscillate between two flawed drafts. Set a hard limit and a stop condition.
- Regression on revise. A pass that fixes one defect introduces another. Re-run the full critique after each revision rather than checking only the flagged item.
- Confidence laundering. Reflection can make a wrong answer read as more polished and certain. Treat improved fluency as no evidence of improved correctness.
Frequently asked questions
When is reflection worth the extra tokens and latency?
Reflection earns its cost when it gates a side effect and the critique is anchored to an external signal — a validator, test, schema, or retrieved evidence. For cheap, reversible, or throwaway output, skip it. Place a bounded self-check before irreversible tool calls, where catching a defect early is far cheaper than undoing it.
How is reflection different from an eval?
Reflection runs inside the loop to repair a single output before finishing; an eval runs outside the loop to measure quality across many runs. They compose well: a structured critique becomes an eval signal, and eval results tell you whether reflection is actually catching real defects or just adding cosmetic passes.
Why does self-critique sometimes fail to catch errors?
Because the critic shares the generator's context and assumptions, it inherits the same blind spots and often confirms its original answer. Grounding the critique in an external check the model cannot fake, or promoting the critic to a separate evaluator with independent context, is what makes self-review catch substantive errors instead of laundering confidence.
How many reflection passes should an agent run?
Bound it with a hard iteration cap and a convergence check rather than a fixed number. Most gains land in the first one or two passes; beyond that, revision risks oscillating or introducing new defects. A self-check that cannot converge within budget should escalate or park, never loop indefinitely.
Can reflection fix hallucinations?
Only when the critique can verify claims against evidence the model cannot invent — retrieval, tools, or tests. Pure introspection cannot reliably detect a hallucination and may make a fabricated claim read as more polished. Reflection improves an answer's structure and fidelity to given evidence; it does not manufacture proof the source material never supplied.