Skip to content
PodSubs
ShowsPeopleGuestsJobsNewsEvents
More
BlogPodCred
Menu
ShowsPeopleGuestsJobsNewsEventsBlogPodCredNetworksSign in
Join nowSign in
  • Shows
  • People
  • Jobs
  • News
  • More
    • Guests
    • Events
    • Blog
    • PodCred
    • Networks
    Join nowSign in

The AI Practitioner Podcast

The AI Practitioner Podcast artwork

PODCAST — Inside GEPA: Evolving LLM Agent Prompts with Reflective Feedback

Nov 11, 202611 minAudio
ShareXLinkedInFacebookWhatsAppEmail

Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could continuously improve their prompts as new challenges emerge in production? Even well-designed prompts can lose effectiveness as user needs evolve, new edge cases arise, and unexpected failures occur. Yet manually evaluating and refining prompts on an ongoing basis quickly becomes difficult to scale. In the previous episode, TextGrad introduced automated prompt optimization through textual gradients, using natural-language feedback to iteratively improve instructions. GEPA (Genetic-Pareto) takes a different approach: it combines reflection with evolutionary search to explore multiple prompt candidates and preserve promising alternatives through Pareto-based selection. In this episode, the focus is on how GEPA works, what a real banking intent classification experiment reveals about its effectiveness, and the trade-offs between accuracy, exploration, and prompt complexity. You’ll learn: * How does GEPA optimize prompts? The roles of reflection, mutation, and Pareto-based selection. * How can GEPA be implemented? Defining an agent, building feedback, and running evolutionary search. * How should the results be evaluated? What changes in the instructions, whether performance improves, and which trade-offs emerge. 👉 Enjoyed this episode? Subscribe to The AI Practitioner to get future articles and podcasts delivered straight to your inbox: aipractitioner.substack.com Get full access to The AI Practitioner at aipractitioner.substack.com/subscribe

Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.

Transcript

From the show. Tap a time to play from there.

SPEAKER_02Welcome back to The AI Practitioner. I'm Lina Faik, ML Engineer, Consultant, and Lecturer in Advanced Machine Learning at Sorbonne University. I help companies turn their data into real outcomes with AI, and this is where I share what I learned from actual projects. The deep technical write-ups live on Substack at AIPpractitioner.substack.com, and these conversations are the audio companion. Today I'm joined by Sam, who builds with language models every day, but hasn't spent time on automated prompt optimization.

SPEAKER_02Sam, thanks for being here.

SPEAKER_01Happy to be here. So what's on the table today?

SPEAKER_02Picture a bank's chat assistant. A customer writes, I sent a transfer yesterday, but the recipient still hasn't received it. The assistant has to pick an intent from a list. It picks transfer timing, as if the customer were asking how long transfers usually take. The right answer was transfer not received by recipient. The customer is not asking a general question. They are reporting a problem.

SPEAKER_01Ouch.

SPEAKER_02And the score only says wrong. It does not say why. That gap is the heart of today's topic. This is part 3 of my series on automated prompt optimization, and it is about a method called GIPA.

SPEAKER_01Hold on. Before we get into GIPA, why automate this at all? If the assistant mixes up two intents, I read the failures, I rewrite the prompt. Done.

SPEAKER_02That works on day one. The trouble starts after deployment. New inputs show up, edge cases appear, and user expectations shift. Reviewing failures, spotting patterns, and rewriting instructions by hand becomes very hard to maintain at scale. Automated prompt optimization uses evaluation feedback to improve the instructions, without retraining the underlying model.

SPEAKER_01And in the series you already covered one approach, right?

SPEAKER_02Yes, TextGrad, in the previous article. Textgrad uses natural language feedback instead of numerical gradients, and it refines one prompt step by step, a single path. Feedback keeps the natural language feedback, but changes the strategy. It explores several prompt candidates at once, and each candidate may be better on some examples than on others.

SPEAKER_01So the name, GEPA, stands for what?

SPEAKER_02Genetic Pareto. Two ideas in one name. Genetic, because new prompts are created by modifying existing ones like an evolutionary process. Pareto because of how it decides which candidates to keep. I'll come back to that because it is the part people find surprising.

SPEAKER_01Start with the evolution part then. How does a prompt get modified?

SPEAKER_02Through reflection. JPA takes a small batch of training examples, runs the agent, and collects the predictions plus the feedback. Then it hands everything to a language model, the current prompt, the examples, what the agent answered, and what the evaluator said. That model reads it like a reviewer and writes a revised prompt.

SPEAKER_01So a model rewrites the prompt of another model?

SPEAKER_02In my experiment, yes. One model does the classification and a different one does the reflection. And the batch is tiny. Three messages per reflection step.

SPEAKER_01Three? That feels like very little to learn from.

SPEAKER_02It does. And I'll admit I was skeptical too. But look at what happened in the first iteration. All three messages were misclassified. One was, why is my transfer taking so long to complete, where the agent said timing but the label was not received by recipient. Another was, can I get my card fast-tracked, where the agent said card arrival but the label was card delivery estimate.

SPEAKER_01Those labels are so close that I couldn't tell them apart myself.

SPEAKER_02Exactly, and that is the point. The reflection model wrote definitions. For card delivery estimate, it said the customer asks about expected delivery time or faster options, including fast tracking. It also wrote a broader rule. Prioritize specific transaction details over a general timing question.

SPEAKER_01That rule is a nice one. It's something a human reviewer would write.

SPEAKER_02Right. And that is why natural language feedback is appealing. The output is readable. You can open the prompt and understand what changed.

SPEAKER_01Fine, but here's my worry. A rule that fixes three messages could break 30 others.

SPEAKER_02That is exactly the risk. And Deepa does not trust the rewrite blindly. The new prompt is tested first on the same small batch. In my run, all three became correct. Then it goes to the validation set, which has 44 messages. Accuracy went from 77% for the starting prompt to 84% for the revised one.

SPEAKER_01Right. So we're done. Take the best one.

SPEAKER_02Not quite. And this is where it gets interesting. Later iterations generated several candidates from that revised prompt. Some scored 82%, one 80%, another 82%, all lower than 84%. A simple approach would throw those away.

SPEAKER_01Which is what I would do, lower score, delete.

SPEAKER_02JPA does not, and this is the Pareto part. Instead of ranking prompts by average accuracy, it looks at the scores example by example. A candidate stays in the pool if it is the best on at least one example. Even when its overall score is lower. Candidates that are beaten everywhere by another candidate get pruned.

SPEAKER_01Hmm. So a mediocre prompt survives because it handles one weird message better than everyone else.

SPEAKER_02Yes. Think of a team where nobody is the best overall, but each person is the best at something specific. You keep them all because you might need that specialty later. The set of survivors is called the Pareto Frontier. The next parent for reflection is then picked at random, with a probability proportional to how many examples that candidate wins.

SPEAKER_01So it avoids getting stuck on one path.

SPEAKER_02That's the idea. The article connects it to an older evolutionary strategy that keeps the best solution found in each region of the search space. In practice, you see Deepa going back to older candidates. In my run, the revised prompt number one produced several children, and later a different candidate became the parent of the last one.

SPEAKER_01Can you picture the tree for me?

SPEAKER_02The starting prompt has one child, prompt number one. That one has five children. One of those has its own child. Eight candidates in total. I'll leave the exact tree to the article, where it is laid out as a diagram.

SPEAKER_01Okay, so what did the setup look like? Was it heavy?

SPEAKER_02Lighter than you might expect. I reused the banking task from the TextCred article, with 11 similar intents from Banking77, a public dataset, think transfers, card delivery, decline transactions, fees, 44 messages for training, 44 for validation, and 440 held out for the final test.

SPEAKER_01And the starting prompt?

SPEAKER_02Very short, 38 words. It lists the 11 intents and says to answer with the intent name only. No definitions, no guidance on how they differ.

SPEAKER_01And the feedback the evaluator gives? You said the score alone is poor.

SPEAKER_02Here is a detail I find humbling. The score is just right or wrong. The feedback says what the agent answered and what the correct intent was. Nothing about why. The reflection model has to infer the underlying confusion from the examples. I'll skip the code on mic, but the evaluator and the full optimization call are in the article, with every setting explained.

SPEAKER_01Let me ask the question I'd ask of any optimizer. How long did it run and what did it cost?

SPEAKER_02The budget was 400 task model evaluations. The run recorded 412 slightly above the limit plus the reflection calls on top. So it is not free. We'll come back to cost because it matters for the conclusion.

SPEAKER_01Alright, results. Did it work?

SPEAKER_02Depends on how you read it. On the validation set, 77% to 84%. But validation is what JPA optimizes against, so I care more about the 440 test messages it never saw. There, accuracy went from 80% to 82%. Errors dropped from 86% to 78%.

SPEAKER_01Two points. That's it?

SPEAKER_02Two points, yes. And here is the detail I want people to notice. JPA fixed 26 predictions that were wrong before. But it also introduced 18 new errors.

SPEAKER_01So it broke 18 things that used to work.

SPEAKER_02Right. Net gain of 8, but not a clean win. Card delivery went from 80% to 86%. Transfers not arrived went from 72% to 76%. Refuse transactions stayed at 83%, but fees went down from 94% to 89%.

SPEAKER_01Fees got worse? Wow! That's a regression you'd only catch if you looked by category.

SPEAKER_02Exactly. Overall accuracy hides it. Optimization can shift errors between categories instead of removing them. In a real product, a drop on fees might matter more than a gain on cart delivery.

SPEAKER_01What did the final prompt look like? I'm guessing longer.

SPEAKER_02Much longer. 38 words grew to 391, with definitions, decision rules, and examples. And one thing I flag in the article, some examples come straight from the training data. That raises the question of overfitting to particular messages.

SPEAKER_01I want to push on this. If the prompt copies training examples aren't the 84% numbers inflated?

SPEAKER_02That is a fair challenge, and it is why the held out test set matters. The test gain was smaller than the validation gain, which is consistent with some of that effect. I would not claim it proves overfitting, but it is a reason to stay cautious.

SPEAKER_01Also, you said eight candidates. Did the later ones beat the early one?

SPEAKER_02No, and that surprised me. The prompt number one stayed the selected candidate. Later candidates added more rules and examples, up to 689 words, and still tied at 84%. More exploration, longer prompt, no better result.

SPEAKER_01So longer isn't better.

SPEAKER_02Not here. And there is a second subtle point. All eight candidates stayed on the Pareto frontier. With a right or wrong score and many ties, it becomes hard for the selection to tell which candidates are truly complementary. Keeping diversity is useful, but it does not guarantee smarter exploration.

SPEAKER_01That's an honest limitation. Anything else?

SPEAKER_02One more, and it matters for production. JPA runs as a dedicated training process. Once you pick a prompt, it stays fixed until the next optimization cycle. If customers start writing differently next quarter, the prompt does not adapt on its own.

SPEAKER_01Which brings me back to my first question. The whole motivation was keeping agents effective after deployment.

SPEAKER_02Yes, and that is the honest tension of this series. JPAI is a systematic way to turn feedback into better instructions, but it is a periodic process, not a live one. That is part of why the next article moves to a different approach, called ACE.

SPEAKER_01So say I'm at my desk on Monday with a classifier that keeps confusing two labels. Where do I start?

SPEAKER_02Start with the feedback, not the algorithm. Write an evaluator that says what the right answer was, keep a held-out test set you never optimize against, and check results by category, not just overall. Then try DIPA on a small budget and read the prompts it writes. The full walkthrough, the code and the figures from the paper are in the article, and the link is in the caption the series lives at AIPPractitioner.substack.com. My closing thought. The most valuable thing JIPA gave me was not two points of accuracy.

SPEAKER_02It was a readable record of what the prompt learned, and a clear reminder that every fix has a price somewhere else. [music]

Open the transcript file

Hosts and Guests

Nobody is credited on this episode yet.

Credit the people on this episode

Be the first to rate this episode

More episodes

All episodes
  1. PODCAST — Beyond Static Prompts: Building Self-Improving LLM Agents with ACE

    Nov 19, 202611 minAudio

    Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could learn from every interaction...

    Credit the people on this episode

  2. PODCAST — TextGrad in Practice: Optimizing LLM Agent Prompts with Textual Gradients

    Nov 3, 202615 minAudio

    Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could improve their own prompts...

    Credit the people on this episode

  3. PODCAST — Continuously Optimizing AI Agent Prompts in Production

    Oct 28, 202615 minAudio

    Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if the key to better AI agents isn’t writing...

    Credit the people on this episode

  4. PODCAST — From Prompt Engineering to Harness Engineering: Where the Real Leverage Moved

    Oct 16, 202613 minAudio

    Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if improving an AI agent’s performance had less...

    Credit the people on this episode

  5. PODCAST — GraphRAG vs. Vector RAG: Better Retrieval or Expensive Overengineering?

    Sep 23, 202613 minAudio

    Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. Standard RAG works well when the answer is contained...

    Credit the people on this episode