5. Domain 5: Evaluation Engineering and Quality Assurance

5.3. 5.3 Online quality measurement: sampling, A/B tests and feedback on live traffic

CCDV-P · Domain 5 · Lesson 5.3 · 18 min read

Measuring quality on live traffic: stratified sampling under privacy rules, A/B tests randomised by the right unit, biased feedback, and metrics fitted to the task.

Why the offline suite cannot settle the shorter-titles question

Harbor & Finch sells an enterprise retail platform to 8,000 merchants, from single-shop potters to department-store chains. Its listing studio turns a supplier's spec sheet into a marketplace listing: Claude extracts attributes such as size, colour and material, writes a title and a description, and a catalog agent applies bulk edits when a merchant asks for them. About 60,000 listings a day go through it.

Merchants keep shortening the titles by hand. Marketplaces cut long titles off in search results, so the product team wrote titles-v2, a prompt that aims for under 80 characters instead of the current average of 128. Dimitra, the staff engineer who owns quality for the studio, ran it through the offline regression suite, and it passed.

That pass answers a narrow question: on a fixed set of known cases, does the new prompt still produce correct titles? It cannot answer the question the business is asking. Will merchants publish more titles unchanged? Will buyers click more? Will marketplaces reject listings whose shorter titles drop a required size? Those answers exist only in live traffic, in the behaviour of real merchants and buyers.

Online quality measurement is the practice of answering them. You score a sample of live outputs, compare a change against the current version in a controlled experiment, and read the signals people leave behind, each with a metric that fits the kind of task.

Matching the metric to the task type

Here is the question that trips people up: what single number tells Dimitra whether the studio is good? There isn't one. The studio runs four kinds of task, and each fails in its own way, so each needs its own metric. A score that suits one task type hides failures in another.

Task type Metric that fits How Harbor & Finch computes it
Extraction (attributes from the spec sheet) Field-level accuracy, per field Exact match after normalising case and units, against the value the merchant finally publishes
Generation (title, description) Rubric score and edit distance A judge scores sampled titles against a rubric; code measures how much the merchant changed the draft
Agentic (catalog agent bulk edits) Task completion, steps, cost A state check confirms the requested edit landed; the trace gives turns and tokens per completed task
Retrieval-grounded (description claims from the spec sheet) Groundedness and citation accuracy Every claim must be supported by the source; every cited passage must actually support its claim

Memorise the pairing in the first two columns; the third is one way to compute it.

For extraction, report accuracy per field, never per record. A record-level 94% can hide a size field that is wrong one time in five, and size is exactly the field that gets listings rejected. For generation, there is no single right title, so exact match and overlap scores against a reference punish good alternatives. Use a rubric score from a calibrated judge, plus edit distance: the smallest number of single-character insertions, deletions and substitutions that turn the draft into the published text. Divided by the length of the longer text, it runs from 0 (published unchanged) to 1 (rewritten from scratch).

For agentic work, the final message is not the outcome. The catalog agent can report "done" while update_listing failed on half the items, so verify the catalog state. Then add steps and tokens per completed task: an agent that needs twice the turns to finish has regressed in cost and latency, even if completion holds. For retrieval-grounded text, two separate checks matter. Claude's citations feature guarantees that each citation contains a valid pointer to the documents you supplied; whether the cited passage really supports the claim is still yours to measure. Groundedness asks whether every claim has support; citation accuracy asks whether each citation is the right support.

Sampling live traffic: rate, strata and privacy

Dimitra cannot judge 60,000 listings a day with a model call each, and she does not need to. Cheap code checks run on everything: title length, required attributes present, every extracted value in a valid format. The expensive scoring, a judge reading the title against the spec sheet, runs on a sample.

The obvious design is a uniform 1%. Over a week that is about 4,200 listings, which sounds plenty. But jewellery is 2% of traffic, so the sample holds about 80 jewellery listings a week, too few to see a five-point drop. And the 50 largest merchants produce 40% of listings, so a uniform sample mostly measures them. Stratified sampling fixes both: divide traffic into strata (category, merchant size tier, locale, prompt version) and draw a fixed quota from each, such as 300 listings per category per week. When you report one overall number, weight each stratum's score by its share of traffic, or the oversampled small strata will distort it.

Listings that a code check flagged, a merchant heavily edited or a marketplace rejected are worth reading too. Draw them as a separate stream with their own label. Mixed into the random sample they make quality look worse than it is; kept apart they show you how the failures look.

Harbor & Finch's live sampling pipeline

CHECKcode checks on 100% of listings
FILTERdrop opted-out merchants, redact personal data
SAMPLEfixed quota per category, tier, prompt version
SCOREjudge rubric on the sample, off the request path
REPORTper stratum, weighted to traffic share
Code checks see every listing, opted-out tenants and personal data are removed before anything is stored, and the judge scores a stratified sample that is weighted back to traffic shares.

Privacy decides what the sample may contain before rate does. About 300 enterprise merchants have contracts that forbid keeping their content for evaluation, so the sampler skips their tenants at selection time, not in a clean-up job later. Handmade sellers put names and workshop addresses in their "about the maker" text, so the pipeline redacts those before the sample is stored, keeps it for 30 days and limits who can read it.

Feedback signals and their biases

Scores from a judge say whether a title meets the rubric. People say whether it was useful, but they say it in skewed ways. Feedback comes in two kinds. Explicit feedback is what people tell you on purpose: a thumbs-down in the studio, a support ticket. Implicit feedback is what they do: publish the draft unchanged, edit it, regenerate it, abandon it, or, downstream, click it, buy it and return it.

Signal What it tells you Its bias
Thumbs up or down Direct opinion on one output Sparse and self-selected: about 1% of merchants rate, mostly the annoyed ones
Support tickets Severe failures in the merchant's words Only the worst cases, days late
Edit distance, draft to published How far the draft was from usable Brand-style edits look like quality failures
Regenerate or abandon Draft rejected outright Some merchants regenerate out of habit, to see options
Buyer click-through Whether the title works in search Moved by price, season and marketplace ranking
Returns "not as described" Listing misstated the product Arrives weeks later

Memorise the two kinds and the general biases; the rows are Harbor & Finch's instances.

The thumbs-down rate is the trap. When it falls, quality may have improved, or the unhappy merchants may have stopped bothering. Implicit signals are plentiful but confounded: Lindqvist Home edits every title to add its brand name, so its edit distance measures its house style, not the prompt. The answer is to read signals per segment, compare them with the judge scores on the same sample, and never let one signal decide alone.

There is a slower danger too. A signal you optimise becomes the target. If Harbor & Finch tuned titles on click-through alone, it would drift towards titles that win clicks and lose on returns, which is why outcome signals always travel in pairs.

A/B testing a prompt or model change

Now Dimitra can test titles-v2 properly. An A/B test sends live traffic to the current version (control) and the change (treatment) at random, measures both over the same period, and compares. Randomness is what makes it fair: season, promotions and marketplace changes hit both arms equally, so the difference between them is the change's effect.

The first decision is the randomisation unit, the thing you assign to an arm. Per request is tempting and wrong here: one merchant would see short and long titles in the same catalog, and merchants change their habits after seeing either style, so each arm contaminates the other. Assign by merchant, the unit whose behaviour you measure. In the code below, look at the hash of the merchant id, which keeps each merchant in one arm for the whole test, and at the logging line, without which no metric can be split by arm.

import hashlib

EXPERIMENT = "titles-v2-2026-11"   # a new salt per experiment reshuffles merchants
PROMPT_BY_ARM = {"control": "titles-v1", "treatment": "titles-v2"}

def assign_arm(merchant_id: str) -> str:
    # HASH the merchant, not the request: one merchant always sees one prompt
    digest = hashlib.sha256(f"{EXPERIMENT}:{merchant_id}".encode()).hexdigest()
    return "treatment" if int(digest[:8], 16) % 100 < 50 else "control"

def generate_title(client, merchant_id: str, spec_sheet: str):
    arm = assign_arm(merchant_id)
    version = PROMPT_BY_ARM[arm]
    response = client.messages.create(
        model=TITLE_MODEL, max_tokens=200, system=PROMPTS[version],
        messages=[{"role": "user", "content": spec_sheet}])
    # RECORD arm and prompt version with every output
    log_generation(merchant_id, arm, version, response.usage)
    return response

The unit also sets the sample size. Listings from one merchant rise and fall together, so 200,000 listings per arm do not buy 200,000 independent observations. Count merchants. A standard rule of thumb for a two-sided test at 5% significance with 80% power: each arm needs about 16 times the metric's variance, divided by the square of the smallest effect you care about. The primary metric is the share of titles published unchanged: 69% on average, with a standard deviation of 15 points between merchants. To detect a 2-point lift: 16 × 15² ÷ 2² = 900 merchants per arm, comfortably inside 4,000. Fix that size and the duration before you start, and do not stop early the first day the difference looks significant.

Guardrail metrics must not get worse while the primary metric improves: marketplace rejection rate, judge accuracy score, cost and latency per listing. And watch for the novelty effect, a reaction to the change itself that fades: in week one the unchanged-publish rate in treatment jumped to 78%, then settled at 72% by week three. Run at least two full weekly cycles and compare the effect week by week.

The titles-v2 experiment after three weeks

Control: titles-v1

4,000 merchants, hashed
69% published unchanged
1.2% rejected by marketplaces

Treatment: titles-v2

4,000 merchants, hashed
72% published unchanged
2.0% rejected, apparel and footwear

Hold: keep sizes in titles, then test again

The primary metric improved beyond the planned threshold, but a guardrail failed, so the change does not ship as it stands.

The rejections came from apparel and footwear, where marketplaces require size in the title and the shorter prompt dropped it. The stratified sample showed it within days.

Closing the loop into the offline suite

The experiment found something the offline suite missed: titles-v2 passed offline because no case in the suite was an apparel listing where the marketplace requires size. If the finding stays in an experiment report, the next prompt change can make the same mistake and pass the same suite.

Closing the loop means every confirmed live failure becomes a regression case. Dimitra's team takes 40 rejected treatment listings, removes merchant names and personal data, labels the expected title, and adds them to the offline suite. A code check (size present when the category requires it) runs on all of them, so the next version fails offline before any merchant sees it.

From a live failure to a regression case

DETECTsampled scores, guardrails, feedback
TRIAGEconfirm the cause, group by stratum
REDACTstrip personal and opted-out content
ADDlabelled case plus code check in the suite
ADD → DETECT · every release, every confirmed failure
Live measurement finds the failures the offline suite missed, and each confirmed failure is redacted, labelled and added so the next release is gated on it.

The loop also checks the offline suite itself. If offline results say a change is better and live results say it is worse, the suite is missing part of live traffic, and the strata where the two disagree show where to add cases.

The exam traps

Each trap measures the right thing the wrong way.

  • ✗ Randomising an A/B test per request when users react to what they see. ✓ Randomise by user, merchant or account with a stable hash, and size the test in that unit. Per-request assignment lets the arms contaminate each other and overstates the sample.
  • ✗ Shipping the day the primary metric looks significant. ✓ Run the planned duration across full weekly cycles and compare the effect week by week. Early peeks inflate false positives, and novelty fades.
  • ✗ Judging a change by its primary metric alone. ✓ Set guardrail metrics (rejections, accuracy, cost, latency) before the test, and hold the change if any degrades.
  • ✗ Sampling 1% uniformly and reporting one average. ✓ Stratify with fixed quotas, report per stratum and weight to traffic share. Small segments vanish from uniform samples.
  • ✗ Reading a falling thumbs-down rate as better quality. ✓ Explicit feedback is sparse and self-selected; cross-check implicit signals and sampled scores per segment.
  • ✗ One blended quality score for every task. ✓ Field-level accuracy for extraction, rubric and edit distance for generation, verified completion with steps and cost for agents, groundedness and citation accuracy for grounded output.

Put it together: run a small online comparison

You now have every piece. Metrics fit the task, the sample represents traffic within your privacy rules, feedback is read with its biases, the experiment measures the right unit, and the loop teaches the offline suite. The quickest way to own them is to run a miniature version.

Online measurement connects to the rest of the guide. Progressive rollout (2.3) uses these comparisons to decide whether a canary proceeds or rolls back. Monitoring and alerting (3.2) turn the sampled scores into SLIs with alerts. Incident response (4.2) feeds its findings into the same regression suite.

Key takeaways

  • ✓ Offline evaluation shows a change is safe to try; only live traffic shows whether users and outcomes are better.
  • ✓ Match the metric to the task: field accuracy for extraction, rubric score and edit distance for generation, verified completion with steps and cost for agents, groundedness and citation accuracy for grounded output.
  • ✓ Run code checks on all traffic and score a stratified sample with fixed quotas, applying opt-outs and redaction before anything is stored.
  • ✓ Treat explicit feedback as sparse and self-selected and implicit feedback as confounded, and cross-check both against sampled scores per segment.
  • ✓ Randomise A/B tests by the unit whose behaviour you measure, size them in that unit, fix the duration, and ship only when guardrails hold beyond the novelty period.
  • ✓ Turn every confirmed live failure into a redacted, labelled regression case in the offline suite.

Practise this

Practice questions for CCDV-P are being written and are not in this course yet. Read this lesson on the web to answer its check questions, with every option explained: https://claude.termidy.com/learn/ccdv-p/evaluation-engineering/online-quality-measurement/.

Sources