Comparing prompt versions with Langfuse prompt experiments

Prompt experiments in self-hosted Langfuse let teams test a prompt or model change against a dataset in the UI before release. This page covers the setup, the decisions that shape the results and what to confirm first.

On this page

Comparing prompt versions with Langfuse prompt experiments before release

A team about to change a production prompt or model needs evidence before release, not a hunch from a few manual chats. Langfuse prompt experiments let you run a prompt version or model change against a dataset directly in the Langfuse UI, score each output automatically, and read the results side by side with the current version. You choose the prompt, map its variables to the keys in a dataset, pick the dataset version you want to test against, and decide which scorers run. The output is a comparison you can review before anyone changes the production label.

Use prompt experiments when the change is to a prompt or model and the people reviewing it work mainly in the UI, such as product owners, prompt engineers or domain experts. Use code-based experiments through the SDK when the change is to application logic, when the test needs custom retrieval or tool calls, or when results must gate a CI pipeline. The two approaches read the same datasets, so a team can start in the UI and move repeatable checks into code later. Confirm in the current Langfuse prompt management documentation which evaluators and dataset features each path supports, because the UI and SDK surfaces change between releases.

The feature is part of the MIT-licensed core that self-hosted deployments share with Langfuse Cloud, so no Enterprise license key is needed to run prompt experiments. Before you start, confirm that the ClickHouse, PostgreSQL and blob storage in your instance are sized for the number of dataset items and scorers you plan to run, since each experiment item generates traces and scores. Also decide who may create and approve prompt versions, because a comparison is only as trustworthy as the controls around the prompt it tests.

How to set up a prompt experiment step by step

This sequence takes a prompt or model change from a dataset and a candidate version to a scored, side-by-side comparison in the Langfuse UI, so the team can decide what to release before anything reaches production.

  1. Create the dataset with expected keys

    Create a dataset in your self-hosted Langfuse project and add items whose input objects use consistent key names, such as the variables your prompt expects, plus expected outputs where you have them. The person doing this is usually the prompt owner or an engineer who knows the production inputs. Check that every item uses the same key names and that no item contains data you are not allowed to keep in test sets. The step is done when the dataset lists the items you intend to test against.

  2. Create the prompt version to test

    Duplicate the current production prompt in the prompt management area and edit only the change you want to evaluate, such as wording, instructions or the model configuration. Keep the variable placeholders identical to the baseline unless you are deliberately testing a rename. Save the candidate as a new version and leave the production label on the current version. The step is done when the baseline and candidate versions both exist, and you can name the single difference between them.

  3. Select and record the dataset version

    Choose the dataset version the experiment will run against, and record which version you picked in the experiment notes or the run name. Datasets change as items are added or edited, so an unrecorded version makes later comparisons unreliable. Repeat the run on the same version for both the baseline and the candidate. The step is done when both runs point to the same, recorded dataset version.

  4. Map prompt variables to dataset keys

    In the experiment setup, match each variable in the prompt to a key in the dataset input. Confirm that spelling and case match exactly, because a missing or misnamed key can produce an empty or misleading output rather than an error you can easily see. Check the first few runs for variables that rendered as blank text. The step is done when every prompt variable maps to a dataset key and a spot-check of rendered inputs shows no gaps.

  5. Configure automatic scoring for the experiment

    Attach the evaluators that will score each output, such as an LLM-as-a-judge evaluator or a deterministic check, and confirm which score names they write. Use the same evaluators for the baseline and the candidate so the scores are comparable. Confirm that any judge model connection is configured for the project and that the evaluator's expected output fields exist in the dataset. The step is done when each evaluator is listed with its score name and both runs are set to use it.

  6. Run the experiment for baseline and candidate

    Start the experiment for the baseline prompt version and then for the candidate, using the mapped variables, the pinned dataset version and the same evaluators. Wait until both runs finish and check the run status for errors or skipped items. Record any item that failed, since a failed item is not a score. The step is done when both runs show completed status with item counts that match the dataset.

  7. Read the side-by-side comparison

    Open the comparison view for the two runs and review scores per item, aggregate scores and the outputs next to each other. Read the items where the candidate lost ground, not only the averages, and confirm the scores match what a reviewer would judge from the text. Note the decision, the reason and the dataset version in your change record. The step is done when the team has a recorded decision to release, revise or discard the candidate, backed by the item-level evidence.

Which experiment configuration fits which change

This table compares the common experiment setups for a prompt or model change, with when each fits and what it cannot show. Read each row as a question to answer before you run the experiment, because the setup you pick decides which conclusions the results can support.

ConfigurationWhen it fitsWhat it cannot show
New prompt version against a baselineThe wording, structure or instructions changed and the model stayed the sameWhether the gain holds for a different model or for dataset items outside the selected set
Same prompt on a different modelYou are evaluating a model swap or provider change with the prompt held constantWhether the prompt itself is the best fit for the new model, since prompt tuning may change the result
Pinned dataset versionYou need a repeatable comparison across runs, for example before a release or in a review recordWhether the pinned items still reflect current production traffic
Latest dataset versionYou want the experiment to reflect recent additions and corrections to the test setA clean before and after comparison, because the item set may differ between runs
Automatic scorers onlyYou need fast, consistent scores across many items and the criteria can be written as rules or judge rubricsWhether the scorers agree with what users or experts value, until they are checked against human labels
Manual review on top of automatic scoresThe change affects tone, judgment or high-risk output where a reviewer must confirm qualityScale: reviewing every item may be slow, so confirm the sample size and reviewer time before you commit
Small illustrative set, a few itemsYou are checking that the setup works or spotting obvious failures before a larger runStatistical confidence or differences of a few points, since a small set can flip with one item

How the prompt experiment flows from dataset to comparison

The experiment starts with a chosen dataset version whose items each supply the inputs and expected outputs. Each item's fields are matched to the prompt's variables through a variable-to-key mapping, so the same item drives one model run per prompt or model variant. Scorers then grade every output, and the reviewer checks the side-by-side comparison before deciding whether the change is released. Confirm the mapping and dataset version first, because a wrong key quietly changes what is being tested.

The path from dataset items and prompt variables to a reviewer's release decision.

Where variable mapping and dataset choice go wrong

Most failed prompt comparisons are not model failures. They come from mismatched inputs, shifting test data, thin samples and scores that measure the wrong thing. Each card below is a check to make before you trust a side-by-side result.

Mismatched variable and key names

A prompt variable such as {{customer_question}} must map to a dataset item key with the same name, or the run will not supply the value you think it does. Compare the variable list in each prompt version against the input keys in the dataset before starting. A mapping that looks correct in one version can silently break in the other if the variable was renamed during editing.

Langfuse self-hosting docs

Unpinned dataset versions

If a run uses the latest state of a dataset, items added or edited between your baseline and candidate runs change the comparison, and the score difference may reflect the data rather than the prompt. Record which dataset version each run used and run both prompt versions against the same version. Treat a new dataset version as a new experiment baseline.

Too few items for a decision

A handful of items can produce a large score gap from a single unlucky case. Decide the minimum item count and the mix of cases (common requests, edge cases, known failures) before the run, not after you see the scores. Ask your evaluation owner to state what difference would justify a release, and whether the item set is large enough to show it.

Scorers that miss the release criterion

A judge that rewards fluent answers will not catch a prompt that drops a required disclaimer or invents a policy number. Write down the failure the release must prevent, then confirm that at least one scorer tests it directly. Check a sample of scored outputs by hand, especially where the candidate prompt wins, before accepting the automated result.

Mixing prompt and model changes

If a candidate changes both the prompt wording and the model, a score change cannot be attributed to either. Keep one variable per comparison: hold the model fixed when testing prompt text, and hold the prompt fixed when testing a model. Run a separate comparison for the second change once the first is settled.

Sensitive data in test items

Dataset items are copies of real inputs and expected outputs, so production traces often carry personal or confidential data into a space with a wider audience than the original system. Remove or pseudonymize identifiers before adding items, and confirm who in your organization can open the dataset and its runs. Your data handling rules should decide this, not the convenience of reusing live traffic.

How to read the side-by-side comparison without overreading it

The side-by-side view answers a narrow question: how did each prompt version respond to the same dataset items? Read the per-item outputs first, one row at a time, before looking at any aggregate. Open the items where the candidate and baseline diverge, check the rendered prompt and the variables that were filled from the dataset keys, and confirm the output differs for a reason you can name. Aggregate scores summarize those rows, so an average can hide a regression concentrated in one category of input, such as long documents, unusual languages or edge-case tool calls. Note the dataset version used for each run, because a score change caused by a dataset edit looks identical to one caused by a prompt edit.

Small datasets and noisy scorers are the two most common sources of false conclusions. With few items, one or two unusual outputs can move an average enough to look like a win, so treat small differences as unresolved rather than as evidence. If the scorer is an LLM-as-a-judge evaluator, run the same comparison twice on unchanged prompts to see how much the scores move on their own. Deterministic code evaluators are usually more repeatable, but they only measure what they were written to check. Confirm the judge model, its rubric and the sampling settings before you trust the numbers, and record them alongside the experiment.

Pair the UI comparison with human review before any release decision. Choose a sample that includes the items where the versions disagree, and have a reviewer who knows the product judge them against the same criteria the scorers use. Where human and automated judgments disagree, the scorer is the thing to fix, not the prompt. Document who reviewed what, which dataset version and prompt version were compared, and what the team agreed would block a release. Ask your DeployOpen or internal reviewers to confirm this process against your own risk appetite, since the right sample size and review depth depend on the consequences of a wrong output in your application.

Security and data handling for experiment data

Experiment data combines datasets, prompt versions, model credentials and the outputs your tests produce, so each one needs an owner and a control. The cards below cover who can reach that data, where it is stored in your infrastructure and how personal data is kept out of test items. Check each item in your own environment before the first experiment runs.

Project roles for datasets and prompts

Project-level RBAC decides who can create datasets, run experiments and edit prompts that feed them. On self-hosted Langfuse this role model is an Enterprise feature that needs a license key, so teams on the open source version share one access level within a project. Confirm which people can change a prompt that an experiment is scoring, because a changed prompt alters the baseline without a visible record in the comparison.

License key docs

Protected prompt labels

Protected labels restrict who can move a label such as production onto a new prompt version. Experiments that compare a candidate version against the current one depend on that label staying where it was tested. Without protection, a candidate can reach production without passing the comparison. This is also an Enterprise feature, so decide early whether the label process will be enforced by the platform or by a written release step.

License key docs

LLM connection credentials

Automatic scoring and playground runs call judge and candidate models through stored LLM connections. Those API keys are sensitive, so give each connection the narrowest provider account and model access the experiment needs. Confirm how credentials are encrypted at rest with your key management, who can view or rotate them, and whether a leaked judge key would expose production traffic.

Where experiment outputs are stored

Experiment runs, scores and model outputs are written to the same data stores as production traces, which means your ClickHouse and PostgreSQL in your infrastructure. Include them in backup, retention and restore planning, and in the access controls on database accounts. Ask your operations team who can query the ClickHouse tables directly, since that path can bypass the Langfuse interface and its role checks.

Personal data in test items

Dataset items are copied from real traffic or written by hand, and either can contain names, contact details or account identifiers. Those items are then sent to the model under test and to the judge, so personal data can leave the scope you intended. Remove or pseudonymize sensitive fields before adding an item, and use the masking features where your license covers them. Check with your privacy team whether judge providers are approved for that data class.

Review trail for experiment changes

Audit logs record administrative actions in self-hosted Langfuse, and they are an Enterprise feature. Without them, you rely on your own change records to show which prompt version, dataset version and judge configuration produced a given result. Before a release decision, write down those three identifiers next to the comparison so the result can be reproduced later.

License key docs

Running prompt experiments on a self-hosted Langfuse over time

Running prompt experiments is a recurring load on your self-hosted Langfuse, not a one-off test, so plan worker capacity, ClickHouse disk and backups before the first comparison runs. Each experiment writes new traces and scores, and every judge or code evaluator that runs against the dataset items adds work to the Langfuse Worker container. The Langfuse scaling guide recommends scaling worker containers on CPU load, so watch worker CPU during a large experiment run and add worker replicas before a team starts running comparisons in parallel. If judge scoring queues up behind production ingestion, the experiment results will arrive late and the team may start to distrust them.

ClickHouse disk growth is the cost that accumulates quietly. Experiment traces, observations and scores all persist in ClickHouse, and a team that tests prompts daily across several datasets will see that volume grow with every iteration. Set a retention approach for experiment data with your data owners, and confirm how your Langfuse version handles deletion before you promise one. Upgrades add a second disk concern: the Langfuse v3 to v4 guide advises about 3x ClickHouse disk headroom when backfilling historic data, so an upgrade window must include that space, along with the ClickHouse 25.12 or later requirement and the Helm chart step if you use bundled data stores.

Datasets and prompts are the assets you cannot regenerate, so back them up with the same discipline as trace data. A dataset built from curated production traces and its expected outputs represents review effort that is hard to reproduce, and prompt versions and labels define what each experiment compared. Back up PostgreSQL, where prompt and dataset metadata live, and your S3-compatible blob storage, then test a restore into a separate instance and confirm that dataset versions and experiment links still resolve. Record the Langfuse version next to each experiment result so a later upgrade does not leave you unable to explain an old comparison.

Questions teams ask before running prompt experiments

How long does it take to set up prompt experiments in self-hosted Langfuse?

Setup time depends mostly on whether a working self-hosted Langfuse instance already exists and how many prompts, datasets and evaluators you need on day one. A team that already runs Langfuse can usually start with one prompt, one dataset and one judge scorer. A new deployment adds infrastructure work first, because the stack includes Langfuse Web, Langfuse Worker, PostgreSQL, ClickHouse, Redis or Valkey and S3-compatible blob storage. The main drivers are:

  • Whether the instance is already deployed and upgraded to a version that includes the experiment UI
  • How clean the prompt variables and dataset keys are
  • How many evaluators must be written, calibrated and agreed before results are trusted

Ask any partner for a written scope that separates these phases before committing to a schedule.

Can an internal team run prompt experiments without a partner?

Yes, for teams with platform and LLM application skills. The core features and APIs are available in the MIT-licensed open source version without limits, and the experiment workflow is part of that core. Internal teams usually struggle in three places: sizing and operating ClickHouse, PostgreSQL and blob storage, planning major upgrades such as the v3 to v4 path, and agreeing on evaluator rubrics that the business will accept. A partner can cover any of these in a fixed-scope engagement. Your own team can keep ownership of prompts, datasets and the decision to release a change, and a partner can hand over documentation and a runbook so that work stays in-house.

What does a partner need from our team to start?

A partner needs access and decisions more than code. Expect to provide:

  • Access to the cloud account, data center or air-gapped network where Langfuse will run
  • A named owner for prompts and a named owner for the dataset of expected behavior
  • Sample traces or test inputs that represent real use, with sensitive data removed or approved for test use
  • Credentials for the model providers used by the prompt and by the judge scorers
  • A decision on who signs off a release based on experiment results

The written scope should list these inputs and the dates by which each one is needed, so delays are visible early.

What costs should we expect for prompt experiments?

Costs fall into five groups, and only some of them are one-time:

  • Infrastructure for Langfuse and its data stores, which recurs for as long as the instance runs and grows with trace volume and retention
  • Model calls for the prompt under test and for any LLM-as-a-judge scorers, which recur with every experiment run
  • Staff time to write datasets, rubrics and evaluators, which is mostly one-time with ongoing upkeep
  • Setup and integration work, if a partner is engaged, which is one-time and priced from a written scope
  • Support, if you choose a paid tier

The Langfuse self-hosted pricing page lists a free open source plan and a custom-priced Self-Hosted Enterprise plan, so software licensing is not the usual cost driver. Ask for a quote that splits these groups and states which items recur.

Do prompt experiments replace human review?

No. An experiment compares prompt or model versions on a fixed dataset using the scorers you define, so it shows which version scores better against those criteria. It cannot tell you whether the criteria match what your users or reviewers value. Automated scores from a judge model are only as reliable as their rubric and their agreement with human labels. Use experiments to narrow the field and catch regressions, then keep a human review step for changes that affect customers, regulated decisions or sensitive content. Human annotation and calibration of judges are covered in the sibling topics on annotation queues and LLM-as-a-judge evaluators.

What makes prompt experiment results unreliable?

Results are unreliable when the dataset is too small or unrepresentative, when prompt variables do not match the dataset keys, or when the judge scorer is not calibrated. A mismatch between a prompt variable and a dataset key can produce empty or wrong inputs that look like poor performance. Before trusting a comparison, check that:

  • Every prompt variable maps to a dataset key with the expected content
  • The dataset version used is the one you intend to test
  • The judge rubric has been checked against a sample of human labels
  • The same model settings are used for each compared version, unless the model is the variable under test

If any of these fail, fix the setup and rerun the experiment before drawing a release decision.

Where does sensitive data go during prompt experiments?

Experiment inputs, outputs and scores are stored in your self-hosted Langfuse instance, so they stay within the infrastructure you control. The risk is in the data you choose to load. Datasets built from production traces can contain personal or confidential information, and judge models receive that content when they score outputs. Decide before the first run which data is allowed in test sets, which judge models may see it, and who can view the results. Self-hosted Langfuse offers Enterprise features such as data masking and retention policies, and the license key documentation lists which features require a key. Confirm those requirements with your compliance team before loading production data.

How DeployOpen scopes and delivers prompt experiment setups

DeployOpen approaches prompt experiments as part of a self-hosted Langfuse deployment in your own infrastructure. We agree what prompt and model changes will be compared, which dataset versions and variables are used, and how results will be scored and read before any build work starts, so the comparison your team relies on is defined in writing.

How we scope

  • Agree in writing which prompt versions, model changes and dataset versions will be compared in each experiment
  • Map every prompt variable to a dataset key and record any mismatches that need fixing first
  • Define the automatic scorers, score meanings and the decision each comparison supports before the build

How we build

  • Configure prompt versions and labels in your self-hosted Langfuse project with access limited to the team that owns them
  • Set up the dataset, the experiment runs and the automatic scoring against the agreed scope
  • Test the setup with a sample run, check that variables resolve correctly and confirm scores match the written rubric

How we hand over

  • Document the experiment steps, dataset version used, scorer configuration and how to read the side-by-side comparison
  • Walk your engineers and prompt owners through running a new experiment without DeployOpen involvement
  • Record the configuration in a handover file so changes to prompts or datasets can be traced later

How we support

  • Engagements are fixed-scope, and the written scope sets deliverables and timelines before work starts
  • Ongoing support, upgrades and continuous testing are available as a retainer for teams running experiments regularly
  • Confirm with us which Langfuse version and enterprise features your instance needs before scoping the work

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.