<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Akshat gupta on Medium]]></title>
        <description><![CDATA[Stories by Akshat gupta on Medium]]></description>
        <link>https://medium.com/@guptaakshatcr7?source=rss-14df92530d08------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*z9dB6LLtMDscmL787T07Pg.jpeg</url>
            <title>Stories by Akshat gupta on Medium</title>
            <link>https://medium.com/@guptaakshatcr7?source=rss-14df92530d08------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 07:10:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@guptaakshatcr7/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beyond “Looks Good”: Eval-Driven Development for AI Applications]]></title>
            <link>https://medium.com/@guptaakshatcr7/beyond-looks-good-eval-driven-development-for-ai-applications-7b1ce8760392?source=rss-14df92530d08------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b1ce8760392</guid>
            <category><![CDATA[ai-agents-in-action]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ai-evaluation]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Akshat gupta]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 07:55:51 GMT</pubDate>
            <atom:updated>2026-08-05T07:55:51.622Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Building measurable feedback loops for LLMs, RAG systems, and AI agents</strong></p><p>Software developers are accustomed to feedback loops.</p><p>We write code, execute it, inspect failures, modify the implementation, and run it again. Over decades, software engineering has built increasingly sophisticated mechanisms around this cycle: unit tests, integration tests, observability, CI/CD pipelines, regression suites, and production monitoring.</p><p>Generative AI changes one important assumption behind this process.</p><p>The behavior of an AI application is no longer determined entirely by code. It can also depend on the model, prompt, retrieved context, conversation history, available tools, and probabilistic generation itself.</p><p><strong>How does an engineer know that a change actually made an AI application better?</strong></p><p><em>This question is where evaluation stops being only a testing concern and starts becoming part of the development process itself.</em></p><p><strong>In this article, I use Eval-Driven Development (EDD) as a developer-oriented framing for bringing evaluation into the implementation loop: define expected behavior, evaluate representative cases, analyze failures, make a targeted change, and measure again.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6aHiE5CzKnbLTaLqrqJCsA.png" /><figcaption><em>Moving from subjective experimentation toward a measurable development feedback loop.</em></figcaption></figure><h3>The “Looks Better” Problem</h3><p>Imagine building a knowledge assistant that answers questions from organizational documents.</p><p>A user asks:</p><p><strong>“What documents are required to complete this process?”</strong></p><p>The first version responds reasonably well. You modify the system prompt and try again. The answer looks clearer. You ask two more questions, and both responses appear better.</p><p>It is tempting to conclude:</p><p><strong>“The new prompt improved the application.”</strong></p><p>But did it?</p><p>A few successful examples demonstrate possibility,<strong> they do not establish whether the change improved behavior consistently across the cases the application is expected to handle.</strong></p><p>Depending on what is being measured, that judgment may come from a deterministic check, a reference-based metric, a model-based grader, human review, or a combination of these.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJrV27yA_rymjWS7BKiNLA.png" /></figure><h3>From Deterministic Tests to Evals</h3><p>Traditional software gives developers a powerful advantage: expected behaviour can often be expressed exactly.</p><p>Consider a simple test:</p><pre>expect(calculateTax(1000)).toBe(180);</pre><p>The contract is deterministic:</p><pre>Expected: 180<br>Actual:   180<br><br>PASS</pre><p>Now consider an AI function:</p><pre>summarize(policyDocument);</pre><p>What should the exact expected output be?</p><p>There may not be one.</p><p>Two summaries can use completely different wording while both being accurate, relevant, and useful. At the same time, a response can sound fluent and convincing while omitting critical information, introducing unsupported claims, or ignoring an instruction.</p><p>This changes what we need to measure.</p><p>Instead of asking only:</p><p><strong>“Did the output exactly match the expected value?”</strong></p><p>we may need to ask:</p><p><strong>“Did the output satisfy the properties we expect from a good response?”</strong></p><p>Those properties depend on the application. They might include correctness, relevance, groundedness, instruction adherence, format compliance, or task completion.</p><p>This is where <strong>evals</strong> come in.</p><p><strong>An eval is a repeatable mechanism for measuring AI-system behaviour against defined expectations.</strong></p><p>The key word is <strong>repeatable</strong>.</p><p>A developer manually reading a few responses and deciding that they “look good” provides useful intuition during exploration, but it does not give us a stable way to compare one implementation with another.</p><p>An eval turns that expectation into something we can preserve, run again, and compare as the system changes.</p><p><strong>Evals are not automatically objective simply because they produce a score — the quality of an eval still depends on the dataset, criteria, and grader used to construct it.</strong></p><p>And that leads to the more interesting engineering question:</p><p><strong>What happens when evaluation becomes part of the development loop itself?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wp1FfTfNJewH8So9fGV35g.png" /></figure><h3>Eval-Driven Development: Turning Evaluation into a Development Loop</h3><p>Knowing how to evaluate an AI system is useful. But for developers, the bigger opportunity is not evaluating a system only after it has been built — it is bringing evaluation <strong>inside the development loop itself</strong>.</p><p>Consider a common development scenario.</p><p>You modify the system prompt of an AI application and a few responses look noticeably better. You then change the retrieval configuration, experiment with another model, or introduce a new tool.</p><p>Each of these is an implementation change.</p><p>The difficult question is not simply whether the new version works. It is:</p><p><strong>Did the change improve the system as a whole, or did it simply improve the few examples we happened to inspect?</strong></p><p>This is where evaluation becomes an engineering feedback mechanism.</p><h3>From Individual Examples to Evaluation Cases</h3><p>Instead of repeatedly testing arbitrary prompts, we can preserve representative scenarios as <strong>evaluation cases</strong>.</p><p>At its simplest, an evaluation case describes three things:</p><p><strong>Input</strong> — What are we asking the system to do?</p><p><strong>Expected behaviour</strong> — What should a good execution accomplish?</p><p><strong>Evaluation criteria</strong> — How will we determine whether that behaviour occurred?</p><p>For example:</p><pre>eval_case = {<br>    &quot;input&quot;: &quot;Explain the cancellation policy.&quot;,<br>    &quot;expected_behavior&quot;:<br>        &quot;Use approved policy context and do not invent fees.&quot;<br>}</pre><p>Notice that the expected behaviour is not an exact response.</p><p>We are not requiring the model to generate a predefined sentence word-for-word. Instead, we are defining properties that a successful response should satisfy.</p><p>This distinction matters because AI applications can often produce multiple valid outputs for the same input.</p><p>A collection of these cases forms an <strong>evaluation dataset</strong>.</p><p>The dataset might contain common user scenarios, ambiguous requests, edge cases, previously discovered failures, or cases where particular system behaviour is especially important.</p><p><strong>For baseline-to-candidate comparisons, the evaluation dataset should remain stable enough that both implementations are being measured against the same behavioral expectations.</strong></p><p>It does not need to remain permanently frozen. New capabilities can introduce new cases, and failures discovered during development or production can eventually become regression cases.</p><p>This gives us something stable enough to compare changing implementations against.</p><h3>Baseline vs. Candidate</h3><p>Suppose Version A of an application uses one prompt and retrieval configuration.</p><p>After analysing some failures, a developer creates Version B with a modified prompt and a different retrieval strategy.</p><p>Both versions can now be evaluated against the <strong>same dataset</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kvnN3ssKcyzEtYZGcjoPg.png" /></figure><p><em>Evaluating baseline and candidate implementations against the same dataset makes behavioural changes measurable.</em></p><p>The resulting comparison might look like this:</p><p><strong>Correctness</strong><br> Version A: <strong>82%</strong> → Version B: <strong>91%</strong> ↑</p><p><strong>Groundedness</strong><br> Version A: <strong>89%</strong> → Version B: <strong>94%</strong> ↑</p><p><strong>Instruction Adherence</strong><br> Version A: <strong>95%</strong> → Version B: <strong>93%</strong> ↓</p><p><strong>Average Latency</strong><br> Version A: <strong>1.8s</strong> → Version B: <strong>2.2s</strong> ↑</p><p><em>These values are illustrative and are used only to demonstrate baseline-to-candidate comparison.</em></p><p>Version B improved correctness and groundedness, but not without trade-offs.</p><p>Instruction adherence declined slightly and latency increased.</p><p>Instead of deciding that Version B simply <em>feels better</em>, the developer now has measurable evidence showing <strong>where it improved and where it regressed</strong>.</p><p>That evidence becomes the input for the next development decision.</p><h3>The Eval-Driven Development Loop</h3><p>This creates an iterative development cycle:</p><p><strong>Define → Build → Evaluate → Analyze → Improve → Re-evaluate</strong></p><p>Evaluation is no longer only a validation step at the end of development. It becomes a <strong>feedback signal inside development</strong>.</p><p>A regression in groundedness might trigger an investigation into retrieval or context construction. Increased latency might expose an architectural trade-off. A failure isolated to a particular class of requests might become a new evaluation case.</p><p>As the application evolves, the evaluation suite can evolve with it.</p><p>New capabilities introduce new cases. Discovered failures become regression cases. Important production edge cases can feed back into the evaluation dataset.</p><p>Over time, the evaluation dataset can become an increasingly useful representation of the behaviors and failure modes the application is expected to handle.</p><p>It becomes an evolving representation of <strong>how the application is expected to behave</strong>.</p><p><strong>The objective is not to replace experimentation with evaluation. It is to make experimentation measurable.</strong></p><p>But measurement introduces the next engineering problem.</p><p>Suppose Version B regresses.</p><p>We now know <strong>that</strong> something became worse.</p><p>We still need to determine <strong>what actually failed</strong>.</p><p>In a RAG pipeline, was the required context never retrieved, or did the model misuse context that was already available?</p><p>In an agentic system, was the failure caused by reasoning, tool selection, arguments, or execution?</p><p>Answering those questions requires evaluation to move deeper than the final response and into the individual components of the AI system.</p><h3>When a Score Isn’t Enough: Evals as a Debugging Primitive</h3><p>Eval-Driven Development gives us a way to determine whether Version B performs better than Version A.</p><p>But once an evaluation detects a regression, another engineering question appears:</p><p><strong>What exactly should we change?</strong></p><p>A single correctness score can tell us that an application produced a poor result. It cannot necessarily tell us where that failure originated.</p><p>Consider a Retrieval-Augmented Generation (RAG) application:</p><p><strong>Query → Retriever → Retrieved Context → Generator → Response</strong></p><p>An incorrect final answer does not automatically mean that the model generated badly.</p><p>The retriever may have failed to surface the required information. Relevant content may have been ranked too low or lost during chunking. Alternatively, the correct context may have reached the model, but the model failed to use it effectively.</p><p>This is where <strong>component-level evals</strong> become useful.</p><h3>From End-to-End Failure to Component Signals</h3><p>A RAG pipeline provides a simple example of multiple failure surfaces.</p><p><strong>Retrieval quality</strong> asks whether the information required to answer the question actually reached the model.</p><p><strong>Generation quality</strong> asks whether the model used that information appropriately.</p><p><strong>End-to-end quality</strong> asks whether the complete system ultimately produced the expected behaviour.</p><p>The objective is not to collect every available RAG metric. It is to use enough signals to <strong>reduce the search space when something fails</strong>.</p><p>For example, retrieval can be inspected using measures such as <strong>Recall@K or Context Relevance</strong>, while generation can be evaluated using properties such as <strong>Faithfulness/Groundedness</strong>. <strong>Correctness or Task Success</strong> can then describe the behaviour of the complete system.</p><p>A component-aware evaluation case might look like:</p><pre>eval_case = {<br>    &quot;input&quot;: query,<br>    &quot;actual_output&quot;: response,<br>    &quot;retrieval_context&quot;: retrieved_chunks,<br>    &quot;expected_output&quot;: reference_answer<br>}</pre><p>The evaluation can then apply different signals to the relevant execution artifacts:</p><pre>result = evaluate(<br>    test_case=eval_case,<br>    metrics=[<br>        retrieval_recall,<br>        faithfulness,<br>        correctness<br>    ]<br>)</pre><p><em>The snippets above are framework-neutral pseudocode intended to illustrate the structure rather than a specific evaluation library.</em></p><h3>From a Score to a Development Hypothesis</h3><p>Suppose an evaluation produces the following illustrative result:</p><p><strong>Retrieval Recall:</strong> 0.72<br> <strong>Faithfulness:</strong> 0.96<br> <strong>Correctness:</strong> 0.81</p><p>Correctness tells us that the complete application has room for improvement.</p><p>The component signals tell us something more useful.</p><p>Faithfulness is high, suggesting that the generator is largely staying consistent with the context it receives. Retrieval recall, however, is considerably weaker.</p><p>That gives the developer a hypothesis:</p><p><strong>Investigate retrieval before assuming that the generation prompt is the primary problem.</strong></p><p>The next experiment might modify chunking, retrieval depth, query rewriting, filtering, or reranking.</p><p>But identifying the likely problem is only half of the development loop.</p><p>The same evaluation should now be run against the modified implementation.</p><p>Suppose the next configuration produces:</p><p><strong>Retrieval Recall:</strong> 0.72 → <strong>0.87</strong><br> <strong>Faithfulness:</strong> 0.96 → <strong>0.95</strong><br> <strong>Correctness:</strong> 0.81 → <strong>0.90</strong><br> <strong>Average Latency:</strong> 1.8s → <strong>2.0s</strong></p><p><em>These values are illustrative and are used only to demonstrate the diagnosis and re-evaluation process.</em></p><p>Retrieval coverage improved and end-to-end correctness increased, while faithfulness remained relatively stable.</p><p>But latency also increased.</p><p>The developer now has something more useful than a higher score: a <strong>measurable engineering trade-off</strong>.</p><p>Whether the correctness improvement from 0.81 to 0.90 justifies an additional 200 ms of average latency depends on the application. The important difference is that the decision can now be made using measured behaviour rather than intuition.</p><p>The development loop becomes:</p><p><strong>Measure → Localize → Change → Re-evaluate → Compare</strong></p><p>This is where evaluation begins to function as a debugging signal rather than only a quality score.</p><p><strong>An end-to-end eval tells us whether the feature worked. Component-level evals help tell us what to change.</strong></p><h3>Traces Add the Missing Context</h3><p>Component signals help narrow down <strong>where</strong> to investigate.</p><p>But developers may still need to understand <strong>what actually happened during the execution</strong>.</p><p>This is where traces become useful.</p><p>A simplified execution trace might capture:</p><pre>trace = {<br>    &quot;retrieved_chunks&quot;: retrieved_chunks,<br>    &quot;prompt_version&quot;: &quot;v3&quot;,<br>    &quot;model&quot;: model_name,<br>    &quot;latency_ms&quot;: 2000,<br>    &quot;tokens&quot;: 2137<br>}</pre><p>The trace provides context around the evaluation result.</p><p>Instead of knowing only that correctness increased, a developer can inspect which context was retrieved, which prompt and model produced the response, and what latency or token cost accompanied that behaviour.</p><p>This begins to connect <strong>evaluation with observability</strong>.</p><p><strong>Evaluation provides evidence about how behavior changed, the trace provides execution context that can help explain where that change emerged.</strong></p><p>For a RAG pipeline, that execution is still relatively straightforward.</p><p>An agent introduces a larger decision surface. It may plan, select a tool, construct arguments, execute an action, observe the result, revise its approach, and repeat the process before producing an outcome.</p><p>At that point, evaluating only the final response becomes increasingly insufficient.</p><p>The question evolves from:</p><p><strong>“Which component produced the wrong answer?”</strong></p><p>to:</p><p><strong>“Which decision or action caused the execution to diverge from the behaviour we expected?”</strong></p><p>That takes us from evaluating <strong>responses</strong> to evaluating <strong>agent trajectories</strong>.</p><h3>From Responses to Actions: Evaluating AI Agents</h3><p>RAG introduces multiple evaluation points because retrieval and generation can fail independently.</p><p>Agents extend this problem further because they do more than generate a response — they <strong>make decisions and take actions</strong>.</p><p>A simplified agent execution might look like:</p><p><strong>Request → Plan → Select Tool → Generate Arguments → Execute → Observe → Outcome</strong></p><p>The final answer therefore tells us only part of the story.</p><p>Consider two agents given the same request:</p><p><strong>Agent A</strong></p><p>Search Policy → Answer</p><p><strong>Agent B</strong></p><p>Search Policy → Search Customer → Retry → Update Customer → Search Policy → Answer</p><p>Both may eventually return the correct answer.</p><p>If we evaluate only <strong>task completion</strong>, both could pass. But Agent B followed a longer trajectory, performed unnecessary operations, and even invoked a state-changing tool that was not required.</p><p><strong>An agent can complete a task and still be poorly engineered.</strong></p><h3>Outcome vs. Trajectory</h3><p>This gives us two useful perspectives.</p><p><strong>Outcome evaluation</strong> asks whether the agent accomplished the intended task.</p><p><strong>Trajectory evaluation </strong>examines whether the decisions, tool calls, arguments, and intermediate steps taken by the agent were appropriate for accomplishing the task.</p><p>A trajectory can expose behaviours such as incorrect tool selection, invalid arguments, unnecessary retries, excessive steps, or actions that should never have occurred.</p><p>Some of these expectations can be checked directly:</p><pre>assert &quot;search_policy&quot; in used_tools<br>assert &quot;update_customer&quot; not in used_tools<br>assert tool_call_count &lt;= 2</pre><p><strong>These checks work when the expected behavior can be expressed as an explicit constraint.</strong></p><p>Other questions require judgement.</p><p>A shorter trajectory is also not automatically a better trajectory. Some tasks legitimately require additional verification, recovery, or tool calls; efficiency should therefore be evaluated relative to the task and expected behavior rather than minimized blindly.</p><p>Was the agent’s plan appropriate? Did the final outcome fully satisfy the user’s intent? Was an additional step actually unnecessary given the information available at that point?</p><p>These behaviours may require semantic graders or human evaluation.</p><p>A useful engineering principle is:</p><p><strong>Use deterministic checks for behaviour we can directly observe, and semantic graders where judgement is genuinely required.</strong></p><h3>Success Can Hide Inefficiency</h3><p>Suppose an illustrative agent evaluation produces:</p><p><strong>Task Completion:</strong> 0.93<br> <strong>Tool Correctness:</strong> 0.97<br> <strong>Argument Correctness:</strong> 0.94<br> <strong>Step Efficiency:</strong> 0.71</p><p>At first glance, the agent appears successful.</p><p>Task completion and tool selection are strong, but step efficiency tells us something that the final outcome does not.</p><p>Inspection of lower-scoring trajectories might reveal repeated searches, unnecessary retries, or tools being called after enough information has already been collected.</p><p>That gives the developer another hypothesis.</p><p>Perhaps tool descriptions overlap. Perhaps termination conditions are weak. Perhaps the orchestration logic allows the agent to continue after the task has effectively been completed.</p><p>After modifying the relevant behaviour, the same eval suite can be run again:</p><p><strong>Task Completion:</strong> 0.93 → <strong>0.94</strong><br> <strong>Step Efficiency:</strong> 0.71 → <strong>0.88</strong><br> <strong>Average Tool Calls:</strong> 4.2 → <strong>2.6</strong></p><p><em>These values are illustrative and are used only to demonstrate trajectory-level comparison.</em></p><p>The important result is not simply that efficiency increased.</p><p>The agent’s trajectory became shorter <strong>without sacrificing task completion</strong>.</p><p>This is the same Eval-Driven Development loop applied at a deeper level:</p><p><strong>Observe → Evaluate → Localize → Change → Re-evaluate</strong></p><h3>Evals Can Reveal Capability Gaps</h3><p>Not every failed trajectory is primarily a model-reasoning failure.</p><p>An agent may repeatedly fail because none of its available tools can represent the action required by the request.</p><p>In that case, rewriting the prompt may not solve the underlying problem.</p><p><strong>As a debugging heuristic, different failure patterns can point developers toward different layers:</strong></p><p><strong>Reasoning failure</strong> → investigate prompts, context, or model behaviour</p><p><strong>Tool-selection failure</strong> → investigate tool descriptions or routing</p><p><strong>Argument failure</strong> → investigate schemas or argument construction</p><p><strong>Inefficient trajectory</strong> → investigate orchestration or termination logic</p><p><strong>Capability gap</strong> → extend the available tools or system architecture</p><p>This distinction is important because evals do not automatically prescribe a fix.</p><p>They help developers<strong> narrow the investigation toward the layer most likely to require change.</strong></p><p>Once a problematic trajectory is understood, it can also be preserved as an evaluation case.</p><p>A one-time failure then becomes a regression case that future prompt changes, model upgrades, tool additions, or orchestration changes can be evaluated against.</p><p>This brings us back to the central idea of Eval-Driven Development.</p><p>For agentic systems, the question is no longer only:</p><p><strong>“Did the agent succeed?”</strong></p><p>It becomes:</p><p><strong>“Did it succeed in the right way — and if not, what should we change?”</strong></p><p>Evaluation therefore moves beyond scoring the final response and becomes a feedback mechanism for improving the decisions and actions that produced it.</p><h3>Closing the Loop: From “Looks Better” to “We Can Measure It”</h3><p>AI development will always involve experimentation.</p><p>Prompts change, models evolve, retrieval strategies improve, and agents gain new tools and capabilities. The challenge is making those changes without relying only on intuition or a handful of responses that appear better.</p><p>Eval-Driven Development introduces a measurable feedback loop around that experimentation:</p><p><strong>Define → Build → Evaluate → Localize → Improve → Re-evaluate</strong></p><p>What begins as a comparison between two implementations can evolve into component-level diagnosis and, for agentic systems, evaluation of the decisions and actions that produced an outcome.</p><p>The objective is not to make probabilistic systems deterministic, nor is it to reduce AI quality to a single score.</p><p>It is to make behavioural change <strong>visible, measurable, and actionable</strong>.</p><p>A useful eval should ultimately help a developer answer three questions:</p><p><strong>What changed?</strong><br> <strong>Where should I investigate?</strong><br> <strong>What should I change next?</strong></p><p>That moves AI development from:</p><p><strong>“It looks better.”</strong></p><p>to:</p><p><strong>“We can measure how it changed — and use that evidence to build the next version better.”</strong></p><p>That is where evaluation stops being only a testing activity and becomes part of how we engineer AI systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b1ce8760392" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>