answrsnow
AI Infrastructure · Explainer

How Do You A/B Test Different LLMs in Production in 2027?

By Kory White · Updated Oct 2026 · 8 min read
Rows of server racks in a data center
Direct answer

You A/B test different LLMs in production by running offline evals first, then routing a small share of live traffic to the challenger model behind a gateway or feature flag, logging both models with the same traces, and comparing task success, user feedback, latency and cost per request. Pick the success metric and the sample size before you start, decide only when the sample is reached, and then ramp the challenger up or roll it back.

The pieces are documented. Gateways such as Portkey and agentgateway split traffic by weight, and LaunchDarkly can compare model variations against metrics you define. What no source read for this page publishes is how large a quality gap between two LLMs is typical or how much traffic a canary should get, so those numbers are yours to set from your own traffic.

Offline first, then online

Offline evaluation runs a pre-defined dataset through your application before release. Langfuse describes it as evaluating "your existing application on a pre-defined dataset" to confirm changes are ready to ship, while online evaluation scores "live incoming traces to measure quality on production data and track trends over time." You need both, because the offline set is a guess about real traffic and the online test is the check on that guess.

OpenAI's evals guide calls evals "an essential component to building reliable applications," especially "when upgrading or trying new models." Anthropic's guide to building tests says to design evals that mirror your real-world task distribution and to prioritize volume over quality in grading. A challenger that loses the offline run does not earn live traffic; one that wins only earns a small share.

Your own monitoring comes first. See how to monitor LLMs in production for drift and hallucinations for the tracing and scoring that an experiment reuses.

Shadow, canary and split traffic

There are three ways to put a challenger in front of real requests, in rising order of risk:

A common order is shadow, then canary, then split. This is a pattern, not a standard, and no page read here prescribes the percentages. Choose a small first step you can afford to be wrong about.

Gateways and routers that can split traffic

A gateway sits between your application and the model providers, so the split needs little or no change in your application code. Portkey says its gateway "handles all the request transforms to make sure you don't have to change your code."

Cloud providers also publish gateway and routing features; check your provider's own documentation, since none is quoted here.

Feature-flag and experimentation platforms

A flag platform can assign users to arms, keep each user on one arm and tie the result to a business metric.

A flag gives you per-user stickiness and metric tracking; a gateway gives you provider-level routing and failover. Many teams may use the two together, though no source read here says so.

What to measure

Compare the same four things on both arms, using the same traces:

Provider list prices, read on October 20, 2026 from Anthropic's models overview, per million tokens:

The same page says Batch API requests are 50% off. Other providers' prices are not listed here because their pages were not readable for this guide; read them directly on the day you run the test. For cost levers beyond model choice, see how to reduce GPU costs when serving large language models and what causes high LLM inference latency.

Pin model versions in the test. Anthropic notes that "Every Claude model ID is a pinned snapshot," so an arm labeled with a specific ID stays comparable over the test. Check retirement dates too: the same page lists Sonnet 5.5 as not retiring sooner than September 28, 2027.

Statistics: sample size and when to stop

Decide the metric, the smallest difference worth detecting and the sample size before launch. Evan Miller's sample size calculator defines the minimum detectable effect as "the smallest effect that will be detected (1-β)% of the time." Its worked example, a baseline conversion rate of 10.2% and a detectable range up to 13.2%, needs 2,545 per variation. That is a conversion-rate example, not an LLM benchmark; your baseline and effect size change the answer.

Do not stop when the dashboard first turns significant. Miller's How Not To Run an A/B Test says to "Decide on a sample size in advance and wait until the experiment is over," because stopping as soon as there is a significant result makes reported significance levels unreliable. Keep users sticky to one arm so the same person does not see both.

Pitfalls

Ramp or roll back

Write the rule before the test: for example, ramp if the challenger meets the success metric without breaching your latency and cost ceilings, and roll back if it breaches a ceiling. The thresholds are yours; none is published as a standard. With weighted routing the rollback is a config change, and Portkey notes a weight of 0 stops traffic to a target without removing it from the config.

Afterward keep monitoring: models change and traffic shifts. See the live LLM monitoring guide and, if repeated prompts are common, what a semantic cache can cut.

Questions people ask

What is the safest way to try a new LLM in production?

Run it offline, then in shadow so users never see it, then as a small canary behind a gateway or flag. Portkey's canary guide shows a 5% example, but no source sets the right share for you.

Do I need a feature-flag platform, or is a gateway enough?

A gateway can split traffic by weight, as Portkey documents. A platform such as LaunchDarkly adds metrics tied to end-user behavior. Which you need depends on whether you must measure user outcomes.

How many requests do I need?

It depends on your baseline and the smallest difference you care about. Evan Miller's calculator gives 2,545 per variation for one conversion-rate example. Use a calculator with your own numbers and fix the sample size first.

Can an LLM judge decide the winner?

It can score at scale, but judges show position, verbosity and self-enhancement bias per Zheng et al.. Use it with human spot checks and a different grading model.

What if my traffic is too low for a clean test?

Lean on shadow runs and offline evals, and roll out gradually with guardrails instead of claiming a winner. No source read here gives a minimum traffic level.

Sources

Facts were read from the linked pages on October 20, 2026. Prices and product features change; confirm them on the vendors' pages. Thresholds, traffic shares and sample sizes here are examples or your own to set, not standards.

Top photo: Carl Lender / CC BY 2.0 via Wikimedia Commons