llm experimentation

The Complete Guide to LLM Experimentation: Compare Prompts, Models, and Agents

Jun 14, 2026·12 min read

Kritin Vongthongsri
Co-founder @ Confident AI. LLM Evals & Safety Wizard. Previously ML + CS @ Princeton researching self-driving cars.

Every AI team eventually ends up in the same debate: is this new prompt actually better, or do we just like the 3 examples we happened to look at?

This is what LLM experimentation is for. It gives you a controlled way to compare two or more versions of your AI app against the same dataset, using the same metrics, before you push changes to production.

No vibes, no cherry-picked examples, and no gut feel. Instead, you get a repeatable process for deciding which prompt, model, tool set, or agent configuration should actually ship.

In this guide, I'll walk through the full LLM experimentation workflow: what LLM experimentation means, how it differs from evaluation, how to choose what to optimize, how to curate datasets and metrics, how to interpret results, how to extend experiments into production, and how Confident AI supports the loop end-to-end.

TL;DR

What Is LLM Experimentation?

LLM experimentation is the process of comparing multiple versions of an LLM app under controlled conditions. Each version runs against the same evaluation dataset and gets scored by the same metric collection so you can see which version performs better.

The basic experimentation process looks like this:

  1. Pick the parameter you want to optimize: prompt, model, tool set, retrieval config (top-k, chunking, reranker), agent architecture (planner, memory, reflection loop), etc.
  2. Choose a fixed dataset that represents the use case.
  3. Prepare a collection of metrics that evaluate what you care about.
  4. Run every variant against the same dataset and metric collection.
  5. Compare aggregate scores, inspect failures, and decide what to ship or investigate next.

Choosing a winner is also not always straightforward. If version A performs better on 50% of test cases and version B wins on the other 50%, you need to inspect the trade-offs before deciding what to ship.

LLM Experimentation vs LLM Evaluation

That distinction matters because evals are easy to mistake for experiments. If you run prompt A today, prompt B tomorrow, compare the pass rates, and call it a decision, the comparison is noisy unless both versions ran on the same dataset, with the same metrics, under the same conditions.

LLM Experiments vs A/B Tests

An LLM experiment is usually done offline in development or staging. You can compare many prompt, model, tool, retrieval, or agent variants against the same dataset and evaluation metrics.

An A/B test compares two versions, usually A vs B. In production, that usually means splitting live traffic across two LLM app versions and measuring product outcomes.

In practice, offline experiments and A/B tests in production are usually used together to continuously improve an LLM app or agent.

Running an LLM Experiment

Running an LLM experiment should be easy once you have the right setup. A good setup is controlled in the right ways: clear baseline, clear variants, fixed dataset, and fixed metrics.

The minimum workflow for an LLM app or agent looks like this:

  1. Choose what to optimize.
  2. Choose a baseline app or agent version.
  3. Create one or more app or agent variants.
  4. Run every version on the same evaluation dataset.
  5. Score every version with the same metric collection.

This lets you answer the practical question: if we swapped production to this version, what would likely get better and what would likely get worse?

Choosing What to Optimize

Most LLM apps have a lot of knobs. Prompts, models, tools, retrieval, temperature, memory, response format, and planner instructions can all change behavior.

Parameter When to Optimize What You Compare
Prompt You want better wording, instructions, examples, formatting, or refusal behavior Two different task prompts, such as a concise instruction prompt vs a few-shot prompt
System prompt You want to change the app's role, policy, tone, or global constraints Two different system prompts, such as a strict policy-first prompt vs a more conversational prompt
Model You want to trade off quality, cost, latency, or reliability Different models, such as GPT-4o vs Claude vs Gemini
Tool set You want to know whether an agent can complete tasks more reliably with different tools Different tool configurations, such as the current tools vs a version with a refund lookup tool added
Retrieval config You want better grounding or context selection in a RAG workflow Different retrieval settings, such as top-k 3 vs top-k 8, or no reranker vs reranker
Temperature You want to test creativity, determinism, or consistency Different decoding settings, such as temperature 0 vs 0.3 vs 0.7
Memory strategy You want a multi-turn agent to remember useful context without drifting Different memory approaches, such as no memory vs short-term memory vs summarized memory
Agent planning You want to reduce loops, wrong tool calls, or unnecessary reasoning Different planning instructions, such as a direct tool-use planner vs a step-by-step planner

Curating Your Evaluation Dataset

Your dataset is the test bed your variants have to run across. If it is too easy, every version wins. If it is random, the result is noisy. If it is not representative, you optimize for a fake product.

A good experiment dataset usually includes a few general categories, plus use-case-specific cases for the kind of LLM app you are testing:

Choosing Your Metrics

Your metrics are the scoreboard. If the scoreboard is wrong, the experiment is wrong.

For most LLM experiments, start with the 2 + 3 rule: use 2 out-of-the-box metrics for common failure modes and 3 custom metrics for the use-case-specific behavior that makes your app good or bad.

Not every metric needs to apply to every test case.

Signal Why It Matters
Latency A higher-quality answer can still be unusable if it is too slow
Cost A variant can win on quality but be too expensive to ship broadly
Tool retries The final answer may look correct while the trace shows instability
Escalation rate A prompt that sounds better may still fail to resolve the task
Abstention or refusal rate The variant may become too cautious or not cautious enough

Comparing Prompts Side by Side

That is why you usually should not send every prompt idea straight into a full experiment. Before scoring 100+ test cases, run each candidate prompt on one representative test case and inspect the answer it generates.

Interpreting Experiment Results

A good experiment report does more than tell you "B scored higher." It shows whether B is better in the ways that matter.

When you read the report, look for:

Running Experiments in Production

Offline experiments should catch obvious regressions. Production experiments tell you whether the strongest candidate still works under real traffic, real retrieval data, and real business constraints.

The relationship should look like this:

  1. Use offline experiments to eliminate weak variants.
  2. Ship the strongest candidate behind versioning.
  3. Run a canary, shadow deployment, or A/B test if the change is meaningful.
  4. Monitor online evals and product metrics.
  5. Feed production failures back into the next offline experiment.

A/B Testing Prompts and Models

Use offline experiments to eliminate bad candidates, then use shadow traffic, canaries, or production A/B tests to confirm the strongest version under real traffic.

Improving Your Experiments

The best LLM experiments get more useful over time. Each production run should teach you what to add to the evaluation dataset, what to measure next, and which metrics need sharper criteria.

Expanding Your Evaluation Dataset for Experiments

Your evaluation dataset should get better every time production teaches you something.

Expanding Your Metric Suite

Production should also teach you when your metrics are incomplete or misaligned.

Common LLM Experimentation Pitfalls

Most LLM experimentation failures come from bad experimental design:

Why Confident AI Is the Best Platform to Run LLM Experiments

A useful LLM experimentation platform is not just a playground. Confident AI lets teams compare various aspects of their AI apps against the same dataset and metric collection.

Conclusion

LLM experimentation is not complicated, but it does require discipline. Compare variants against the same dataset. Score them with the same metrics. Change one variable at a time. Read both the aggregate scores and the individual failures. Then choose the version that wins on the quality bar you actually care about.