Course contentsShow
← Machine Learning and Deep Learning
Lesson 1941 of 3,53841. Structured Output and Tool CallingFree lesson

Stopping Criteria for Refinement

Determining when iterative refinement has converged or when to halt improvement attempts.

Stopping Criteria for Refinement

What you'll learn: How to decide when your iterative self-critique and refinement loop has done enough work and should halt.

The Challenge of Knowing When to Stop

When using techniques like self-critique and multi-step refinement, your LLM can theoretically keep improving outputs forever. But each refinement costs tokens, time, and money. You need clear rules for when to stop—otherwise you'll either waste resources on diminishing returns or stop too early and miss meaningful improvements.

Think of it like polishing a gemstone: early passes remove rough edges dramatically, but eventually you're just buffing the same surface with minimal visible change. The art is knowing when "good enough" has arrived.

Common Stopping Criteria

Fixed Iteration Count

The simplest approach: refine exactly N times (e.g., 3 rounds). Predictable but ignores whether improvements are still happening.

No-Change Detection

Stop when the critique identifies no issues or suggests no modifications. If the self-critique says "This output is accurate and complete," you're done.

Improvement Threshold

Measure output quality (via scoring, validation checks, or comparison). Stop when improvement between iterations drops below a threshold (e.g., quality score increases by less than 5%).

Token/Cost Budget

Set a maximum token budget for refinement. Once exhausted, accept the best result so far.

Validation Pass

Stop when output passes all schema validation, required field checks, or functional tests. If it meets specifications, further refinement is optional.

Hybrid Approaches

Combine criteria: "Stop after 5 iterations OR when no changes occur OR when validation passes—whichever comes first."

Practical Considerations

Balance quality needs against resource constraints. Critical applications (medical, legal) justify more refinement iterations. High-volume, low-stakes tasks may use stricter stopping rules.

Key Takeaway: Effective stopping criteria balance output quality with efficiency by defining clear conditions (iteration limits, improvement thresholds, validation gates) that prevent both premature termination and wasteful over-refinement.