---
title: "Reflection Loop"
summary: "Scores each draft against a fixed rubric, feeds the critique into a revision, and repeats until the draft passes a threshold or the retry budget ends"
status: "established"
category: "Feedback Loops"
url: "https://agentic-patterns.com/patterns/reflection"
source: "https://arxiv.org/abs/2303.11366"
authors: ["Nikola Balic (@nibzard)"]
tags: ["self-feedback","iterative-improvement","evaluation"]
signals: ["Output must meet explicit quality criteria","Single-pass answers miss edge cases or constraints","Writing, reasoning, or code tasks with a clear scoring metric"]
anti_signals: ["No well-defined metric to score drafts","Extra compute per answer is not acceptable"]
updated_at: "2026-10-13"
---

# Reflection Loop

> Scores each draft against a fixed rubric, feeds the critique into a revision, and repeats until the draft passes a threshold or the retry budget ends

## Use when

- Output must meet explicit quality criteria
- Single-pass answers miss edge cases or constraints
- Writing, reasoning, or code tasks with a clear scoring metric

## Avoid when

- No well-defined metric to score drafts
- Extra compute per answer is not acceptable

## Problem

Single-pass generation frequently misses edge cases, constraints, or quality criteria that become obvious on review. Without a structured revision loop, agents return the first plausible answer even when a better answer is reachable with lightweight critique.

## Solution

After generating a draft, run an explicit self-evaluation pass against defined criteria and feed the critique into a revision attempt. Repeat until the output clears a threshold or retry budget is exhausted.

Use stable scoring rubrics (correctness, completeness, safety, style) so the loop improves objective quality rather than free-form restyling. For reduced bias, use a separate model for critique (dual-model architecture) at the cost of additional compute.

```pseudo
for attempt in range(max_iters):
    draft = generate(prompt)
    score, critique = evaluate(draft, metric)
    if score >= threshold:
        return draft
    prompt = incorporate(critique, prompt)
```

## How to use it

Use this when quality must meet explicit criteria in writing, reasoning, or code generation. Keep loop budgets small; there is no universally established optimum, so log score deltas per iteration and stop when the deltas flatten rather than assuming a fixed iteration count. Note that 2025-2026 reasoning models already internalize a form of self-checking in their thinking, so hand-rolled reflection scaffolds pay off mostly with non-reasoning models or when the rubric is domain-specific.

## Trade-offs

* **Pros:** Improves outputs with little supervision.
* **Cons:** Extra compute; may stall if the metric is poorly defined.

## References

* [Self-Refine: Iterative Refinement with Self-Feedback](https://arxiv.org/abs/2303.17651) - Madaan et al., 2023
* [Reflexion: Language Agents with Verbal Reinforcement Learning](https://arxiv.org/abs/2303.11366) - Shinn et al., NeurIPS 2023 - adds episodic memory for persistent learning across trials
