Skip to main content
Products powered by large language models (LLMs) require evaluations to ensure that their behavior is what you expect it to be. Evaluations are tests that encode your judgment about what the product experience should be into metrics that you can track. Generally, LLM products need to be evaluated across a wide range of settings, with several different types of metrics. Such evaluations can encompass all aspects of the product, including the prompts, parameters, tools, model, context, and application code. Given this complexity, there must be a process in place to change the behavior of the LLM system, choose the right metrics, and evaluate its quality to ship high-quality changes with confidence. This guide presents a workflow centered around evaluation and Experimentation that you can use to safely ship LLM changes:
  1. Understand the specific change you want to make, then write the hypothesis.
  2. Choose metrics that match the change.
  3. Narrow your candidate variations and evaluate them on a held-out dataset offline.
  4. Expose the change internally behind a targeting rule.
  5. Release with a guarded rollout if you need a safety net, or an experiment if you need an estimated outcome to guide your decision to ship or not.
  6. Measure the cumulative effect of the change with a holdout.

Key elements of the LLM evaluation and Experimentation workflow

ConceptDescription
Understand the changeChanges can originate from unexpected behavior, new capabilities, or forced changes. Each of these reasons requires a different baseline, test dataset, and primary metric.
Metrics that match the changeA metric’s role as a primary or guardrail metric is a byproduct of the change and its accompanying hypothesis. For changes addressing a faithfulness problem, the primary metric would be faithfulness rate with cost and latency as guardrails. If you swap in a cheaper model, cost is the primary and quality is the guardrail.
Create variations and offline evaluationCreate a few variations by hand or use agent optimization to search a wider space. Score variations on a curated dataset before any production exposure. The dataset must be split in two, where one part is iterated against and the other is held back and used for scoring.
Choose a release pathA guarded rollout ramps traffic up to 100% while watching for regressions on certain metrics. An experiment estimates the effect of a change and guides a shipping decision.
HoldoutsA holdout can measure the effect of a series of changes in aggregate, which is often the only way to see a business effect.

Understand the change

Generally, there are three broad reasons to make LLM changes:
  1. Unexpected behavior
  2. A new capability
  3. A forced change
These different origins naturally drive what you build, the primary metric, and the hypothesis for the change.
Reason for the changeWhat you haveNatural primary metric
Unexpected behavior from an existing system (for example, dropped context, bad tool use)Traces and a measured failure rateA metric that measures that specific failure mode
New capability or customer requestCustomer conversations and a tech specAdoption and/or the behavioral or business outcome you want the new capability to effect
Forced change (for example, model deprecation, price change, a new latency target)An existing regression suiteCost/latency with quality as a non-inferiority guardrail
Each of these reasons for making changes is discussed in more detail below.

Unexpected behavior from an existing system

An existing LLM-powered system should have real traces that you can tie to the observed unexpected behavior. Perform error analysis to understand the patterns in these traces. A general workflow for this process is as follows:
  1. Pull a sample of production traces with negative customer feedback, low judge scores, and other errors, as well as a random sample to capture additional untracked failures.
  2. Read the traces and write down the unexpected behaviors observed.
  3. Group the behaviors into failure modes (for example, “ignored the tool result and answered from memory,” “summary didn’t include a customer requirement,” or “invented a policy that didn’t exist”).
A named failure mode with a rough frequency estimate tells you what you should change, which metric would detect it, and what your hypothesis should be. To learn more about writing effective hypotheses, read Write the hypothesis after you have the change.

New capabilities

A net-new capability or feature has no traces, no baseline, and nothing to do error analysis on. That does not exempt you from defining success in observable terms. It just means that you have to create the definition using your own judgment instead of discovering it. Start by going through customer conversations, support tickets, sales calls, and any other processes that drove the decision to build the new capability. These should inform the kinds of inputs the feature will actually receive. Then have a domain expert write what a good output looks like for each one and list the behavioral rules the feature must obey (for example, “cite a source,” “refuse out-of-scope questions,” “never quote a price”). Those rules can serve as your initial acceptance criteria and your first metrics. The combination of inputs, outputs, and rules in this step is your first curated, or “golden,” dataset. Regarding metrics, there are two considerations to keep in mind for new capabilities. First, the business metric or a proxy is likely the primary metric. Fixes to correct unexpected behavior, like prompt or tool edits, will usually not move the needle for business metrics. For a net-new capability, however, the hypothesis is about business value, given that adoption and the promised outcome are exactly what is being tested. Second, the guardrail metrics associated with new features often come from the surrounding product rather than from quality metrics. A new LLM surface can add latency to a page, add cost per session, or pull users out of a flow that was converting fine previously. The guardrails should cover the experience the feature lives inside, not just the feature’s own output.

Forced changes

Changes that a model provider forces on you, such as model deprecations, price changes, and new model releases require a different kind of hypothesis. For such changes, the claim providers make is usually that cost or latency will improve without regressions. You can test these claims with an effective hypothesis.

Write the hypothesis after you have the change

After you have determined the change to the LLM system and its corresponding success definition or metric, the hypothesis should be simple to write. Every hypothesis should contain the specific change, what impact you expect to occur on specific metrics, the guardrails you want to stay within as the experiment runs, and a reason why the change should cause the outcome you expect. Here are examples of hypotheses for each change type:
  • Unexpected behavior: If an explicit deadline-extraction step is added, then dropped-deadline errors on multi-thread tickets will decrease without regressing accuracy, latency, or cost, because the agent will be forced to extract the deadline.
  • New features: If a suggested first reply is added, then the share of tickets answered within an hour will increase without increasing reopen rate, page latency, or cost per ticket, because users will have an easier time answering with a suggestion.
  • Forced change: If model X is swapped for new model Y, then our cost will decrease by 25% while quality on the regression suite stays within two points of the baseline, because new model Y will be implemented with a new technique.

Metrics that matter

There are two broad categories of metrics associated with LLM changes, each of which has two different metric groups.

Feature metrics

Feature metrics support the feature’s existence by measuring how well an entire feature performs. They are distal and typically either tracked at launch or tracked continuously against a holdout. There are two types of feature metrics: Business outcome metrics: Such as task completion, escalation rate, adoption rate, and retention rate. These measure the use cases you intend the feature to serve, but are also the most distant from any individual LLM change. Because of this, it can be hard to directly connect a business outcome metric to a specific LLM adjustment. Behavioral metrics: Such as what users actually do with the output an LLM provides. Did the human edit the generated summary, and how much? Did they hit regenerate? Copy it? Did they open the underlying document anyway? Ask a follow-up question? Abandon mid-stream? These preferences are revealed by a real user on a real task, with no judge call. They are the best available primary metric for most new LLM features.

Change metrics

Change metrics measure whether a specific LLM change had the impact you wanted it to have. They are proximal to the change, specific to the failure mode, and what most experiments will test. There are two types of change metrics: AI quality metrics: Such as accuracy, relevance, groundedness, toxicity, schema conformance, and custom rubric scores. These come from built-in or custom LLM judges, run offline against a dataset or online against sampled production traffic. Operational metrics: Such as tokens, latency percentiles, time-to-first-token, error rate, cost per call. These can be emitted by the AI SDK tracker and are visible for each config variation on the config’s Monitoring tab. Using a feature metric as a change metric in experiments often yields inconclusive results. Most of a feature metric’s variance is dominated by factors the LLM change doesn’t touch, leading to a weak experiment and likely a negligible effect estimate. That being said, no single metric is sufficient on its own.

Separate primary metrics from other metrics

The primary metric should be whatever your change is designed to impact, measured where the change occurs. All other metrics should be secondary or guardrail metrics. This means the metric you use as the primary can change based on the impact you want to measure. Here are some examples:
  • If you fixed a hallucination pattern, measure the hallucination rate on the affected slice as the primary metric and use cost and latency as guardrail metrics.
  • If you exchanged an expensive model for a cheaper model, track cost as the primary metric and use quality as the guardrail metric.
  • If you cut a reasoning step to reduce latency, track p95 latency as the primary metric and use quality and task success as guardrails metrics.

Pick the metric type that matches the measurement

After you have selected the primary and guardrail metrics, you need to create them with the appropriate metric type. The table below outlines common types of measurements and their associated LaunchDarkly metric types.
MeasurementMetric type
A per-unit yes/no: task completed, answer accepted, summary edited, binary LLM judge scoreCustom conversion binary
A per-unit numeric value: tokens per request, cost per request, edit distance, numeric LLM judge scoreCustom numeric
A tail of a distribution: p95 latencyPercentile
A ratio of two sums: cost per successful output (total cost / successful outputs)Ratio metrics
A click on an in-product LLM surface: suggested reply, citation cardClicked or tapped conversion

Metric taxonomy in practice

Consider a new feature that adds a customer support summarization agent. The feature generates an internal summary for a support representative working on a ticket to help them respond without needing to read the entire thread. The change in this example is a summarization step several steps removed from ticket outcomes. The table below describes some potential metrics for this feature along with their category and role.
CategoryMetricRole
BehavioralCustom conversion binary: support representative substantially edited or discarded the summaryPrimary: the support representative’s edit is the most direct available signal that the summary was wrong or insufficient.
BehavioralCustom conversion binary: support representative opened the full ticket thread after reading the summarySecondary
BehavioralCustom numeric: time from ticket assignment to first customer responseSecondary
QualityCustom judge to assess whether the summary contains the customer name, date reported, and urgencyGuardrail
QualityCustom judge to assess whether the summary follows the desired formatGuardrail
QualityCustom faithfulness judge to assess whether the summary accurately represents the information in the threadGuardrail
OperationalPercentile metric: p95 end-to-end latencyGuardrail
OperationalCustom numeric: cost per requestGuardrail
BusinessTicket resolved without escalation within 24 hoursFeature metric measured against a holdout
While it might be tempting to make the business metric the primary metric, consider that whether a ticket resolved in 24 hours depends on factors such as ticket complexity, queue depth, staffing, business hours, and whether the customer replies. The summary is a small input to a long chain. This means nearly all of the business metric’s variance comes from things the change doesn’t effect. Even a large improvement in summaries is unlikely to produce a tangible effect on the business metric at realistic volumes. In addition, the business metric is a composite of resolved and not escalated tickets. The two portions can move in opposite directions. Overall, the business metric is a good metric for the feature but a bad metric for this specific change.

Measure quality with LLM judges

The metric taxonomy presented above leaves a notable gap. Business metrics are too distal to move on a single change, and behavioral metrics, which are often the best primary metric for a new feature, only exist after users interact with real output. In addition, behavioral metrics are often insufficient for determining the specific ways in which the output meets or does not meet the quality bar. Extending the customer support summarization example, a support representative editing or discarding the summary indicates that the summary was insufficient, but not which requirement was missing. This is why it is critical to measure and evaluate quality metrics before changes reach production. There are three options for measuring quality directly. The first is a human reviewer, which is often used as the reference standard. Human review, however, does not scale to nightly evaluation runs across hundreds of dataset rows or to a guarded rollout that determines whether or not to keep ramping. Another option is to use lexical overlap scores, but these measure surface-level text similarity and do not capture any meaning. The last option is an LLM judge, a model prompted with a rubric and asked to score an output. An LLM judge is the only one of the three options that both scales and can evaluate semantic meaning. The downside of an LLM judge is that the quality measurement is itself a model output.

Judge rubrics

A judge is defined by its rubric and has three major considerations. Reference-based or reference-free A reference-based judge scores the output against a target reference answer, whereas a reference-free judge scores it against the rubric and input alone. The choice between the two generally depends on whether the task has a defensibly correct answer. Tasks such as extraction, classification, or anything yielding structured output typically do, and are good candidates for reference-based judge rubrics. Tasks involving open-ended generation typically do not have only one correct answer. For example, a reference summary for the customer support summarization example is one of many acceptable summaries. Score type Generally, judges return a binary score, a numeric score, or a choice between two or more outputs. Binary scores should be the default, as they force the rubric to state precisely what failure represents, yielding higher consistency and more actionable metrics. Use numeric scores for qualities that need to be graded, and comparison scores for ranking variations offline. One criterion per judge Each failure mode should be a separate judge, rather than having one judge score all the different criteria. Continuing the customer support summarization example, it has three separate judges for format conformance, faithfulness, and presence of required fields. This separation is what makes the judge’s results actionable, because it tells you exactly what went wrong. A single score will only tell you that something is wrong.

Judges are measurement instruments, not ground truth

It is important to keep in mind that an LLM judge is just another model. It has both bias and variance, and is only as good as its rubric is valid, reliable, and consistent. This makes an LLM judge a measurement instrument rather than a pure scorer. As such, there are four properties to consider when you create a judge. They are:
PropertyMeaningHow to check
CalibrationDoes the judge agree with human reviewers?After establishing human-human agreement, compare the judge output to labeled traces.
ResolutionCan the judge tell your variations apart?Compare the score spread across your candidate variations.
RepeatabilityDoes the judge provide the same answer for identical inputs?Re-score identical inputs and measure the score spread.
StabilityIs the judge the same as in previous runs?Pin the judge model and rubric version.
If you want to use an LLM judge score to gate a rollout or help decide experiment results, it must be aligned with human reviewers. Take a golden dataset containing inputs and outputs that human reviewers have labeled, including traces if available, and compare the judge’s output to the labels. When you go through this process, there are two important considerations. First, you must measure human-human agreement to establish a performance ceiling. If the human reviewers only moderately agree with each other, it is unreasonable to expect better from a model, and this likely points to an ambiguous task definition or an overly vague rubric. Second, if an LLM judge is continuously tuned to maximize agreement with human reviewers, the golden dataset must be split into two separate partitions, one to do the tuning, and the other to confirm final agreement, to avoid overfitting. In addition, an LLM judge whose score will be used to choose between variations needs to be able to discriminate between them. It is possible for a judge’s output to be highly correlated with human labels and still be unable to tell the variations apart.

Sampling is a power and cost decision

Online LLM judges are often configured to run on a percentage of traffic, given that each evaluation is a model call. For example, setting this sampling rate to ten percent means that the metric’s effective sample size is ten percent of exposures, which is frequently not enough to detect the desired effect. The sampling rate should be set based on what you need to detect. A cheap format check can run on far more traffic than an expensive faithfulness evaluation. The sampling should also be performed randomly, instead of conditional on other factors. This ensures that the scores are not biased by construction.

Validate the metric before using it

Before any variation is scored, confirm the chosen metric can detect the problem the change addresses. If you are fixing unexpected behavior, run your intended metric over the traces you just labeled. For example, if your faithfulness judge scores 0.88 on outputs you hand-labeled as hallucinations, that judge cannot see this problem, and no amount of downstream rigor will save the experiment. If you’re building something new, you don’t have real failures yet. You need to create a few. Write down the outputs you would consider unacceptable, the ones that violate your behavioral rules, and confirm that your judge scores them poorly.

Offline evaluation on a held-out dataset

No matter what kind of change you make and what metrics you use to measure its effect, the variations must be scored and validated using offline evaluation. Variations involving a prompt edit, a new tool, an extra extraction step, or something generated by agent optimization are relatively cheap to produce. There will likely be more candidate variations than you can put in front of real users given limited production traffic. Offline evaluation acts as a screening stage where you narrow down the candidate variations to the few worth spending real traffic on. The most important aspect of offline evaluation is splitting the dataset. Similar to how an LLM judge that is tuned to maximize agreement with human labels must be confirmed on labels it was not tuned on, you must do the same for the actual change you are testing. The golden dataset needs at least two partitions. They are:
  • A development set you look at constantly and iterate against.
  • A held-out set you touch rarely and never optimize against.
A score on the development set that you tuned against is training accuracy. It tells you that your change fits the examples you were looking at. The held-out set answers the two questions that matter: did the change do what it was supposed to do, and did it break anything you fixed before? As you create the golden dataset and its two partitions and start to run evaluations on them, there are some important considerations. They are:
  • The type of change determines what goes in each split. If you are fixing unexpected behavior, divide the failure modes identified from error analysis across both splits, so the held-out set holds examples of the behaviors you are fixing and of the behaviors you need to keep. If you are building something new, the golden dataset your domain expert wrote is all you have, so split it before you start iterating rather than after. If you are making a forced change, your existing regression suite is already the held-out set, and its job is to test the non-inferiority part of your hypothesis.
  • Continually update your dataset. Unlike a button-color test, an LLM system’s inputs drift, such as new products, new bugs, and new users. A dataset assembled six months ago slowly stops representing production. Add rows from new failure modes as you find them, and re-check that old rows still reflect real traffic.
  • Read row-level results, in addition to the aggregate. Aggregate metrics like the average can tell you which variation is better but not the specific failures. The failing rows tell you what to fix next, and frequently reveal new failure modes or provide evidence that a current one is broader than you thought. Error analysis produced this dataset, and its failures produce the next round of error analysis.

Choose how to ship

While offline evaluation scores variations on pre-specified examples based on your judgment, it cannot tell you how the variations will perform on unanticipated traffic, with real tools, at production concurrency. Production exposure is required to answer those questions, and there are several options for doing so. The first step is to point a targeting rule at your own team and test the feature for a period of time. This process should confirm that the change works end to end with inputs nobody curated and surface any issues. Internal use also creates the first real traces for the change, which feed back into the error analysis and into new rows for the golden dataset. Afterwards, there are two options for the release path. They are: Path A: ship the change safely. A guarded rollout progressively increases traffic to the new variation while monitoring the metrics you select, until the new variation reaches 100%. This is the right path when the decision to ship has already been made and a safety net is needed. Examples of this approach include a fix for a failure mode that was validated offline, a forced model migration, or any change whose business effect is too small to measure on a single release. Path B: decide whether to ship the change. An experiment runs at a fixed allocation until its stopping rule is satisfied and the primary metric can be read with the guardrails intact, after which the winning variation can be rolled out. This is the right path when the change involves a tradeoff, such as a cheaper model that may cost quality, when several candidate variations are being compared, or when you need to directly measure the effect of the change.

Comparison of guarded rollouts and experiments

Guarded rolloutExperiment
QuestionIs the new variation causing a regression?Is the new variation better, and by how much?
DirectionOne-sided, where a negative effect stops the releaseTwo-sided or one-sided, where both the sign and the size of the effect matter
MetricsThe metrics you select to monitor, measured as an absolute difference against each metric’s success criteriaA primary metric along with secondary and guardrail metrics
MethodSequential testing on a schedule as traffic ramps toward 100%A Bayesian or frequentist approach, where frequentist offers fixed-horizon or sequential analysis
DurationThe rollout duration you scheduleUntil the stopping rule for the chosen analysis method is met
ResultA 100% rollout, or a pause, with automatic rollback if enabledAn effect estimate and a human decision
LaunchDarkly detects a regression on a guarded rollout when sequential testing determines that the absolute difference between the new and original variations represents a statistically significant negative impact on a monitored metric. A regression triggers an automatic rollback if the user opted in to it for that metric. Otherwise, the rollout will pause. One important property of a guarded rollout is that a lack of regression is not evidence that the change helped. The rollout only ever acts on negative impact. This means a clean rollout does not necessarily support any improvement claim. Conversely, an experiment holds its allocation fixed. This means acting on a detected problem requires someone to notice and intervene, even when sequential testing is enabled and the results can be read at any time.

Measure the cumulative effect with a holdout

Most individual LLM changes will never be powered to detect an effect on a business metric, because their effect is small and the metric is noisy. Thus, a team shipping changes regularly using one of the two release paths will be making many small improvements but still not be able to measure their business value. A holdout can address this by aggregating several changes over time. For example, a slice of traffic could be kept on the previous quarter’s configuration, left there, and read quarterly. The combined effect of everything shipped during that period can be estimated on the business metric even though no individual change was measurable on its own.

Experiment design

Path B is a classical experiment, and the standard design decisions apply, though several of them behave differently for LLM systems.

Choose the randomization unit, then match the analysis to it

Randomizing per request is a common error in LLM experimentation. Ten requests from one user are not ten independent pieces of evidence, and treating them as such will shrink the reported confidence intervals and inflate false positive rates. Per-request randomization also gives a single user different behavior partway through a task. Randomization should instead occur at the level of the user, session, team, or organization. The analysis unit then needs to match the randomization unit. Returning to the customer support example, randomizing by support representative while computing averages per ticket produces an incorrect variance estimate, since tickets handled by the same representative are correlated. The two ways to handle this are to aggregate results up to the randomization unit or to use a clustered variance estimate.

Size the experiment from the decision

The minimum detectable effect should be derived from the decision rather than from a forecast. Figure out what difference would actually change the decision, such as the lift that would justify the additional cost or latency of a new model, and then determine whether there is enough traffic to detect it. For LLM systems, however, the standard power calculation does not immediately apply out of the box, for two reasons.

Unstable treatment value

In traditional online experiments, the change being tested is the same experience for every user assigned to it. An LLM variation is a non-deterministic process that produces different output on every call, even at temperature zero. This within-variation variance is in addition to the between-user variance that the standard power calculation accounts for. Thus, sample size estimates from standard calculators are a floor rather than a true estimate.

Heterogeneity of variance

The variance of LLM outputs typically scales with task difficulty: simple extraction and lookup requests can be very stable, whereas multi-turn or reasoning-heavy requests can diverge significantly. A single aggregate sample size or power calculation for a mixed workload can therefore be sized correctly for easier tasks but undersized for more difficult ones. If you anticipate varying levels of task complexity for the change, size the experiment for the most difficult tasks.

Plan for peeking and multiple comparisons

The traditional advice is to avoid looking at results early, which applies to a fixed-horizon frequentist test where the sample size is determined in advance and the results are read once at the end. Sequential testing, available within the frequentist approach, removes that restriction: results can be acted on at any time without repeated checks inflating the false positive rate. The ability to peek does not come for free, however. Always-valid intervals derived from sequential testing are wider than fixed-horizon intervals at the same sample size, which means a sequential design needs meaningfully more traffic to reach the same power. For LLM changes, whose experiments often have lower power than expected given the additional variance, that penalty can be meaningful. The choice then follows from the risk and estimated traffic for the change: changes that are less risky or involve small effects and noisy metrics benefit from a fixed-horizon experiment, whereas changes with plentiful traffic that would benefit from shipping early on a clear win (or loss) are good candidates for sequential testing. Multiple comparisons deserve particular attention because evaluating LLM systems often requires multiple metrics. In particular, having one criterion per judge is the right design for diagnosis, since it tells you which requirement failed; however, it means every failure mode becomes its own metric, alongside the operational and behavioral metrics. Returning to the summarization example, there are eight per-change metrics: one primary, two secondary, and five guardrails. If the significance level were set to 0.05, the eight metrics would have roughly a one-in-three chance of producing at least one false positive on a change that did nothing. To resolve this issue, corrections such as the Bonferroni or Benjamini-Hochberg methods should be applied to protect against false positives.

CUPED for variance reduction

CUPED uses pre-experiment behavior to remove variance that can be predicted in advance. When the same units use the same features repeatedly, such as support representatives, sales teams, or power users, prior-period behavior is highly predictive, and the resulting tightening of the confidence intervals can be substantial. This technique pays off particularly well for LLM features, given their increased variance compared to a typical product experiment. Adjusting for prior behavior helps in a second way that is specific to non-deterministic systems: aggregating many requests per unit averages out the per-response sampling noise. This means each unit’s measurement reflects the variant’s distribution rather than a single roll of it. This is another reason the analysis should be at the level of the randomization unit. The unit-level average is a more stable measurement.

Conclusion

Experimenting on an LLM system is the same discipline as a standard product experiment, applied to a system whose output varies from run to run and whose quality can only be observed through instruments that themselves require validation. While the details of the workflow will vary by team and by change, there are four elements that apply to all of them.
  • Both the change and the instrument measuring it need to be tested. LLM judges need calibration against human labels, metrics need to be confirmed against known failures, and a rubric edit changes what a guardrail means without any change to the system under test. Exposing production traffic on a measurement that has not been validated is an expensive way to be confidently wrong.
  • LLM variations are distributions with variance. A single run by itself shows nothing, experiment size estimates are a floor, and analysis should be performed at the randomization unit, where repeated requests can average out the per-response variability.
  • Underpowered is the standard. Most individual LLM changes will not be powered to move a business metric. Holdouts are appropriate for that job.
  • The error loop matters more than any single pass. Traces feed error analysis, error analysis builds the golden dataset, and the failing rows from an experiment are the input to the next round of error analysis. The output of an experiment is not only a shipping decision, but also a better measurement system for the next change.