Lakshya A Agrawal Profile picture
Jul 28 5 tweets 3 min read Read on X
How does prompt optimization compare to RL algos like GRPO?

GRPO needs 1000s of rollouts, but humans can learn from a few trials—by reflecting on what worked & what didn't.

Meet GEPA: a reflective prompt optimizer that can outperform GRPO by up to 20% with 35x fewer rollouts!🧵 Image
We implemented GEPA as a new @DSPyOSS optimizer (release soon!). This means that it works for even sophisticated agents or compound systems you've already implemented.

GEPA outperforms the MIPROv2 optimizer by as much as 11% across 4 tasks for Qwen3 and GPT-4.1-mini.

Of course: Weight updates remain necessary to teach the models completely new tasks and still excel at general-purpose (massively multi-task!) post-training!

However, we show that for specialization to downstream systems, reflective prompt optimization can go really far with tiny data sizes and rollout budgets!

(2/n)Image
GEPA builds a Pareto tree of proposed prompts.

In each step, GEPA picks a prompt P that has performed best on some examples—even if not best overall!

GEPA performs a few rollouts with P, and uses NL reflection on the resulting trajectories to extract a few lessons, which GEPA validates on a few examples.

If they work, these lessons become part of a new node in the Pareto tree. This allows GEPA to propose increasingly nuanced prompts as the optimization progresses.Image
This design gives GEPA two additional, bonus features:

(1) GEPA’s prompts are not only more effective but also up to 9x shorter than those from leading few-shot optimizers!

(2) GEPA shows promise as an inference-time search technique. It can generate performant kernels for AMD’s latest NPUs, outperforming RAG and iterative refinement techniques.Image
Paper: arxiv.org/abs/2507.19457

GEPA will be open-sourced soon as a new DSPy optimizer. Stay tuned!

Incredibly grateful to the wonderful team @ShangyinT @dilarafsoylu @NoahZiems @rishiskhare @kristahopsalong @arnav_thebigman @krypticmouse @michaelryan207 @Meng_CS @ChrisGPotts @koushik77 @AlexGDimakis @istoica05, Dan Klein, @matei_zaharia @lateinteractionImage

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Lakshya A Agrawal

Lakshya A Agrawal Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(