LangSmith Evaluation: How to Test LLM Apps with Datasets and Experiments

LangSmith Evaluation: How to Test LLM Apps with Datasets and Experiments

LangSmith evaluation is the testing and measurement layer of LangSmith, the observability and evaluation platform from the team behind LangChain. It lets you build datasets of test cases, run your application against them, score the results with evaluators and compare versions side by side. The central question is whether it can replace ad-hoc manual testing, and the answer is yes for the repeatable parts: it turns “try a few prompts and see” into a process you can run on every change.

LangSmith is best known for tracing, the recording of every step an LLM application takes on a request. Evaluation builds on those traces: the cases that broke in production become test cases, and every new version is checked against them before it ships. That loop, from trace to test case to experiment, is what makes LangSmith evaluation useful rather than just another dashboard.

Key takeaways

  • LangSmith evaluation scores LLM apps with datasets, evaluators and experiments, on the LangChain platform.
  • Offline evaluation tests versions before release; online evaluation monitors live production traces.
  • Datasets hold examples with inputs and reference outputs; experiments compare versions on the same dataset.
  • Evaluators include human review, code checks, LLM-as-a-judge and pairwise comparison.
  • Production failures should become dataset cases, so regressions are caught before they recur.

What is LangSmith evaluation?

LangSmith evaluation is a framework for measuring the quality of LLM applications throughout their lifecycle, from pre-deployment testing to production monitoring. It is part of LangSmith, which also provides tracing, prompt management and monitoring, and it is designed to work with applications built on LangChain and LangGraph as well as other frameworks and plain provider SDKs.

The core idea is simple: define what good looks like as a set of test cases, run the application against them, and score the results. A dataset is a collection of examples, each with inputs and optionally a reference output that defines the expected answer. An experiment is the result of running one version of the application against a dataset, capturing outputs, scores and traces for every example.

That structure matters because LLM applications change constantly. Prompts are edited, models are swapped and retrieval settings are tuned, and each change can quietly move quality. Experiments give you a record of what changed and what it did to quality, so decisions are based on measurements rather than impressions.

Offline and online evaluation

LangSmith supports two kinds of evaluation, and they serve different purposes. Offline evaluation is pre-deployment testing: you run your application against a dataset of curated examples, usually with reference outputs, and check correctness against the expected answers. Best for: regression testing, benchmarking and comparing prompts or models before a release.

Online evaluation is production monitoring: it runs on real traces from live traffic, which have no reference answers. Instead of checking correctness against an expected output, online evaluators look for quality patterns, safety problems and degradation over time. Best for: catching problems that only appear in production, such as new question types or shifting user behaviour.

The two kinds of evaluation feed each other. When online evaluation finds a production trace where the application failed, that trace can be turned into a dataset example, so the next version is tested against it offline. That loop is the most valuable workflow in LangSmith evaluation, because it means the test set grows from real failures rather than from guesses about what might go wrong.

The core building blocks

Datasets are the foundation. A dataset is a collection of examples used for evaluating an application, and each example consists of inputs, such as the variables passed to the application, and reference outputs where they exist. Building a good dataset is the hardest part of evaluation, because it requires deciding which cases represent real use, including the edge cases and the failures you have already seen.

Experiments are how datasets are used. Each experiment captures the outputs, evaluator scores and execution traces for every example in a dataset, for one specific version of the application. Multiple experiments typically run on the same dataset to test different configurations, such as different prompts or models, and LangSmith displays them side by side for comparison.

Evaluators are the measurement layer. They are workspace-level resources that score application performance, adapting to what data is available: offline evaluators can check correctness against reference outputs, while online evaluators focus on quality patterns in live traces. An evaluator can be a human, a code check, an LLM judge or a pairwise comparison.

Traces tie it all together. A trace is the full record of one request, made up of nested runs for each step, such as a model call, a retriever query or a tool invocation. When an experiment result looks wrong, the trace shows which step went wrong, which turns a bad score into a diagnosis.

Evaluator types compared

Evaluator type How it scores Main strength Main risk
Human review People score outputs in annotation queues Highest trust for subtle cases Slow and costly at scale
Code checks Deterministic rules such as exact match or valid JSON Fast, cheap and reproducible Cannot judge nuance or style
LLM-as-a-judge A model grades output against criteria Scales to open-ended answers Can be biased or inconsistent
Pairwise comparison Two outputs are ranked against each other Sensitive to small improvements Needs two versions to compare

Most teams combine them: code checks for format, an LLM judge for qualities such as faithfulness or helpfulness, and human review for subjective cases. Our guide to AI evaluation best practices explains how to combine methods without letting any one of them become the only measure.

A small team of developers gathered around a large monitor reviewing charts together in a bright office
Experiment comparison is where LangSmith evaluation earns its keep: two versions run on the same dataset, and the scores show which one is actually better.

How a typical LangSmith evaluation workflow runs

Start by instrumenting the application so tracing is on in development, and every run is recorded. When an answer is wrong, the trace shows which step failed: retrieval, prompt, tool choice or output parsing. That diagnosis is the first step, because it tells you what kind of test case the failure belongs in.

Next, build a dataset. Save representative inputs and expected outputs, including the cases that broke. Production traces are a good source: filter for low feedback scores, high latency or specific failure types, and add the interesting ones to the dataset. A dataset built from real failures is worth far more than one built from imagined ones.

Then add evaluators. Combine code checks for format, LLM-as-a-judge scoring for qualities such as faithfulness, and human review for the subjective cases. Keep the evaluator set small at first: each evaluator adds cost and complexity, and a few well-chosen ones beat a dozen noisy ones.

Finally, run experiments. Test each prompt or model change against the dataset and compare scores before merging the change. If the new version scores worse on any important evaluator, the experiment tells you exactly which examples got worse, and the traces show why.

When LangSmith evaluation fits, and when it does not

LangSmith evaluation fits best when you are already tracing with LangSmith, or when you work in the LangChain and LangGraph ecosystem and want evaluation tightly integrated with your tracing. The side-by-side experiment view and the trace-to-dataset workflow are genuinely useful, and they are hard to reproduce by stitching together separate tools.

It is also a good fit for teams that need both offline and online evaluation in one place. Many tools do one well and the other poorly; LangSmith’s design treats them as two modes of the same system, with the same evaluators and the same workflow for turning production failures into test cases.

It fits less well when data must stay inside your own infrastructure, since LangSmith is a hosted platform and traces leave your machines. Teams with strict data locality requirements, or those who prefer open-source tools they can run themselves, often choose a self-hosted alternative instead. Our guide to LLM observability explains the broader landscape and what to look for in any platform.

It is also worth saying plainly that LangSmith evaluation does not write your test cases for you. It gives you the structure, datasets, experiments and evaluators, but the quality of the evaluation still depends on the quality of the dataset. A team that skips dataset curation will get precise-looking scores that measure the wrong things.

LangSmith evaluation checklist

  • Tracing is on, so failures can be diagnosed from traces, not guessed at.
  • The dataset is built from real inputs, including production failures.
  • Examples have reference outputs where correctness can be checked.
  • Evaluators cover format with code checks and quality with an LLM judge.
  • Human review is used for subjective cases and for calibration.
  • Experiments compare versions on the same dataset before merging.
  • Online evaluation monitors live traces for quality and safety patterns.
  • Production failures are turned into dataset cases.
  • Results are tracked over time so regressions are visible.
  • The dataset is refreshed as the product and its users change.

Frequently asked questions

Do I need to use LangChain to use LangSmith evaluation?

No. LangSmith is framework-agnostic: applications built with plain provider SDKs or other frameworks can send data to it through its Python and TypeScript libraries or through OpenTelemetry. The integration is tightest with LangChain and LangGraph, but it is not required.

What is the difference between a dataset and an experiment?

A dataset is the test set: a collection of examples with inputs and optional reference outputs. An experiment is the result of running one version of your application against a dataset, capturing outputs, scores and traces for every example. One dataset can have many experiments, one per version tested.

What is the difference between offline and online evaluation?

Offline evaluation runs before deployment on a dataset with reference outputs, so it can check correctness. Online evaluation runs on live production traces, which have no reference answers, so it focuses on quality patterns, safety and degradation over time.

Can LangSmith evaluation replace human review?

No. Human review is one of the evaluator types LangSmith supports, and it remains the most trusted for subtle cases. The platform’s strength is combining human, code and LLM evaluators, not replacing any one of them.

How do I choose evaluators?

Start with the qualities that matter for your application, such as correctness, faithfulness or helpfulness, and pick the cheapest evaluator that measures each one reliably. Code checks handle format, an LLM judge handles open-ended quality, and humans handle the subjective cases.

What should I do when an experiment shows a regression?

Look at the examples that got worse and their traces, not just the average score. The traces show which step changed, whether retrieval, prompt or model, and that tells you what to fix. Add the failing examples to the dataset if they are not there already, so the regression is caught earlier next time.

Latest articles

Scroll to Top