LangSmith blueprint · EdTech
Prompt & model experiments
Versioned prompts, one dataset and side-by-side experiments decide which prompt and model ship.
- Steps
- 7
- Subjective questions
- 32
- Objective questions
- 32
The problem and the outcome
Problem: The team argues about which tutor prompt is better from three hand-picked chats.
Outcome: Prompt and model choices made on hundreds of real questions, with cost in view.
Architecture
How it works, step by step
- A tutor prompt is drafted and tweaked in the LangSmith Playground.
- Each version is saved as a commit and tagged, so the app pulls a tag instead of pasted text.
- A dataset holds a few hundred real student questions with reference answers.
- One experiment per candidate: prompt v1, prompt v2 and a cheaper model, all on the same dataset.
- Evaluators score each answer: correctness against the reference, and an LLM-as-judge for tone at the student's level.
- A pairwise view shows which version wins example by example, next to its cost and latency.
- The winner gets the prod tag, and the app picks it up without a code change.
Tech stack
- LangSmith Playground
- LangSmith prompts with commits and tags
- Datasets of real questions
- Evaluators (reference-based, LLM-as-judge)
- Pairwise comparison view
Key design decisions
- Prompts are versioned and tagged, and the app pulls a tag, so changing the prompt does not need a code deploy.
- Every candidate runs on the same dataset, so scores are comparable.
- Cost and latency are compared next to quality, not after.
Common mistakes
- Choosing a prompt from a handful of favourite examples.
- A dataset with no hard or edge cases.
- Changing the prompt and the model at the same time, so you cannot tell which helped.
What to measure
- Correctness vs. reference
- Judge score for tone and level
- Pairwise win rate
- Cost and latency per answer
Most-asked interview questions
Subjective questions 32
1Walk through running a prompt experiment in LangSmith.Asked almost every time
Pick a dataset of representative inputs with reference outputs, define evaluators (code checks plus LLM judges with rubrics), run the baseline prompt and the candidate as separate experiments with identical settings and several repetitions, compare scores and per-example differences in the comparison view, review surprising cases manually, then promote the winner by tagging its prompt version.
2How do you choose metrics for a prompt experiment?Asked almost every time
Start from what users need: correctness against references, format validity, faithfulness to sources, helpfulness, tone and safety, plus cost and latency. Pick a primary metric for the decision and guardrail metrics that must not regress.
3How do you avoid fooling yourself with prompt experiments?Asked almost every time
Use a fixed dataset that was not used to write the prompt, repeat runs, look at variance and statistical significance, check per-example results instead of averages only, keep a holdout set, and validate wins with real traffic.
4How do you decide whether a new prompt is better?Very often asked
Run both on the same representative dataset, score them with evaluators that reflect what matters (correctness, format, tone), compare averages and look at examples where they differ, and check the difference is larger than run-to-run noise. Then check cost and latency before switching.
5What is pairwise evaluation and when is it useful?Very often asked
A judge (person or model) sees two answers to the same input and picks the better one. It is useful for subjective qualities such as helpfulness or tone, where absolute scores are unreliable but comparisons are consistent.
6How do you compare two models fairly?Very often asked
Use the same prompt (adapted only where necessary), dataset, evaluators and parameters, compare quality alongside cost and latency per request, and test on your own data rather than public leaderboards.
7How do you version prompts?Very often asked
Store prompts in a prompt hub or repository with commit history, use tags such as staging and production, link each experiment to a prompt version, and roll back by moving the tag.
8When should you use pairwise comparison instead of scores?Very often asked
When quality is subjective and absolute scores are noisy, such as writing quality or helpfulness; judges (human or LLM) are better at choosing between two outputs than rating one.
9How do you control randomness in experiments?Very often asked
Use low temperature for deterministic tasks, run several repetitions for others, fix seeds where providers support them, and report averages with confidence intervals.
10How do you test prompts against regressions in edge cases?Very often asked
Keep tagged slices in the dataset (long inputs, other languages, adversarial inputs, empty fields) and require that each slice's score does not drop, not just the overall average.
11How do you use the playground effectively?Very often asked
Iterate quickly on a few examples in the playground, then run the full dataset as an experiment before deciding; the playground is for exploration, experiments are for decisions.
12How do you measure cost and latency in experiments?Very often asked
LangSmith records tokens and latency per run; compare totals and percentiles per experiment and include them in the decision alongside quality.
13How do you configure experiment runs in LangSmith to save time and money?Very often asked
Use the experiment configuration options for repetitions, concurrency and caching: repetitions run each example several times to measure variance, concurrency runs examples in parallel, and caching reuses results so unchanged parts are not recomputed.
Sourced from Docs by LangChain (MCP)
14How do you set up a human pairwise comparison of two prompt versions?Very often asked
Run both prompts as experiments on the same dataset, select exactly those two experiments and add them to a pairwise annotation queue. LangSmith pairs runs from the two experiments, and reviewers decide whether run A, run B or both are better for each rubric item.
Sourced from Docs by LangChain (MCP)
15Why manage prompts outside the code?Often asked
Prompts change more often than code and are often edited by people who are not engineers. Versioning them with commits and tags gives history, review and rollback, and lets you promote a tested version without redeploying.
16How large should an experiment dataset be?Often asked
Large enough to detect the differences you care about: tens of examples show big changes, hundreds are needed for small improvements; prioritise quality and coverage of real cases.
17What is prompt overfitting?Often asked
Tuning a prompt to pass specific test examples (sometimes by mentioning them) so it scores well on the dataset but generalises poorly to new inputs.
18How do you run A/B tests in production after offline experiments?Often asked
Route a percentage of traffic to the new prompt version, compare online metrics (feedback, task completion, escalations), watch guardrails and stop early if problems appear.
19How do few-shot examples affect experiments?Often asked
Examples strongly shape outputs; test different example sets as separate variants and make sure examples do not overlap with evaluation data.
20How do you document an experiment decision?Often asked
Record the hypothesis, prompt versions, dataset version, metrics, results, notable examples and the decision, linked from the change that ships it.
21How do you evaluate structured output prompts?Often asked
Validate outputs against the schema in code, measure field-level accuracy against references, and check robustness on unusual inputs.
22How do you handle judge model changes?Often asked
Re-validate the judge against human labels, rerun baseline experiments with the new judge so scores stay comparable, and version judge prompts.
23What is a guardrail metric?Often asked
A metric that must not get worse when optimising the primary one, such as safety violations, latency or cost, so improvements do not hide regressions elsewhere.
24Where should the examples for a prompt experiment come from?Often asked
Datasets can be built from manually curated test cases, historical production traces or synthetic data generation. Mixing real traces with curated edge cases gives a set that reflects both common and difficult inputs.
Sourced from Docs by LangChain (MCP)
25Which evaluator types can score a prompt experiment?Often asked
Human review, code evaluators for rule-based checks, LLM-as-judge evaluators and pairwise comparisons. Use code checks for objective properties like format, and judges or humans for qualities such as helpfulness.
Sourced from Docs by LangChain (MCP)
26How do you check a new prompt keeps working after release?Often asked
Configure online evaluators on the production project with a sampling rate, so a share of live runs is scored automatically, and add failing traces back to the dataset for the next offline experiment.
Sourced from Docs by LangChain (MCP)
27How do you decide whether a small score difference between prompts is real?Often asked
Repeat runs to measure variance, look at per-example differences rather than only averages, check the result holds across dataset slices, and treat a difference smaller than run-to-run noise as no difference.
28How often should experiments be run?Sometimes asked
On every prompt or model change, automatically in CI for important prompts, and periodically to detect drift in provider models.
29What is model drift in hosted models?Sometimes asked
Changes in a provider's model behaviour over time or between versions; pin model versions where possible and rerun experiments when upgrading.
30Who should review experiment results?Sometimes asked
Engineers plus domain experts or product owners, who can judge whether score changes reflect what users value.
31How do you share prompt changes with the team?Sometimes asked
Link experiment comparisons in pull requests, summarise wins and trade-offs, and keep a changelog of production prompt versions.
32How do you test a prompt's behaviour on very long inputs?Sometimes asked
Add examples at and near the context limit to the dataset, measure truncation, latency and whether key instructions are still followed, and compare strategies such as summarising or chunking long inputs.
Objective questions 32
1Which metric type decides between prompts?Asked almost every time
Why: Guardrails must not regress.
2Why not tune and evaluate on the same examples?Asked almost every time
Why: Keep a separate holdout set.
3How is the winning prompt promoted?Asked almost every time
Why: Rollback by moving the tag back.
4To compare two prompts fairly you should…Very often asked
Why: The same inputs make the scores comparable.
5Pairwise comparison suits…Very often asked
Why: Choosing is easier than rating.
6Comparing two models fairly requires…Very often asked
Why: Plus cost and latency.
7What are dataset slices for?Very often asked
Why: Averages hide slice drops.
8The playground is best used for…Very often asked
Why: Full experiments make the decision.
9What does a guardrail metric protect?Very often asked
Why: No hidden regressions.
10How should randomness be handled?Very often asked
Why: Results vary between runs.
11Which experiment option measures run-to-run variance?Very often asked
Why: Running each example several times shows the noise.
Sourced from Docs by LangChain (MCP)
12A pairwise annotation queue for two prompts needs…Very often asked
Why: Runs from the two experiments are paired for review.
Sourced from Docs by LangChain (MCP)
13What does a pairwise evaluator output?Often asked
Why: It compares two outputs for the same input.
14Why change only one thing per experiment?Often asked
Why: Changing the prompt and the model together hides which one helped.
15Prompt overfitting shows up as…Often asked
Why: Validate on new inputs.
16How large a dataset detects small improvements?Often asked
Why: Big changes need fewer.
17After offline wins, the next step is…Often asked
Why: Watch online metrics.
18Few-shot examples must not overlap with…Often asked
Why: Otherwise results are inflated.
19How are structured output prompts evaluated?Often asked
Why: Run code checks before judges.
20When the judge model changes you should…Often asked
Why: Keep scores comparable.
21What should experiment documentation include?Often asked
Why: Linked from the shipping change.
22What records tokens and latency per run?Often asked
Why: Compare per experiment.
23Dataset examples can come from…Often asked
Why: Mixed sources cover common and edge cases.
Sourced from Docs by LangChain (MCP)
24Online evaluators after release score…Often asked
Why: Sampling keeps monitoring affordable.
Sourced from Docs by LangChain (MCP)
25Caching in experiment runs…Often asked
Why: It saves time and cost on repeat runs.
Sourced from Docs by LangChain (MCP)
26A score gap smaller than run-to-run noise means…Often asked
Why: Noise can create apparent gaps.
27Hosted model drift is handled by…Sometimes asked
Why: Providers change models.
28Experiment results are best reviewed by…Sometimes asked
Why: Scores must match user value.
29When should important prompt experiments run?Sometimes asked
Why: Catch regressions early.
30Prompt changes in pull requests should link…Sometimes asked
Why: Reviewers see the evidence.
31Low temperature suits…Sometimes asked
Why: Less variation between runs.
32Long-input tests should measure…Sometimes asked
Why: Long inputs often break instructions or hit limits.
Track your progress through every blueprint in your dashboard.
Start learning