Self Refine

Also known as: iterative self-improvement, self-critique loop, self-refinement

Self Refine
Self Refine is a prompting technique where a language model generates an initial output, critiques it using task-specific quality criteria, and revises it — cycling through generate-critique-refine until the critique signals no further improvement, with no external verifier or human labels required.

Self Refine is a prompting technique where a language model generates an initial output, critiques it against quality criteria, and rewrites it — cycling this loop until the critique finds nothing left to fix.

What It Is

Most language models are one-shot by default: you send a prompt, you get a response. Self Refine breaks that pattern by adding two extra steps after every generation — a critique pass and a refinement pass. The same model that generated the output turns around and evaluates it, then rewrites based on what it found. The result is a three-step loop: generate, critique, refine.

The technique exists because language models have an asymmetric skill set. Generating a correct, well-structured answer from scratch is harder than spotting what is wrong with a draft already in front of you. A model that produces mediocre code on the first pass can often identify the exact problems in that code when asked to review it — and fix them in a subsequent pass. Self Refine turns this asymmetry into a systematic quality lever.

How the loop works in practice:

  1. Generate — the model produces an initial response to the task prompt.
  2. Critique — the same model receives the task, the initial response, and a critique prompt specifying what quality criteria to check. It returns a list of issues or an “approved” signal.
  3. Refine — the model receives the original task, the initial response, and the critique, then produces a revised version.

Steps 2 and 3 repeat until the critique returns no issues or the iteration limit is reached. In most implementations, two to three passes capture most of the quality gain.

Think of a writer who drafts a paragraph, reads it back for clarity and completeness, then edits. Self Refine automates that edit cycle inside a single model — no pen required, no second reader.

In the context of Constitutional AI prompting, Self Refine and critique-revision loops share the same underlying logic: a model evaluating its own output against a set of criteria, then rewriting to align with them. The distinction is in scope and timing. Constitutional AI applies the critique-revision approach during training, shaping the model’s weights so it internalizes the principles permanently. Self Refine applies it at inference time, injecting quality criteria fresh each call through the prompt. One changes the model; the other changes a single output in the moment.

No separate verifier model is required. No human annotation is needed during the loop. The entire process runs within a single model session, with quality criteria specified in plain language inside the prompt.

How It’s Used in Practice

The most common place people encounter Self Refine is inside AI coding assistants and agent frameworks. When you ask Claude, ChatGPT, or Cursor to “review and improve” the code it just generated, you are manually triggering the same loop. Frameworks like DSPy formalize this into a module that wraps your task prompt in a generate-critique-refine pipeline, so you do not have to craft the prompt logic each time.

Beyond code, teams use Self Refine for email drafting (critique prompt: “Is this too formal? Too long? Is the request clear?”), SQL query generation (critique prompt: “Check for unintended full table scans and ambiguous column references”), and structured content generation (critique prompt: “Verify all required fields are populated and no placeholder text remains”).

The loop also shows up in agentic workflows where a planning step produces a task list, a critique step checks it for conflicts or missing dependencies, and a revision step tightens the plan before any actions run.

Pro Tip: Specify your critique criteria explicitly — “Check whether the response answers the question directly, uses plain language, and stays under 150 words.” Vague critique prompts like “make this better” produce vague refinements. The more concrete your quality criteria, the more targeted the revision.

When to Use / When Not

ScenarioUseAvoid
Code generation where test failures give concrete critique fodder
Short factual Q&A where a single accurate answer is sufficient
Structured content with explicit, checkable quality criteria
Real-time applications where each added model call increases latency visibly
Summarization where conciseness can be verified in the critique step
Open-ended creative work with no objective quality ground truth

Common Misconception

Myth: Self Refine requires a second, separate “critic” model to evaluate the output — similar to how reinforcement learning from human feedback uses a trained reward model.

Reality: The same model generates, critiques, and refines. The critique step is the model operating in a different prompt context — evaluator instead of generator. Quality criteria arrive via the prompt, not a trained reward signal. One model, three roles, one session.

One Sentence to Remember

Self Refine is the prompt-level edit cycle: the model generates a draft, identifies its own flaws, and rewrites — the same loop a careful writer runs, automated inside a single model.

FAQ

Q: How many iterations does Self Refine typically need? A: Two to three iterations capture most of the quality gain. Beyond that, improvements shrink and compute costs compound — the model’s own critique usually signals when the output is good enough.

Q: Does Self Refine work with smaller language models? A: Larger, more capable models benefit most. Smaller models may not accurately critique their own outputs, producing shallow feedback or oscillating between versions without meaningful improvement.

Q: How does Self Refine differ from chain-of-thought prompting? A: Chain-of-thought prompts the model to reason step-by-step before a final answer — still one pass. Self Refine generates a complete answer first, then feeds it back for critique and revision across multiple passes.

Expert Takes

Self Refine works because a model’s discriminative ability — spotting flaws — consistently outperforms its generative ability on the same task. Producing a perfect draft in one pass is harder than identifying what is wrong with a draft already in front of you. The critique step leverages this asymmetry: the model switches from generator to evaluator, applies quality criteria injected via prompt, then switches back to revise. No training required. No external judge.

Self Refine fits any prompt-chaining workflow. Wrap your existing task prompt in a three-step loop: generate → critique (feed the output back with evaluation criteria) → refine (feed both back for a rewrite). In agent frameworks like DSPy, the critique criteria become learnable parameters. Start simple: two passes, explicit criteria in the prompt, stop when the critique returns nothing to fix. The implementation cost is low; the quality gain is consistent.

Every team building with LLMs hits the same wall: the first pass is good but not production-ready. Self Refine is what separates “call the API once and ship” from “systematically drive up output quality at the prompt level.” Marketing teams use it on ad copy. Developers use it on code review. The real play: baking your product’s quality criteria into the critique prompt. Your model is not just generating anymore — it is enforcing a bar.

Self Refine looks like a model correcting itself. What it is actually doing is enforcing criteria someone wrote into the critique prompt. In constitutional AI contexts, those criteria carry the value choices of whoever authored them. The loop does not reduce human influence — it concentrates it at the critique specification, earlier in the process and harder to audit than a visible rating or a human label. The question is not whether to use it. It is whose criteria are doing the refining.