Comparing AI Evaluation Experiments: Measuring the Impact of Changes to AI Applications
From the publisher’s feed, collected in the ZeroLabs newsroom.
AI Engineering FundamentalsAI Evaluation · Part 7← Part 6So far in this series, we have focused on one fundamental question:How good is our AI application?We started with deterministic checks, brought humans into the evaluation loop, used LLMs as judges, and eventually evaluated interactions happening in production.But evaluation becomes even more useful when we start changing the application.Maybe we changed the prompt. Maybe we switched models. Maybe we added a tool, changed retrieval, or moved part of the decision-making from the LLM into application code.Now the question is different:Did the change actually make the application better?Running a few prompts against the new version and checking whether the responses look good isn’t enough. A change might improve the behavior we were targeting while quietly breaking something that already worked. And with non-deterministic AI systems, even running the same example once can give us a misleading picture.The dataset stays the same. The evaluation criteria stay the same. The evaluator stays the same.The application change is the variable we want to measure.In this final part of the AI Evaluation series, we’ll do exactly that with Wayfinder our flight search application. We’ll establish a baseline, make a targeted engineering change, run the same evaluations again, and compare the experiments to understand not just whether the scores changed, but what behavior changed and whether the evidence is strong enough to support our engineering decision.Building a Focused Dataset for the ComparisonBut an overall score doesn’t always tell us what happened to the behavior we actually changed.Imagine we make a change to improve how an AI application handles requests with multiple constraints. The overall evaluation score improves.That sounds promising. But it leaves us with more important questions:Did the behavior we wanted to improve actually get better? And did that change break anything that was already working?To answer those questions, it helps to include examples that directly exercise the behavior we’re changing, along with examples that protect behavior that already works.This gives us two useful types of evaluation cases:Target case — exercises the behavior we expect our change to improve.Regression guard — exercises behavior that already works and that we don’t want our change to break.These focused cases don’t replace the application’s broader evaluation suite. They give us a clearer way to understand the impact of a particular change.Throughout this series, we’ve used Wayfinder our AI-powered flight search assistant, to build and explore different evaluation techniques. We’ll continue with the same application here as we move into experiment comparison.Consider this request:Find the cheapest flight from Bangalore to Tokyo tomorrow with at least available seats.Wayfinder has to do two things correctly here.First, it needs to consider only flights with at least two available seats. Then, from those flights, it needs to find the cheapest one.This is the behavior we want to study, so we’ll make it our target case.But there is another side to the comparison.Suppose our change fixes this request but somehow breaks a simpler request that Wayfinder already handles correctly:What is the cheapest flight from Bangalore to Tokyo tomorrow?We haven’t really made the application better — we’ve just moved the problem somewhere else.So we’ll keep this simpler request as a regression guard.Our comparison dataset is therefore deliberately small:{"id": "cheapest_with_min_seats", "query": "Find the cheapest flight from Bangalore to Tokyo tomorrow with at least 2 available seats.", "expected_behavior": "Recommend the lowest-priced retrieved flight that satisfies the stated minimum seat requirement. Do not recommend a more expensive flight when a cheaper eligible flight exists."}{"id": "find_cheapest_flight", "query": "What is the cheapest flight from Bangalore to Tokyo tomorrow?", "expected_behavior": "Recommend the lowest-priced retrieved flight for the requested route and date."}The first case asks:Did we improve the behavior we were trying to change?The second asks:Did we accidentally break behavior that already worked?Of course, two examples are not enough to evaluate an entire AI application. That’s not what we’re trying to do here. We already built broader evaluation coverage earlier in the series.For this experiment, these two cases give us a focused way to follow one change and understand its impact.And most importantly, we won’t change them between experiments.We’ll first run them against the current version of the application to establish a baseline. Later, after making our change, we’ll run the exact same examples again and compare the results.With the dataset fixed, we now need a way to run those evaluations as repeatable experiments.Running the Experiment LocallyIf you’ve been following the series and already have Wayfinder set up locally, you can skip the installation and environment setup below. Just make sure you’re on the version used for this experiment.The complete implementation used throughout this article is available in the companion GitHub repository. To follow along with exactly the same code shown in this article, check out the v0.6.0 release. This ensures the code, commands and screenshots remain consistent over time.To follow along locally, clone the repository and check out the release containing the online evaluation implementation:git clone https://github.com/DivakarUngatla/wayfinder.gitcd wayfindergit checkout v0.6.0Install the project dependencies:uv syncBefore running the evaluation, configure the required environment variables.Create a .env file:cp .env.example .envConfigure the required environment variables:OPENAI_API_KEY=LANGSMITH_API_KEY=LANGSMITH_TRACING=trueRunning Evaluations as ExperimentsWe now have a fixed set of examples. The next step is to run them against the application and record the results in a way that lets us compare them later.We’ll do that by running the evaluation as an experiment.An experiment is a recorded evaluation run of a particular version of our application against a fixed dataset.For each example, the experiment:runs the applicationcaptures its response and the context it usedevaluates that responserecords the resultsLater, after we change the application, we’ll repeat the same experiment with the same evaluation setup and compare the results.For Wayfinder, we’ve wrapped this workflow in a small experiment runner:def target(inputs): result = agent.run(inputs["query"]) return { "response": result.response, "retrieved_flights": [ flight.model_dump() for flight in result.flights ], }def evaluator(run, example): return judge.evaluate( query=example.inputs["query"], expected_behavior=example.outputs["expected_behavior"], response=run.outputs["response"], context=run.outputs["retrieved_flights"], )The target is the application we're evaluating. LangSmith gives it an example from our dataset, and Wayfinder returns both the generated response and the flights it retrieved.The evaluator then takes that output and scores it against the expected behavior.We’re reusing the same LLM-as-a-Judge evaluator we built earlier in the series, so we’re not introducing a new evaluation technique here. We’re changing how we use the evaluation results: instead of looking at one run in isolation, we’re going to compare runs from different versions of the application.LangSmith’s evaluate() ties the pieces together:evaluate( target, data=dataset_name, evaluators=[langsmith_llm_judge_evaluator], experiment_prefix=args.prefix, num_repetitions=args.repetitions,)The dataset gives us the examples. The target runs Wayfinder. The evaluator scores its behavior. And LangSmith records the results as an experiment that we can inspect and compare later.There is one parameter here that deserves some attention:num_repetitions=args.repetitionsWhy would we run the same evaluation example more than once?Because with an AI application, one successful run doesn’t necessarily mean the behavior is consistently correct.And that’s something our baseline experiment is about to show us.Establishing Our BaselineBefore making any changes to the application, we need to understand how the current version behaves. This gives us our baseline — the reference point we’ll compare our change against later.We’ll run the two examples in our dataset five times each:python examples/experiment_comparison/compare_experiments.py \ --dataset-name wayfinder_experiment_comparison \ --prefix wayfinder-baseline \ --repetitions 5The first time we run this command, the experiment runner creates the dataset in LangSmith from our local JSONL file. From then on, we’ll reuse this same dataset for every experiment in this article.With two examples and five repetitions, our baseline contains 10 evaluation runs.Why repeat each example five times instead of evaluating it once?Because a single successful response can give us a false sense of confidence. AI applications can produce different responses for the same input, and our LLM-based evaluator can vary as well.If a behavior works once, we know it can work.If it works repeatedly, we start learning something about how consistently it works.When the evaluation completes, the runner prints a link to the experiment in LangSmith. Let’s open it and look at what happened across the five repetitions.The simple cheapest-flight request works correctly in all five runs. The multi-constraint request is different: four repetitions score perfectly, but one fails.In repetition 3, Wayfinder recommends Japan Airlines JL703 at ₹48,550 with 12 available seats.But the retrieved flights also contain Air India AI302 at ₹41,000 with 6 available seats. Air India satisfies the same minimum-seat requirement and is cheaper.Wayfinder had the information it needed, but still selected the wrong flight.Your exact results may differ. Both the application and the LLM-based evaluator are non-deterministic, so you may see the incorrect recommendation in a different repetition — or all five runs may succeed. What matters is that we use the same evaluation setup when comparing the baseline with the version we change next.The interesting part isn’t that Wayfinder cannot handle the request — it gets it right in four of the five runs.The problem is that the same request doesn’t produce consistently correct behavior.Now we have something concrete to improve — and something concrete to compare our next experiment against.Finding the Right Thing to ChangeOur baseline showed us where the application sometimes fails. But before changing anything, we need to understand why.In the failed run, Wayfinder had already retrieved the cheaper Air India flight. So retrieval wasn’t the problem.The problem happens after retrieval.In the current implementation, the retrieved flights are passed to the response-generation LLM. The LLM has to apply the user’s constraints, compare the eligible flights, select the cheapest one and generate the final response.Conceptually, the flow looks like this:Retrieved Flights ↓ LLM ↓Apply constraintsCompare pricesGenerate responseBut filtering by available seats and comparing prices are deterministic operations. We don’t need an LLM to make those decisions.That gives us a simple engineering hypothesis:Move deterministic filtering and ranking into application code, and let the LLM focus on generating the response.The application would then look more like:Retrieved Flights ↓Filter + Rank ↓ LLM ↓Generate responseWe don’t know yet whether this change will actually improve the application.That’s exactly what our next experiment will measure.Moving Deterministic Decisions into Application CodeNow we can implement our hypothesis.Wayfinder already uses an LLM to convert the user’s request into a structured FlightSearchRequest. We can extend that structure so the application also knows how the results should be ranked:passengers: int = Field(default=1)sort_by: Literal["price", "duration"] | None = Nonearrival_before: time | None = NoneFor our target request:Find the cheapest flight from Bangalore to Tokyo tomorrow with at least 2 available seats.the extraction step now produces:{ "source": "Bangalore", "destination": "Tokyo", "passengers": 2, "sort_by": "price", "arrival_before": null}The LLM is still doing something it’s good at: turning natural language into structured intent.But once we have that structure, the application can handle the deterministic decisions itself:flights = [ flight for flight in flights if flight.available_seats >= request.passengers]if request.sort_by == "price": flights.sort(key=lambda flight: flight.price)elif request.sort_by == "duration": flights.sort(key=lambda flight: flight.duration)For our target request, this means Wayfinder first removes flights with fewer than two available seats and then sorts the remaining flights by price.The response-generation LLM no longer needs to perform that filtering or ranking itself. It receives flights that have already been processed according to the structured request and focuses on generating the response.So our architecture has shifted from:LLM → interpret constraints + make deterministic decisions + respondto:LLM → structured intent → deterministic application logic → LLM responseThe change looks promising, but we haven’t established that it actually improves the application’s behavior.To find out, we’ll run the same evaluation again and compare the two experimentsWe’ve only looked at the key parts of the change here. The complete implementation also handles additional filtering and ranking behavior and updates the response-generation flow accordingly.If you’re following along with the repository, switch back to the main branch to get the completed candidate implementation:git checkout maingit pullThis gives us the candidate version we’ll evaluate next. Our v0.6.0 checkout remains the reproducible baseline we started with.Running the Candidate ExperimentNow we evaluate the changed application using exactly the same setup as our baseline.Same dataset. Same two examples. Same evaluator. Same five repetitions.The only thing we’ve changed is the application itself.Run:uv run python examples/experiment_comparison/compare_experiments.py \ --dataset-name wayfinder_experiment_comparison \ --prefix wayfinder-deterministic-filtering \ --repetitions 5The runner creates a second experiment in LangSmith, this time using our candidate implementation.Now let’s look at the same multi-constraint request that failed once in our baseline:Find the cheapest flight from Bangalore to Tokyo tomorrow with at least 2 available seats.This time, all five repetitions receive a score of 5 across every evaluation criterion.In our baseline, the same request succeeded in four repetitions but selected the wrong flight in one. After moving filtering and ranking into deterministic application logic, we don’t see that failure in any of the five candidate repetitions.That’s encouraging — but looking at the candidate experiment by itself still doesn’t answer the question we started this article with.Did our change actually make the application better overall?For that, we need to compare the baseline and candidate experiments directly.Comparing the ExperimentsNow we can finally put the two experiments side by side.Both experiments used the same dataset, evaluator, and five repetitions per example. The only thing we intentionally changed was the application.LangSmith lets us compare the results directly:For our multi-constraint request, the difference is immediately visible.The baseline’s failed repetition pulled several evaluation scores down. In the candidate experiment, every criterion scores 5.00 across all five repetitions.More importantly, the behavior changed: we no longer observed the incorrect flight selection, while our simpler cheapest-flight regression guard continued to work correctly.The behavior we targeted improved, while the behavior we wanted to protect did not regress.This doesn’t prove the application will behave correctly for every request. But with the same dataset, evaluator, and repetitions on both sides, we now have evidence that our change improved the behavior we set out to fix.That’s what experiment comparison gives us: evidence for an engineering decision.ConclusionIn this article, we explored how evaluation experiments can help us answer a question that comes up constantly when building AI applications:Did my change actually make the application better?We built a focused evaluation dataset, established a baseline across repeated runs, made a targeted application change, and evaluated the candidate using the same setup.By comparing the two experiments, we could see whether the behavior we wanted to improve actually got better while also checking that existing behavior didn’t regress.This gives us a repeatable engineering loop for changing AI applications:Baseline → Change → Evaluate → Compare → DecideWhether we’re changing prompts, models, retrieval, tools, or application logic, experiment comparison gives us evidence to understand the impact of those changes instead of relying on intuition or a few successful examplesison gives us a way to answer that question with evidence.What’s Next?With experiment comparison, we’ve completed the AI Evaluation track of AI Engineering Fundamentals.Across this series, we’ve moved from understanding why traditional software tests aren’t enough for AI applications to building rule-based, human, LLM-based, and online evaluation workflows — and finally to using those evaluations to measure the impact of application changes.Next, we’ll move on to the next area of AI engineering.AI Evaluation SeriesThis article completes our AI Evaluation series, covering the journey from evaluation fundamentals to measuring and improving real-world AI applications.✅ Part 1: Software Tests vs AI Evals✅ Part 2: Understanding AI Evaluation✅ Part 3: Rule-Based Evaluation✅ Part 4: Human Evaluation✅ Part 5: LLM-as-a-Judge✅ Part 6: Online Evaluation✅ Part 7: Comparing Evaluation ExperimentsComparing AI Evaluation Experiments: Measuring the Impact of Changes to AI Applications was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.