Self Refine: Definition and Examples
Self Refine is a technique where a language model generates an initial response, then evaluates and improves it iteratively without human intervention, resulting in a higher quality output.
Full definition
Self Refine is an iterative improvement approach in which a large language model (LLM) simultaneously plays the roles of generator, critic, and reviser. Instead of producing a single response, the model first produces an initial draft, then analyzes it to identify weaknesses, and finally rewrites it incorporating its own feedback. This cycle can be repeated several times until a satisfactory quality level is reached.
This technique is directly inspired by the human writing process: one rarely writes a perfect text in a first draft. We reread, identify weak passages, rephrase, restructure. Self Refine replicates this cognitive mechanism by formalizing it in a structured prompt. The key lies in the model's ability to step back from its own output and apply explicit evaluation criteria.
Concretely, a Self Refine prompt decomposes into three distinct phases: initial generation, feedback (where the model critiques its own output according to defined criteria), and revision (where it produces an improved version integrating that feedback). Each phase can be handled in a separate prompt or chained within the same exchange. The major advantage is that no additional model or training data is needed.
Self Refine was formalized in a 2023 research paper by Madaan et al. and demonstrated significant improvements on diverse tasks such as code generation, mathematical reasoning, writing, and dialogue. This technique has become a pillar of advanced prompt engineering and naturally combines with other approaches like Chain of Thought or multi-agent systems.
Etymology
The term 'Self Refine' comes from English and literally means 'self-refine' or 'refine oneself'. It was popularized by the academic paper 'Self-Refine: Iterative Refinement with Self-Feedback' published in 2023 by Aman Madaan and collaborators at Carnegie Mellon University. The choice of term emphasizes the autonomy of the process: the model itself corrects itself without external supervision.
Concrete examples
Improving the quality of a professional email
Step 1: Write a professional email requesting a deadline extension from a client.
Step 2: Now, critique this email according to these criteria: tone (professional but empathetic), clarity of the request, proposal of alternative solution, appropriate length. List each weakness.
Step 3: Rewrite the email by correcting each identified weakness.
Optimizing Python code
Generate a Python function that sorts a list of dictionaries by multiple keys.
Now, evaluate this code against: readability, performance, edge case handling, and PEP 8 compliance. Identify each issue.
Produce an improved version that corrects all identified issues, explaining each modification.
Refining an argument in an essay
Write an argumentative paragraph on the impact of generative AI in education.
Evaluate this paragraph: is the thesis clear? Are the arguments supported by concrete examples? Are there biases or overgeneralizations? Does the paragraph anticipate counterarguments?
Rewrite the paragraph incorporating all suggested improvements.
Practical usage
To apply Self Refine, structure your prompt into three explicit steps: generation, critique with precise criteria, then revision. Always define the evaluation criteria in advance (clarity, relevance, tone, completeness) to guide the feedback phase effectively. You can repeat the critique-revision cycle two to three times for complex tasks, but beyond that, marginal gains typically diminish.
Related concepts
FAQ
What is the difference between Self Refine and simply asking 'improve your response'?
How many iterations of Self Refine are needed to get a good result?
Does Self Refine work with all language models?
See also
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- Replace the bracketed variables with your details, then refine the result.
About Prompt Guide
Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.
More definitions
Semantic Cache: Definition and Examples
A semantic cache is a caching system that stores and retrieves AI model responses based on the semantic similarity of queries, rather than exact word matches.
Semantic Kernel: Definition and Examples
Semantic Kernel is an open-source SDK developed by Microsoft that allows integrating language models (LLMs) into traditional applications by orchestrating plugins, memory, and automatic planning.
Semantic Search: Definition and Examples
Semantic search is an information retrieval technique that understands the meaning and intent behind a query, rather than just matching keywords.
Sentiment Analysis: Definition and Examples
Sentiment analysis (or opinion mining) is a natural language processing (NLP) technique that automatically identifies and extracts opinions,
Skeleton Of Thought: Definition and Examples
Prompting technique that involves asking the model to first generate a structural skeleton of its response (key points, outline), then develop each
Small Language Model: Definition and Examples
A Small Language Model (SLM) is a compact language model, typically with fewer than 10 billion parameters, designed to deliver targeted performance
Get new prompts every week
Join our newsletter.