Loop Engineering · ~7 min
"It looks good enough" is not a stopping criterion. Replace the gut-feel halt with three signals you can measure across passes.
When a task has a test harness, stopping is solved: tests pass → stop. That is the PASS/FAIL gate an evaluator-optimizer leans on. Convergence detection fills the gap for everything that can't be unit-tested — by watching how the output moves between consecutive passes instead of guessing at its quality.
Monitor these across consecutive refinement passes. They are observable — you can compute each one from two adjacent drafts without judging quality:
| Signal | Converging | Diverging |
|---|---|---|
| Change velocity | rate of edits slows — pass N changes 30%, pass N+3 changes 2% | rate stays high or accelerates |
| Output size | size stabilises or shrinks — additive passes exhausted | size grows — scope creep, not refinement |
| Content similarity | diff between passes shrinks toward zero | diff stays large — issues unresolved |
Notice that growing output is a divergence signal, not progress. A pass that keeps adding words is drifting scope, not closing in — refinement subtracts and tightens more than it adds.
Three patterns mean the loop is stuck and needs a restart — a redesign or external input — rather than another pass:
The signals tell you the output has stopped moving — not that it is right. On RefineBench (1,000 problems, 11 domains), self-refinement without external feedback gained ≤1.8 points over five iterations, and frontier models routinely halted early on overconfidence while errors remained. A stable state can be self-bias, not quality. For high-stakes outputs, pair convergence with an external checker — tests, a second model, or a human.
For critical outputs — major design specs, agent system prompts, architectural decisions — run the identical critique prompt five consecutive times against the same output. A single critique pass produces false confidence; each repeated pass surfaces issues the previous one normalized over, forcing examination of progressively subtler problems.
This is convergence detection applied to a critique loop: when pass 4 and pass 5 produce near-identical critiques with no new issues, content similarity has converged and the output is stable. Running a sixth pass would likely produce cosmetic churn that introduces unnecessary variation and may degrade quality.
Convergence detection is one of four tools — match it to the task:
| Mechanism | When to use |
|---|---|
| Convergence detection | prose, specs, design docs — no test harness available |
| PASS/FAIL from evaluator | code tasks with executable tests — machine-checkable |
| Max round limit | fallback for all loops — prevents runaway iteration |
| Model self-declaration | low-cost tasks where precision matters less |
Retrieval practice — recall, don't peek
Question 1You should stop a refinement loop when…
Question 2An output that grows in size each pass is a sign of…
Question 3Oscillation, expansion, and a low-quality plateau all call for…
Question 4Convergence signals tell you the output is stable, but not that it is…
Question 5 · spaced recall from an earlier lessonBefore you debug a misbehaving loop, the first move is to…