Reflection PatternsOpen in Colab
Agentic project loop
Task definition·Context & tools·Orchestration loop·Evaluation·Guardrails·Operations feedback

Reflection Patterns

Foundation model agents hallucinate. Not occasionally — structurally. A single forward pass through a language model is a one-shot bet: the model generates output that is plausible given its training distribution, but plausibility is not correctness. For low-stakes tasks, that bet is often good enough. For high-stakes generation (medical summaries, legal drafts, code that will be deployed, financial analysis), a single pass is insufficient.

Reflection patterns are the structural answer: rather than hoping the first generation is correct, an agent is given explicit mechanisms to critique and revise its own output, or to receive critique from an external source. Reflection turns generation into a loop, and loops compound quality.

Real-world examples: code agents that self-debug failing tests, writing assistants that self-edit for factual accuracy, multi-agent pipelines where one model grades another's output, medical summarization systems with mandatory human review before delivery.

Why agents hallucinate — and why reflection helps

A language model's output is sampled from a conditional distribution: p(output∣prompt)p(\text{output} \mid \text{prompt}). This distribution is learned from training data and compressed into billions of parameters. Two structural properties cause hallucination:

  1. The model has no ground truth oracle. It cannot look up facts — it pattern-matches. When a pattern is absent or rare in training data, the model fills the gap with a plausible continuation that may be factually wrong.
  2. Autoregressive generation compounds errors. Each token is conditioned on all previous tokens. A wrong token early in the sequence shifts the distribution for every subsequent token — a cascade.

Reflection exploits a well-documented asymmetry: models are better at detecting errors than avoiding them. Given a draft and the question "what is wrong with this?", a model often finds mistakes it would not have avoided in the original generation. This is the same asymmetry that makes code review easier than code writing.

The critique asymmetry

Evaluating a claim requires less knowledge than generating it correctly from scratch. A model that hallucinates "Einstein won the Nobel Prize in 1922 for relativity" will often correctly flag that error when shown the statement and asked to fact-check it. Reflection puts the model in the easier evaluator position on its own output.

Self-Reflection

Self-Reflection is the simplest reflection pattern: a single agent critiques and revises its own output. The loop has three phases:

  1. Generate: produce an initial draft d0d_0.
  2. Critique: evaluate d0d_0, producing a structured critique c0c_0 listing identified problems.
  3. Revise: incorporate c0c_0 to produce a revised draft d1d_1.

Repeat from step 2 until a stopping criterion is met.

Text
Agent → generates draft d₀
Agent → critiques d₀ → produces critique c₀: ["claim X is unsupported", "step 3 is incorrect"]
Agent → revises d₀ using c₀ → produces d₁
Agent → critiques d₁ → produces critique c₁: ["minor clarification needed in conclusion"]
Agent → revises d₁ using c₁ → produces d₂
Stopping condition met → return d₂

Why it works

The key insight is that generation and critique use different sub-skills. When generating, the model is constrained to produce fluent, forward-moving text — errors get locked in early. When critiquing, the model can read the output globally, compare claims against each other, and notice inconsistencies. The critique step breaks the local coherence trap.

Forces

ForceEffect
LatencyEach generate-critique-revise cycle adds 2–3× the base generation time
CostProportional to iterations: 3 iterations ≈ 4–6× the single-pass cost
Error reductionStrong for factual errors, reasoning gaps, and format inconsistencies
IndependenceNone: the same model with the same biases critiques itself

When to use Self-Reflection

Self-Reflection is appropriate when:

  • The task has verifiable correctness criteria (code that must compile, math that must check out, structured data that must be valid)
  • Latency tolerance is moderate — a few seconds of extra processing is acceptable
  • Cost matters but not critically — 2–3 iterations are often enough
  • There is no second agent or human available to review

Structured critique prompts matter

Vague critique prompts ("Is this good?") produce vague critiques. Force structure: "List specific factual errors. List reasoning gaps. List missing information. Rate overall quality 1–5." Structured critique gives the revision step concrete targets.

Cross-Reflection

Cross-Reflection introduces a second, independent agent as the critic. Agent A produces a draft; Agent B critiques it; Agent A (or a third agent) revises it. The key property is that Agent B has no access to Agent A's internal reasoning — it sees only the output, just as an external reviewer would.

Text
Agent A → generates draft d₀
Agent B → reads d₀, produces critique c₀ (independent review)
Agent A → revises d₀ using c₀ → produces d₁
(Optional: Agent B or Agent C reviews d₁ → repeat)

Why it works: independence and diversity

Self-Reflection is bounded by the model's own blind spots. If Agent A has a systematic bias (a false belief baked in from training, a tendency to over-claim), the same bias will appear in both the generation and the critique. Agent A can't see what it can't see.

Cross-Reflection provides independent error detection: Agent B has its own knowledge representation, its own sampling path, and potentially different training. Errors that are consistent with Agent A's training distribution may be inconsistent with Agent B's, making them detectable.

If Agent A and Agent B are different model checkpoints, different temperatures, or prompted with different personas, Cross-Reflection also provides perspective diversity: the critique surface is wider.

Ensemble reasoning

Cross-Reflection is the critique analogue of ensemble methods in supervised learning. Just as averaging multiple classifiers reduces variance, routing an output through multiple independent critics reduces the chance that a systematic error goes undetected.

Forces

ForceEffect
IndependenceHigh: separate model or sampling path eliminates shared blind spots
Error diversityCatches errors that self-reflection misses
Coordination overheadTwo agents must be orchestrated; messages passed between them
CostHigher than self-reflection: two LLM calls per round minimum
LatencyCan be parallelised partially (B reviews while A drafts the next round)

When to use Cross-Reflection

Cross-Reflection is appropriate when:

  • Systematic bias is a concern — the generating model may have consistent knowledge gaps
  • The task requires independent validation (e.g. code review, adversarial robustness testing)
  • You have multiple model instances available (different checkpoints, different temperatures)
  • The domain is specialized and different models may have different relevant knowledge

Human Reflection

Human Reflection places a human in the critique role at a critical checkpoint. The agent generates a draft; a human reviews it; the agent revises (or a human directly edits) before the output is used.

Text
Agent → generates draft d₀
Human → reviews d₀ → provides critique or approval
Agent → revises d₀ using human feedback → produces d₁
(If irreversible action: human → approves before execution)

Human Reflection is the gold standard for accuracy — humans can draw on world knowledge, lived experience, and domain expertise that no current model reliably replicates. But it is synchronous on human availability: the agent must wait.

Forces

ForceEffect
AccuracyHighest: humans catch subtle errors, ethical issues, context mismatches
LatencyUnbounded: depends entirely on human response time
ThroughputLimited by the number of human reviewers
Human overheadRequires trained reviewers for specialized domains
IrreversibilityOnly pattern that can reliably gate irreversible actions

When to use Human Reflection

Human Reflection is required when:

  • The action is irreversible — sending an email to a large list, executing a trade, modifying production data
  • The domain is regulated — medical, legal, financial outputs that require human accountability
  • Failure cost is catastrophic — the cost of an error exceeds the cost of human review
  • The organization requires a human decision-maker to be in the chain of accountability

Human review doesn't scale automatically

Human Reflection is the highest-quality pattern but creates a throughput bottleneck. Design it for the checkpoints that genuinely require it — not every step. If you route every agent output through human review, you've built an expensive manual process, not an agent.

The reflection loop: iterations and convergence

How many reflection iterations are needed? The answer follows a diminishing returns curve.

Let qnq_n be the quality of the output after nn iterations (on a 0–1 scale where 1 is perfect). Empirically, quality improvement per iteration decreases:

Δqn=qn−qn−1≈α⋅(1−qn−1)\Delta q_n = q_n - q_{n-1} \approx \alpha \cdot (1 - q_{n-1})

where α∈(0,1)\alpha \in (0, 1) is the per-iteration improvement rate (typically 0.3–0.6 in practice). This gives a recurrence that converges geometrically:

qn≈1−(1−q0)(1−α)nq_n \approx 1 - (1 - q_0)(1 - \alpha)^n

Substituting typical values (q0=0.65q_0 = 0.65, α=0.45\alpha = 0.45):

IterationQualityΔq\Delta q
0 (draft)0.65—
10.81+0.16
20.89+0.08
30.93+0.04
40.95+0.02

Most of the gain comes in the first 1–2 iterations. Beyond 3, the cost-benefit ratio becomes unfavorable for most tasks.

Convergence criteria

Rather than fixing the number of iterations, use one of these stopping rules:

  1. Quality threshold: stop when the critic scores the output above a target (e.g. "no major issues found").
  2. Delta threshold: stop when Δqn<δ\Delta q_n < \delta for a small δ\delta (the critic finds only trivial issues).
  3. Maximum iterations: always set an upper bound NmaxN_\text{max} to cap cost and prevent loops.
  4. No new issues: stop when the critique is empty or identical to the previous critique.

In production, combine rules 1 and 3: target quality plus a hard cap.

Make the stopping criterion explicit in the prompt

Tell the critic exactly when to say "no further revisions needed." Without this, models tend to always find something to criticize (even minor stylistic issues), which keeps the loop running past the point of diminishing returns.

Choosing a reflection pattern

Use this decision tree to select the right pattern for a given scenario:

Code
Is the action irreversible or regulated?
├── Yes → Human Reflection (required)
└── No
    Is systematic model bias a concern (domain-specific knowledge gaps)?
    ├── Yes → Cross-Reflection (independent agent critic)
    └── No
        Is the output high-stakes enough to justify 2–3 extra LLM calls?
        ├── Yes → Self-Reflection (2–3 iterations with structured critique)
        └── No → Single-pass generation (no reflection)

Comparison table

PatternLatency multiplierCost multiplierError independenceHuman overheadBest use case
None1×1×—NoneLow-stakes, reversible
Self-Reflection3–5×3–5×Low (same model)NoneHigh-stakes text/code generation
Cross-Reflection3–6×4–8×High (different model)NoneAdversarial, domain-bias-prone tasks
Human ReflectionUnboundedHigh (human time)CompleteSignificantRegulated, irreversible actions

Patterns can be composed: a pipeline might use Self-Reflection for a first quality pass, Cross-Reflection for independent validation, and Human Reflection as a final gate before any irreversible action.

Exercise

A medical diagnosis agent sends its draft report to a separate 'critic' agent before finalising. Which reflection pattern is this?

Need a hint?

Is the critic the same agent or a different one?

Exercise

For which scenario is Human Reflection the most appropriate pattern?

Need a hint?

Think about irreversibility and regulatory requirements.

Key takeaways

  • Foundation models hallucinate structurally; a single forward pass has no built-in correction mechanism. Reflection patterns introduce explicit critique-and-revise loops.
  • Self-Reflection (generate → critique → revise) exploits the asymmetry between generating and evaluating — the same model is better at spotting errors than avoiding them. Best for high-stakes generation when latency is acceptable.
  • Cross-Reflection routes output through an independent agent critic, eliminating the shared blind spots of self-critique. Best when systematic model bias is a concern.
  • Human Reflection places a human at critical checkpoints — highest accuracy, but synchronous on human availability. Required for irreversible or regulated actions.
  • Quality improvement per iteration follows a diminishing returns curve; most gain comes in iterations 1–2. Always set a maximum iteration cap alongside a quality threshold.
  • Patterns compose: use Self-Reflection for quality, Cross-Reflection for independence, Human Reflection for irreversibility.

Related concepts

  • Model Querying Patterns: single-pass generation, chain-of-thought, and tool-augmented querying that feed into the reflection loop
  • Multi-Agent Cooperation: how reflection patterns compose with orchestration, delegation, and specialization in larger agent systems

Concept neighbourhood

How this concept connects — click any node to jump there, or explore the whole concept map.

Builds onRelatedGo deeper
Reflection PatternsBuilding with LLMsAttention & TransformersModel Querying PatternsMulti-Agent Cooperation P…Evaluating AgentsSub-Agent Types: Sequenti…The Agentic Project Loop