Self-refine

Also known as: iterative self-refinement

On this page 7

Self-refine is a prompting technique in which a single language model produces an initial answer, writes specific feedback on its own output, and then rewrites the answer using that feedback, repeating the cycle until a stopping condition is met. In prompting, it belongs to the family of iterative self-refinement methods that improve quality at inference time without fine-tuning, extra training data or a second model.

The approach was formalized in 2023 research on large language models, which framed it as three roles played by one model: generator, critic and refiner. It works best on tasks where quality is easy to judge but hard to achieve in one pass, such as style, readability, constraint satisfaction and code clarity.

How the self-refine loop works

Self-refine runs a feedback-and-rewrite loop controlled entirely by prompts. Each stage uses its own instruction and usually its own few-shot examples, and the model sees the history of earlier drafts and critiques so that it does not repeat mistakes it has already identified.

The following table describes the three stages and what each prompt must contain.

StageInput to the modelExpected output
Initial generationTask instruction and examplesA first complete draft
Self-feedbackTask, draft and a critique promptConcrete, actionable criticism by dimension
RefinementTask, draft history and feedbackA revised draft that addresses the feedback
The three stages of a self-refine iteration

The quality of the loop depends mostly on the feedback prompt. Useful feedback is specific and actionable, for example naming the sentence that is too long or the function that recomputes a value, rather than a generic verdict such as “could be better”. Feedback that scores several named quality dimensions gives the refiner a clear target.

Stopping conditions and key parameters

A self-refine loop needs an explicit stopping rule, because a model asked to criticize will almost always find something to change. In practice, implementations combine a maximum iteration count with a signal from the feedback step.

ParameterTypical settingEffect
Maximum iterations2 to 4 roundsCaps cost and latency
Stop signalFeedback states no further changesEnds early when the draft is acceptable
Score thresholdFor example 8 of 10 on every dimensionMakes the stop decision measurable
History lengthAll drafts or only the latestTrades context cost against repetition control
TemperatureLow for feedback, moderate for draftsKeeps critique consistent while allowing rewrites
Parameters that control a self-refine loop

Gains are usually largest in the first one or two iterations and then flatten. Each round adds roughly two extra model calls, so a three-round loop costs several times as many tokens as a single answer, and the output can drift or degrade if the loop runs too long.

Self-refine differs from neighboring techniques mainly in where the feedback comes from and whether the answer is rewritten. The table places it among related methods from the same area of prompting.

TechniqueSource of feedbackWhat changes
Self-refineThe same model, in natural languageOne answer is rewritten repeatedly
Self-consistencyNo feedback, majority voteSeveral answers are sampled and compared
Chain-of-verificationModel answers its own check questionsFactual claims are verified and corrected
ReflexionExternal signal such as test resultsA reflection is stored for the next attempt
Iterative promptingA human userThe user edits the prompt between turns
Self-refine and neighboring techniques

The most important distinction is between intrinsic and grounded feedback. Self-refine in its pure form is intrinsic: the model judges itself with no outside evidence. Methods that add compiler output, unit tests, search results or a separate judge model tend to be more reliable on tasks where correctness, rather than style, is the goal.

Where self-refine works and where it fails

Self-refine is most effective when the model can recognize a better answer more easily than it can produce one. This asymmetry exists for many writing and formatting tasks, but not for multi-step reasoning, where a model that made an error often cannot detect the same error on review.

Task typeExpected benefitReason
Rewriting and tone adjustmentHighStyle flaws are easy to name and fix
Constrained generationHighMissing constraints can be checked one by one
Code readability and efficiencyModerate to highFeedback can point to specific lines
Arithmetic and logic problemsLow or negativeThe model rarely finds its own reasoning error
Factual questionsLow without retrievalSelf-review cannot supply missing knowledge
Suitability of self-refine by task type

Later studies reported that intrinsic self-correction can lower accuracy on reasoning benchmarks, because the model sometimes changes a correct answer into an incorrect one. The safe conclusion is that self-refine improves quality judged by clear criteria, but should not be relied on to fix correctness without an external check.

Designing effective self-refine prompts

Well-designed self-refine prompts separate the critic from the writer and give the critic a fixed rubric. The following practices reduce wasted iterations and drift.

  • Define three to five named criteria in the feedback prompt, such as accuracy, concision and adherence to format.
  • Ask the critic to quote the problematic passage and propose a concrete fix for each issue.
  • Instruct the refiner to change only what the feedback names, which prevents unrelated rewrites.
  • Use a structured output format, for example JSON with scores, so code can read the stop signal.
  • Log every draft and critique, because the history is essential for debugging and prompt evaluation.

The short version

Self-refine asks an AI model to check and improve its own work. The model writes a first draft, then reads it like an editor and lists what is wrong, then writes a better version based on that list. The cycle can repeat a few times.

It is similar to a student who drafts an essay, rereads it with a red pen and rewrites it. The method helps most with clarity, tone and following instructions. It helps much less when the first answer is wrong because of a reasoning mistake, since the same mind that made the error often misses it on review.

Where it makes a difference

A software company generates release notes from lists of merged changes. A single prompt often produced notes that were too technical, exceeded the 150-word limit for the product dashboard, or forgot to mention breaking changes. The team added a self-refine loop with a maximum of three rounds: the critic scores each draft from 1 to 10 on audience fit, length and completeness of breaking changes, and the loop stops when every score reaches 8.

In internal review over two months, editors reported that most drafts stopped after one revision and needed noticeably fewer manual corrections than before. Token costs rose by about 2.5 times per note, which the team accepted because each note is short. For the separate task of computing version numbers, however, the team kept a deterministic script, since self-review did not reliably catch numbering errors.