Self-Refine is a prompting architecture that enables a single large language model to act as both the generator and the critic. The process begins with an initial output for a given task. The same model is then prompted to provide specific, actionable feedback on its own draft, identifying flaws in logic, factual accuracy, or style. This critique is fed back into the model's context window to guide a subsequent refinement step, creating a closed-loop improvement cycle.
Glossary
Self-Refine

What is Self-Refine?
Self-Refine is an iterative prompting framework where a single large language model generates an initial output, provides its own feedback on that output, and then uses the critique to produce a refined version, all without external supervision or fine-tuning.
This framework mimics human iterative writing without requiring a separate critic model or reinforcement learning. By leveraging the model's intrinsic ability to evaluate text, Self-Refine improves output quality on tasks like code generation, dialogue response, and mathematical reasoning. The technique is distinct from Reflexion, which relies on external environmental feedback, as Self-Refine uses purely internal, linguistic self-critique to drive the optimization process.
Core Characteristics of Self-Refine
The Self-Refine framework is defined by a closed-loop architecture where a single language model acts as both generator and critic. This section breaks down the distinct phases and mechanisms that enable autonomous output improvement without external supervision.
The Iterative SELF-REFINE Loop
The core mechanism is a cyclical process executed by a single LLM. The model first generates an initial output for a given task. It then enters a self-feedback phase, where it critiques its own output based on the task constraints. Finally, it uses this critique to produce a refined output. This loop can repeat multiple times, with each iteration using the previous output and feedback as context, leading to progressively higher-quality results.
Instantiation via Few-Shot Prompting
Self-Refine is not a fine-tuning method but a prompting architecture. The generator, feedback, and refiner roles are instantiated within the model's context window using carefully designed few-shot examples. A typical prompt includes:
- Task description: The initial instruction.
- Few-shot examples: Demonstrations of a draft output, a critique of that draft, and the resulting refined version.
- Inference instruction: A command to apply the same draft-critique-refine process to a new input.
Structured Feedback Generation
The quality of the critique is the linchpin of the framework. The model is prompted to generate actionable, specific feedback rather than vague judgments. Effective feedback identifies concrete flaws, such as logical gaps, missing constraints, or stylistic inconsistencies. The framework can be adapted to solicit feedback on multiple dimensions (e.g., factual accuracy, code efficiency, tone) by structuring the feedback prompt to address each dimension sequentially.
Joint Optimization of Generation and Critique
A key insight is that the model jointly optimizes both the generation and the critique. The act of generating a critique forces the model to re-evaluate its own output distribution, effectively performing a form of internal self-consistency check. This process allows the model to catch errors that are often invisible during a single forward pass, such as subtle contradictions or arithmetic mistakes, by explicitly verbalizing a critical review.
Domain-Agnostic Applicability
The framework is universally applicable across task modalities. It has demonstrated significant performance gains in:
- Dialogue Response Generation: Improving specificity and empathy.
- Code Optimization: Refining for time complexity and readability.
- Mathematical Reasoning: Correcting calculation steps.
- Acronym Generation: Ensuring relevance and memorability.
- Constrained Text Generation: Adhering to strict lexical rules.
Momentum and Stopping Criteria
While performance generally improves with iterations, the framework is subject to diminishing returns and potential over-correction. A stopping condition is often implemented by comparing the current output to the previous one. If the model's feedback indicates 'no further improvements needed' or if the semantic similarity between consecutive outputs exceeds a threshold, the loop terminates to prevent unnecessary computation or degradation.
Frequently Asked Questions
Clear, technical answers to the most common questions about the Self-Refine prompting framework, its mechanisms, and its role in autonomous quality control.
Self-Refine is an iterative prompting framework where a single large language model (LLM) generates an initial output, provides its own feedback on that output, and then uses the critique to produce a refined version. The process operates in a continuous loop without external supervision. The mechanism involves three distinct stages within a single model call: first, an initial generation phase produces a draft; second, a feedback phase critiques the draft against specific constraints (e.g., tone, factual accuracy, code safety); third, a refinement phase uses the original draft and the generated feedback as context to produce an improved output. This loop repeats until a stopping condition is met, such as a maximum number of iterations or the model's feedback indicating no further improvements are necessary. The framework is Madaan et al., 2023 and demonstrates that a single model can effectively act as its own quality-control agent, iteratively elevating output quality without fine-tuning or external reward models.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Self-Refine vs. Related Refinement Techniques
A feature-level comparison of Self-Refine against other prominent frameworks that use language models to critique and improve their own outputs.
| Feature | Self-Refine | Reflexion | Chain-of-Verification |
|---|---|---|---|
Core Mechanism | SAME model generates output, provides feedback, and refines | Agent reflects on failure signals stored in episodic memory to improve future attempts | Model generates initial response, then drafts and answers verification questions to self-correct |
Feedback Source | Internal self-critique via natural language | External scalar reward or binary success/failure signal from environment | Internal fact-checking via independently generated verification questions |
Memory Architecture | Stateless; only current context window used | Persistent episodic memory storing past reflections and outcomes | Stateless; verification Q&A pairs exist only within single generation |
Iteration Scope | Single-turn refinement loop (generate → critique → refine) | Multi-episode learning across sequential task attempts | Single-pass verification and correction cycle |
Primary Use Case | Improving output quality on code generation, dialogue, and writing tasks | Autonomous agents learning from trial-and-error in interactive environments | Reducing factual hallucinations in knowledge-intensive generation |
Requires External Tools | |||
Stopping Condition | Fixed number of iterations or self-assessed satisfaction threshold | Task completion or maximum episode limit | Completion of verification question set |
Hallucination Mitigation | Indirect; relies on model's ability to self-critique factual errors | Indirect; improved reasoning through reflective memory | Direct; explicitly designed to fact-check and correct hallucinations |
Related Terms
Self-Refine is part of a broader class of techniques that enable language models to critique and improve their own outputs. These related concepts form the toolkit for building self-correcting AI systems.
Reflexion
An agentic framework that uses verbal reinforcement learning to improve reasoning. Unlike Self-Refine's immediate feedback loop, Reflexion stores failure signals and self-reflections in episodic memory, allowing the agent to learn from mistakes across multiple episodes and tasks.
- Uses a long-term memory module to persist critiques
- Applies lessons learned to future, unseen tasks
- Combines trial-and-error with linguistic self-analysis
Chain-of-Verification
A fact-checking framework where a model systematically reduces hallucination by generating a series of independent verification questions after its initial response. It then answers each question and cross-references the results to produce a corrected final output.
- 4-step process: Draft, Plan Verifications, Execute, Finalize
- Explicitly separates generation from fact-checking
- Reduces hallucination rates without external retrieval
STaR (Self-Taught Reasoner)
A bootstrapping technique that trains a model on its own correctly reasoned answers. The model generates rationales for problems, and those that lead to correct final answers are used as training data for fine-tuning. Incorrect rationales are discarded or corrected with hints.
- Iteratively improves intrinsic reasoning capabilities
- No external supervision required beyond final answer verification
- Enables models to self-improve on complex reasoning tasks
Process Supervision
A training methodology that provides feedback on each intermediate step of a reasoning chain, not just the final outcome. This contrasts with outcome supervision, which only evaluates the final answer. Process supervision is critical for training models to produce faithful, logically sound reasoning traces.
- Rewards correct logical progression
- Reduces post-hoc rationalization
- Used to train Process Reward Models (PRMs)
Self-Consistency
A decoding strategy that samples multiple diverse reasoning paths for a single problem and selects the most consistent final answer via majority voting. While Self-Refine improves a single chain, Self-Consistency exploits the wisdom of the crowd across multiple independent chains.
- Complements Self-Refine for complex reasoning tasks
- Effective when multiple valid paths lead to the same answer
- Increases reliability without additional training
Faithfulness Metric
A quantitative score measuring the degree to which a generated reasoning trace causally represents the model's true computational process. Self-Refine outputs must be evaluated for faithfulness to ensure the critique and refinement steps reflect genuine error correction rather than post-hoc rationalization.
- Distinguishes genuine reasoning from confabulation
- Critical for auditing Self-Refine pipelines
- Often measured via counterfactual interventions

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us