Reflection
📖 3 min readUpdated 2026-04-19
Reflection: after the agent produces an answer or a plan, it's prompted to critique itself. "Is this correct? Is anything missing? What would I change?" The revised answer is often meaningfully better than the first.
The pattern
- Agent produces initial output (answer, plan, code, whatever)
- Reflection step: another LLM call asks "review this output, find issues, suggest improvements"
- Revision step: agent produces a new version incorporating the reflection
- Optional: loop reflection-revision until satisfied or max iterations
When reflection wins
- Code generation (catches bugs before shipping)
- Complex reasoning (catches logic errors)
- Writing tasks (catches tone, factual, structural issues)
- Plans (identifies missed steps or bad assumptions)
When it doesn't
- Simple tasks where the first answer is fine
- Cost-sensitive high-volume workflows
- Latency-critical apps
- When the model keeps producing the same "reflection" (it's not learning from itself)
Self vs separate critic
Two approaches:
- Self-reflection: same model critiques its own output. Cheaper, faster. Limited by the model's self-awareness.
- Separate critic: a different model (or different prompt persona) critiques. More expensive. Often produces meaningfully different feedback.
For high-stakes outputs (production code, published content), separate critic is worth the cost.
The empirical gain
On standard benchmarks, reflection improves output quality by 5-20% over no reflection. Bigger gains on complex reasoning tasks, smaller on factual retrieval.
Infinite reflection loops
Without a stop condition, reflection can run forever. Cap at 2-3 iterations and accept diminishing returns.