Rubric
Contents — domains, guide and mocks

Defining evaluation metrics

CCAR-P 4.115 min read · checked 21 September 2026

Task statementDefine evaluation metrics (accuracy, latency, cost, safety, security)

Five dimensions, one release decision

Release scorecardtargets agreed before building
  • Accuracyright answer, right outcome
  • Latencytime to first token, p95
  • Costper successful task
  • Safetyharmful or leaking output
  • Securityresistance to attack
No single dimension decides a release. Notice that security sits beside safety: safety is what the system says to ordinary users, security is what an adversary can make it do.

What makes a metric usable

Anthropic's guidance on success criteria asks for four properties. Specific: name the task, not a mood — “accurate sentiment classification”, not “good performance”. Measurable: a number, or a qualitative scale applied consistently alongside numbers. Achievable: grounded in benchmarks, prior experiments or expert knowledge, and not beyond what current frontier models can do. Relevant: tied to what users need — citation accuracy matters enormously in a medical tool and much less in a casual chatbot.

The docs also make a point architects often miss: even “hazy” qualities such as safety can be quantified. “Safe outputs” is not a criterion. “Fewer than 0.1% of outputs across 10,000 trials flagged for toxicity by the content filter” is.

From a wish to a criterion

Vague

The model should classify
sentiment well.

It should be fast,
safe, and affordable.

Measurable

On a held-out set of 10,000
diverse posts:
- F1 at least 0.85
- 99.5% of outputs non-toxic
- 90% of errors cause
  inconvenience, not harm
- 95% of responses < 200 ms
- cost per 1,000 posts
  under an agreed budget
The right-hand version names the dataset, its size, a threshold for each dimension and the percentile for latency. Every line can be failed.

The first four lines of the measurable version follow Anthropic's own sentiment-analysis example; the cost line is the one most teams forget to add. Note the footnote the docs attach to it: you would still need to define what “inconvenience” and “egregious” mean. A threshold on an undefined category is not yet a metric.

The five dimensions, made concrete

DimensionTypical metricHow it is usually graded
AccuracyExact-match accuracy, F1, rubric score, task success rate (pass@k / pass^k for agents)Code for clear-cut answers; model-based rubric for open text; human spot checks
LatencyTime to first token (TTFT) and total response time at p50 and p95Measured by your application, per request
CostCost per request and per successful task, from token usage and tool feesComputed from the usage block and the price list
SafetyRate of harmful, toxic or policy-breaking output; PHI or PII leakage; wrongful refusalsClassifier or model-based binary check; human review of flagged items
SecurityShare of red-team injections or jailbreaks that succeed; unauthorised tool callsAdversarial test set plus checks on actions taken, not just text

The docs' own list of common criteria is broader — task fidelity, consistency, relevance and coherence, tone and style, privacy preservation, context utilisation, latency and price. Most of those roll up into the five headings this task statement names; consistency and tone are usually part of accuracy, privacy sits under safety. Anthropic's summary is blunt: most use cases need multidimensional evaluation.

Accuracy: outcome, not appearance

For a classifier, accuracy is simple: compare the label to the answer key. For an agent it is harder, and Anthropic's engineering team is precise about the vocabulary. A task is one test with inputs and success criteria; a trial is one attempt at it; the transcript is everything that happened; the outcome is the final state of the world. A travel agent that says “your flight is booked” has produced a transcript. Whether a reservation exists in the database is the outcome — and that is what accuracy should check.

Because model output varies, agents are run several times per task, and two metrics answer different questions. pass@k is the chance that at least one of k trials succeeds; it rises with k and suits tools where a person picks the best of several drafts. pass^k is the chance that all k succeed; it falls with k and suits customer-facing agents that must work every time. A 75% per-trial success rate gives pass^3 of about 42%.

Same agent, two very different headlinespython
p = 0.75          # per-trial success rate on a task
k = 3

pass_at_k  = 1 - (1 - p) ** k   # at least one of k succeeds
pass_hat_k = p ** k             # all k succeed

print(f"pass@3 = {pass_at_k:.0%}")   # 98% — "it nearly always works"
print(f"pass^3 = {pass_hat_k:.0%}")  # 42% — "three customers in a row?"

Pick the one that matches how the system is used, and say which one you picked. Reporting pass@k for a refund agent that must get every customer right is the metric equivalent of rounding up.

Latency and cost: tails and denominators

Anthropic's latency guide distinguishes baseline latency (overall time to process the prompt and generate the answer) from time to first token (TTFT), which is what a user watching a streamed reply actually feels. Define both, and define them at a percentile. An average of 1.2 seconds can hide one request in twenty taking nine seconds — and the user who got the nine-second answer does not care about the average. The docs' own example uses “95% of responses under 200 ms”, which is a p95 target.

Cost needs the right denominator. Price per million tokens is an input, not a metric: models differ in price, in how many tokens they spend on the same answer, and even in tokenizer — the pricing page notes that Claude 4.7 and later models use a tokenizer producing roughly 30% more tokens for the same text. What the business pays for is finished work, so measure cost per successful task: total spend divided by tasks that passed your accuracy check. A cheaper model that fails more often, or needs a retry, can cost more per success.

Cost per request from the usage block, then per successpython
# Claude Sonnet 5, USD per million tokens (pricing page, Sep 2026)
PRICE = {"input": 2.00, "cache_write_5m": 2.50, "cache_read": 0.20, "output": 10.00}

def request_cost(u) -> float:
    return (u.input_tokens * PRICE["input"]
          + u.cache_creation_input_tokens * PRICE["cache_write_5m"]
          + u.cache_read_input_tokens * PRICE["cache_read"]
          + u.output_tokens * PRICE["output"]) / 1_000_000

def cost_per_success(runs) -> float:
    spend = sum(request_cost(r.usage) for r in runs)   # failed runs still cost money
    wins = sum(1 for r in runs if r.passed)
    return spend / wins if wins else float("inf")

Safety and security: measure both directions

Safety metrics count bad outputs reaching ordinary users: toxic content, unsafe advice, personal or health information that should not appear. The docs' medical example is a binary model-graded check — does this response contain PHI, yes or no — run over a test set that includes explicit, hypothetical and implicit PHI. Measure the opposite error too: a system that refuses legitimate requests is failing its users, and a safety metric that only counts harm will reward a system that refuses everything.

Security metrics assume an adversary. Anthropic separates two threat models: jailbreaks and direct injection, where the user is the attacker, and indirect injection, where instructions hide in a web page, email or tool result the model reads. Each needs its own adversarial test set, and the metric is the attack success rate — ideally judged by what the system did (did it call a tool the user never asked for?) rather than only by what it wrote. The docs recommend red-teaming your own agent with documents and tool outputs that deliberately contain injection attempts before deploying.

Which grader measures this metric?

Is there one checkable right answer?
  • Yes — label, value, state
    Code-based graderexact match, state check
  • No — tone, relevance
    Model-based graderrubric, reasoning first
  • High stakes or disputed
    Human expert reviewalso calibrates the judge
  • Timing or spend
    Instrumented metricmeasured, not graded
Prefer the cheapest grader that is reliable for the metric. Model-based graders earn their cost on subjective qualities, and need calibration against humans.

Building the datasets and harness that produce these numbers is covered in 4.2; comparing two versions against them in 4.3. Production monitoring of the same metrics is 4.6.

Traps the wrong answers are built from

Tempting but wrongDo this instead
A single headline metric, usually accuracyDefine accuracy, latency, cost, safety and security targets together; most use cases need multidimensional evaluation.
Average latency as the targetSet TTFT and total latency at a percentile such as p95, measured in the application.
Comparing models on price per million tokensCompare cost per successful task — token counts, tokenizers and failure rates all differ.
“The system must be safe and secure” as the criterionMeasure a violation rate on a named test set and an attack success rate on a red-team set.
Judging an agent by what it says it didGrade the outcome — the state of the world after the trial — not the transcript's claims.

You should now be able to

  • Rewrite a vague goal into specific, measurable, achievable and relevant criteria with thresholds.
  • Choose an appropriate metric and grader for each of accuracy, latency, cost, safety and security.
  • Explain when to report pass@k versus pass^k for an agent.
  • Compute cost per successful task from the API's usage fields and the price list.
  • Distinguish safety metrics (harmful output to ordinary users) from security metrics (success of deliberate attacks).

Practice questions

Original questions written for this lesson, in the exam’s style. Answer first, then open the reasoning — every option is explained, including why the wrong ones are tempting.

  1. Question 1

    An insurer's claims assistant is ready for a go/no-go review. The team reports “93% accuracy on our test set” and nothing else.

    What should the architect ask for before recommending a release?

    1. AA larger test set, so that the accuracy figure is more precise.
    2. BTargets and results for latency, cost per claim, safety and security alongside accuracy.
    3. CA switch to the most capable model to push accuracy above 95%.
    4. DA comparison of the 93% figure with published benchmark scores.
    Show answer and reasoning
    1. AIncorrect. Tempting, but precision on one dimension doesn't cover latency, cost, safety or security, which are unmeasured.
    2. BCorrect. Release decisions need multidimensional criteria; a single accuracy figure says nothing about the other risks.
    3. CIncorrect. This optimises the one metric already measured and may worsen cost and latency, which nobody has measured.
    4. DIncorrect. Public benchmarks don't reflect this task's distribution; they can inform achievability, not replace task-specific criteria.
  2. Question 2

    A retailer's order-change agent succeeds on 80% of trials for a given task. Customers use it once per order and there is no human to pick among attempts.

    Which metric best reflects the customer experience across repeated use?

    1. Apass@k, because it shows the agent can solve the task.
    2. BMean tokens per trial, because it tracks efficiency.
    3. CROUGE-L against a reference transcript.
    4. Dpass^k, because it measures consistent success every time.
    Show answer and reasoning
    1. AIncorrect. pass@k counts success if any attempt works — right for best-of-several tools, too generous for a single-shot customer agent.
    2. BIncorrect. Efficiency is a cost signal, not a measure of whether customers get a correct result.
    3. CIncorrect. Overlap with a reference transcript grades the path, not whether the order was actually changed.
    4. DCorrect. pass^k is the probability all k trials succeed, which is what a customer-facing agent must deliver.
  3. Question 3

    A legal-research assistant's criteria are being drafted. The team wants metrics that would catch real problems before launch.

    Which two criteria are well-formed? (Select 2.)

    1. Ap95 time to first token under 1.5 seconds in the production UI.
    2. BThe assistant should be secure against prompt injection.
    3. CAverage latency should feel fast to lawyers.
    4. DFewer than 1 in 200 red-team documents cause an unrequested tool call.
    5. EAccuracy as high as possible within the budget.
    Show answer and reasoning
    1. ACorrect. Specific, measurable and tied to user experience; the percentile captures slow tails.
    2. BIncorrect. An aspiration, not a metric: no test set, no rate and no threshold.
    3. CIncorrect. An average hides tail latency and “feel fast” can't be measured consistently.
    4. DCorrect. An attack success rate on a named adversarial set, judged by the action taken — a measurable security metric.
    5. EIncorrect. No threshold, so it cannot be failed — and “as high as possible” is not an achievable target.
  4. Question 4

    Two models are candidates for a summarisation service. Model A costs less per million tokens than Model B. What is the soundest way to compare cost?

    1. APick Model A, because its per-token price is lower.
    2. BRun both on the eval set and compare spend per passing summary.
    3. CCompare the models’ maximum output token limits.
    4. DEstimate cost from the average word count of summaries.
    Show answer and reasoning
    1. AIncorrect. Per-token price ignores token counts, tokenizer differences and failure rates, which change what a finished task costs.
    2. BCorrect. Cost per successful task reflects tokens actually used and the retries or failures each model causes.
    3. CIncorrect. Limits cap length; they don't tell you what typical requests cost or how often they succeed.
    4. DIncorrect. Words aren't tokens and tokenizers differ by model; the usage block gives the real counts.

Sources

Drafted with AI assistance and checked against the sources above; expert review is in progress. Spotted an error? Tell us and it gets fixed, dated and listed on how this is written.