โ† All Techniques
๐Ÿ”ง

Self-Refine โ€” Prompting Guide & Examples

Self-Refine is a technique where the AI generates an initial response, critiques its own output, then produces an improved version. This iterative self-improvement cycle can be repeated multiple times, with each round producing better results.

How It Works

Three phases: (1) Generate an initial response, (2) Ask the model to critique that response identifying weaknesses, (3) Ask it to produce an improved version addressing the critique. Repeat steps 2-3 until quality is satisfactory.

When to Use

Use self-refine for writing tasks, code generation, creative content, and any output where quality matters more than speed. Especially effective for first drafts that need polishing, or when you want to catch errors before human review.

Model-Specific Tips

ChatGPT / GPT-4

GPT-4 handles self-refine excellently. Use a single conversation with 'Now critique...' and 'Now improve...' follow-ups, or chain API calls programmatically.

Claude

Claude is excellent at self-critique. Ask Claude to rate its output on specific dimensions, then improve. Claude's honesty about weaknesses makes self-refine very effective.

Gemini

Gemini supports self-refine well. Use multi-turn conversations to iterate. Gemini can maintain context across critique and improvement cycles.

Pros & Cons

Pros

  • โœ“ Significantly improves output quality
  • โœ“ Model catches its own mistakes
  • โœ“ Works for any content type
  • โœ“ Simple to implement in any workflow

Cons

  • โœ— 2-3x more tokens per task
  • โœ— Slower due to multiple rounds
  • โœ— Diminishing returns after 2-3 iterations
  • โœ— Model may not always identify real weaknesses

Example Prompts

Write a cold outreach email to a VP of Engineering about our API testing platform. Now critique this email: What's weak? What could be more compelling? What might make the recipient delete it? Now rewrite the email addressing every critique.

Generate a Python function that finds the k most frequent elements in an array. Review this code for: edge cases, performance, readability, and best practices. List all issues. Now produce a final version that fixes every issue you identified.

Write a product description for wireless noise-canceling headphones. Rate this description 1-10 on: specificity, emotional appeal, SEO value, and uniqueness. Explain each rating. Now write the best possible version scoring 9+ on all criteria.

FAQ

What is Self-Refine?
Self-Refine is a technique where the AI generates an initial response, critiques its own output, then produces an improved version. This iterative self-improvement cycle can be repeated multiple times, with each round producing better results.
When should I use Self-Refine?
Use self-refine for writing tasks, code generation, creative content, and any output where quality matters more than speed. Especially effective for first drafts that need polishing, or when you want to catch errors before human review.
How does Self-Refine work?
Three phases: (1) Generate an initial response, (2) Ask the model to critique that response identifying weaknesses, (3) Ask it to produce an improved version addressing the critique. Repeat steps 2-3 until quality is satisfactory.
Does Self-Refine work with ChatGPT?
GPT-4 handles self-refine excellently. Use a single conversation with 'Now critique...' and 'Now improve...' follow-ups, or chain API calls programmatically.
Does Self-Refine work with Claude?
Claude is excellent at self-critique. Ask Claude to rate its output on specific dimensions, then improve. Claude's honesty about weaknesses makes self-refine very effective.