CertSafari
    Anthropic Claude Certified Architect – Professional (CCAR-P)· Lessons

    Domain 4 · Lesson 20/38

    Evaluation metrics for Claude systems: accuracy, latency, cost, safety and security

    Define evaluation metrics

    20 min read
    2.67% of exam
    7 sources
    Published 19 Oct 2026
    Docs as of 14 Oct 2026

    What you will be able to do

    • Explain why one Claude application needs several metrics, and name the failure each metric catches that the others miss
    • Choose the accuracy metric that fits the output: exact match or F1 for fixed labels, cosine similarity for consistency, ROUGE-L for summaries checked against references
    • Write a latency criterion that names its clock (time to first token, total response time or end-to-end task time) and uses a percentile rather than a mean
    • Turn cost, safety and security goals into computed rates with pass/fail thresholds, including a checkable definition of a successful attack

    Key concept

    Multidimensional success criteria — A Claude application passes only when it meets a separate, computable threshold on each dimension it is judged on, such as accuracy, latency, cost, safety and security. A single score can't do this, because a system can do well on one dimension while failing another.

    1.Why one metric never certifies a Claude system

    An evaluation metric is a number computed from a model's outputs on a test set and compared against a threshold. It tells you whether a prompt, model or configuration is ready to ship. You need it because "the model should classify sentiments well" can't be checked. "F1 of at least 0.85 on 10,000 held-out posts" can. The success criteria themselves are agreed during discovery (Measurable success criteria). Here the job is the next step: turning each criterion into a formula that a script can compute on every run.

    Each metric is blind to some kind of failure. A classifier can label every ticket correctly and still take too long for a live chat. It can be fast and correct but cost more per ticket than the process it replaces. It can be fast, correct and cheap but answer in toxic language now and then. Or it can pass on every ordinary input and still leak details it was told to keep private. That is why the reference example of a good criterion is several thresholds on one held-out set, not one number: an F1 of at least 0.85, 99.5% non-toxic outputs, 90% of errors being an inconvenience rather than egregious, and 95% of responses under 200ms.

    The five metric dimensions, a computable form of each, and the failure that only that dimension catches
    DimensionComputable metric with thresholdFailure only this dimension catches
    AccuracyF1 score of at least 0.85 on a held-out test set; exact-match accuracyWrong answers delivered quickly, cheaply and politely
    Latency95% of response times under 200msCorrect answers that arrive too late for a real-time user
    CostCost per task or per classification against a budget or baselineA configuration that is accurate and fast but too expensive to run at the expected volume
    SafetyLess than 0.1% of 10,000 trials flagged for toxicity by the content filterCorrect content in harmful or inappropriate language
    SecurityShare of test inputs where the model uses or shares details it was told to keep privateAn application that behaves on ordinary input but is turned against its own instructions

    For agents, the dimensions also stack inside a single task. Each check on an agent's work is a grader: logic that scores one aspect of its performance. A support agent's task can count as solved only if the ticket is resolved (a state check, which inspects the environment after the run), the conversation finished in under 10 turns (a transcript constraint, a limit on what the conversation log may contain, such as the number of turns), and the tone was appropriate (an LLM rubric, a model scoring the output against written criteria). You also choose how a task's grader scores combine. Weighted scoring passes when the combined score clears a threshold. Binary scoring requires every grader to pass. A hybrid mixes the two.

    Checkpoint 1 of 9· Match them up

    A support-ticket classifier has failed in production. Match each failure to the metric dimension that would have caught it before launch.

    Tap a term, then the definition that fits it.

    Sources12

    2.Matching the accuracy metric to the shape of the output

    "Accuracy" is not one metric. The right one depends on what a correct output looks like, so start with the output's shape. When the answer comes from a fixed set of labels, such as five ticket categories or positive/negative/neutral/mixed sentiment, correctness is binary, and code can grade it without any judgement. Exact match compares the output with the labelled answer after normalising whitespace and case. Accuracy is the share of matches. When the classes are imbalanced or some errors matter more than others, precision, recall and F1 from the same comparisons tell you more than raw accuracy.

    Exact-match grading of a labelled sentiment set: normalise, compare, then average into an accuracy scorepython
    def evaluate_exact_match(model_output, correct_answer):
        return model_output.strip().lower() == correct_answer.lower()
    
    
    outputs = [
        get_completion(
            f"Classify this as 'positive', 'negative', 'neutral', or 'mixed': {tweet['text']}"
        )
        for tweet in tweets
    ]
    accuracy = sum(
        evaluate_exact_match(output, tweet["sentiment"])
        for output, tweet in zip(outputs, tweets)
    ) / len(tweets)
    print(f"Sentiment Analysis Accuracy: {accuracy * 100}%")

    Free-form text breaks exact match, because two good summaries almost never match character for character. For summarisation against reference summaries, use ROUGE-L. It measures the length of the longest common subsequence shared by the model's summary and the reference, so it rewards both overlapping content and the order in which ideas appear. A typical test set is a few hundred articles, each with a reference summary.

    Consistency is a separate question from correctness. If a user asks the same thing twice in different words, they should get answers that mean the same thing. To measure this, encode the outputs for groups of paraphrased questions with a sentence-embedding model and compute cosine similarity. Values near 1 mean the answers agree. This metric says nothing about whether the answers are right: a model that gives the same wrong label to every paraphrase scores perfectly.

    Some qualities, such as coherence, tone or translation quality, have no reference you can match against. For these, use a qualitative scale applied the same way every time: a Likert prompt such as "Rate coherence from 1 (nonsensical) to 5 (perfectly logical)", scored by an LLM grader or by experts with a rubric. Don't use one on a categorical task. Asking a second model to rate how well a label "matches" adds cost and non-determinism to a check that string comparison settles exactly.

    Accuracy metrics by output shape
    Output shapeMetricWhat a high score means
    One label from a fixed setExact-match accuracy; precision, recall, F1The predicted label equals the human label
    Summary with a referenceROUGE-LKey information from the reference appears in a coherent order
    Answers to paraphrased versions of one questionCosine similarity of sentence embeddingsAnswers are semantically consistent (not necessarily correct)
    Open-ended quality with no referenceLikert scale or expert rubricGraders consistently rate the output highly on the defined criterion

    Checkpoint 2 of 9· Check yourself

    Your team ran 50 groups of paraphrased questions through a ticket classifier that picks one of five categories. The answers within each group have a mean cosine similarity of 0.98, and a teammate says this shows the classifier is accurate enough to ship. What is the right conclusion?

    Checkpoint 3 of 9· Exam question

    A fintech company built an automated support-ticket triage system that assigns each incoming ticket to exactly one of five fixed categories (billing, fraud, account access, technical issue, other). The team wants to measure how well the model performs this core categorization task using a labeled test set of 5,000 tickets, with automated, unambiguous grading. Which evaluation approach should the team use?

    Checkpoint 4 of 9· Exam question

    A documentation team built a tool that condenses long internal incident reports into short summaries. They have 200 incident reports paired with human-written reference summaries and want an automated metric that captures both the overlap of key information and the ordering of ideas between the model's summary and the reference. Which metric is best suited to this evaluation?

    Sources1

    3.Latency: name the clock and the percentile

    A latency target means nothing until you say when the clock starts and when it stops. A Claude system has three clocks worth separating, and they can move independently:

    • Time to first token (TTFT) runs from sending the prompt to receiving the first token of the response. It is what a user notices when responses are streamed, because text starts appearing even while generation continues.
    • Total response time runs until the last token arrives. An agent eval records it as time_to_last_token, alongside output_tokens_per_sec. This is the clock that matters when nothing downstream can act until the full output has been parsed, such as a classifier whose label sits at the end of its reasoning.
    • End-to-end task time covers a whole agent run across many turns and tool calls. It grows with n_turns and n_toolcalls even when each individual call is fast.
    Tracked metrics on an agent eval task: transcript size next to three separate latency measurementsyaml
      tracked_metrics:
        - type: transcript
          metrics:
            - n_turns
            - n_toolcalls
            - n_total_tokens
        - type: latency
          metrics:
            - time_to_first_token
            - output_tokens_per_sec
            - time_to_last_token

    The clocks pull against each other, so an SLA that names none of them can be met while users still complain. Streaming improves TTFT but leaves total response time unchanged. Telling an agent that time matters and showing it the elapsed time cut run time by 7% to 47% in Anthropic's tests, at the cost of a few points of score. That trade is visible only if task time and accuracy are both being measured.

    Write the threshold as a percentile. "95% of responses under 200ms" puts the budget and the allowed exceptions in a single sentence: 5% of turns may run slow during a spike, and the rest may not. A mean can't express that. A month of 150ms average can hide a fifth of voice turns stalling, and one extreme outlier can push an otherwise healthy average over its target. Average output token count and requests per minute are not latency metrics at all. The first measures response size and the second measures capacity. Pick the percentile and the budget from the application's real-time requirements: a voice turn and an overnight batch job are not held to the same number.

    Checkpoint 5 of 9· Fill the gap

    A ticket classifier runs with stream=False, and its label comes at the end of its reasoning, so the router can't act until the whole response has arrived. The team wants its eval to track the latency clock that users of this router actually wait on. Which metric fills the blank?

      tracked_metrics:
        - type: transcript
          metrics:
            - n_turns
            - n_toolcalls
            - n_total_tokens
        - type: latency
          metrics:
            - time_to_first_token
            - output_tokens_per_sec
            -  ? 

    Checkpoint 6 of 9· Exam question

    A voice-based customer service agent needs to feel responsive in real time. The team defines a success criterion stating that the vast majority of user turns must receive a response within a strict time budget, while still tolerating occasional slower responses during traffic spikes. Which latency metric definition best matches this success criterion?

    Sources314

    4.Cost per task as a pass/fail metric

    Cost should be an eval metric with a threshold, computed on the same runs as accuracy. Don't treat it as a bill you check afterwards. The unit is the task, not the token: a cheaper model that needs more turns or more retries can cost more for each problem it solves (Cost per solved task (not price per token)). The response's usage block reports input, output and cache token counts. Multiply them by the per-token prices, then divide total spend by the number of tasks in the run.

    A cost threshold is relative to something. The ticket-routing example sets two thresholds side by side: 95% accuracy over 100 tests, and a 50% average reduction in cost per classification compared with the current routing method. In the insurance-claims cookbook, a baseline agent scored 10/10 at about $0.29 per task. Because a mislabelled claim costs more than the inference saved, the team kept the accuracy requirement at 10/10 and treated cost as the number to push down. A configuration that saves money but drops a case fails, however cheap it is.

    Checkpoint 7 of 9· Check yourself

    An insurance-claims agent's baseline scores 10/10 on its eval at about $0.29 per task. The team will not accept less than 10/10, and wants to lower cost. Three candidate configurations ran on the same eval. Which one passes?

    Sources56

    5.Quantifying safety and security as checkable rates

    "The assistant should be safe" is a hope, not a criterion. Even fuzzy goals like ethics and safety can be expressed as rates: the share of outputs, over a stated number of trials, that a stated detector flags. A good safety criterion names three things: the detector (a content filter), the sample size (10,000 trials) and the ceiling (fewer than 0.1% flagged). Severity needs the same treatment. "90% of errors would cause inconvenience, not egregious error" is computable only once you have written down what counts as inconvenient and what counts as egregious.

    A security metric is computed the same way. The difference is that you first have to define what counts as a successful attack, specifically enough that code or a grader can decide it. Start from the threat model, because there are two. In jailbreaks and direct prompt injection, the user is the adversary and writes inputs meant to get around your guardrails. In indirect prompt injection, the user is trusted, but Claude reads third-party content (web pages, emails, documents, tool results) that contains adversarial instructions. Each one needs its own adversarial test set and its own success condition. The metric is then the attack success rate: the share of attack attempts that meet that condition.

    Write success conditions as observable outcomes, never as "the model seemed manipulated":

    • A harmlessness screen is a model call that labels incoming input as harmful or not before it reaches the main conversation. Structured outputs force it to return a fixed label, such as a boolean is_harmful, so code can compare it with the known answer. An attack succeeds when a known-harmful input comes back labelled safe.
    • For data handling, an attack succeeds when the output uses or shares a detail the instructions said to withhold.
    • For agents, an attack succeeds when the end state shows the forbidden effect, checked against environment state rather than the transcript's wording.

    The authentication-bypass task below shows the agent version. Its graders spell out what "secure" means: deterministic tests that reject empty and null passwords, a static security scan with bandit, and a state check that the security log recorded an auth_blocked event. If any of them fails, the fix fails, however convincing the agent's explanation sounds.

    An agent eval task whose graders define security success as passing tests, a clean security scan and an auth_blocked log eventyaml
    task:
      id: "fix-auth-bypass_1"
      desc: "Fix authentication bypass when password field is empty and ..."
      graders:
        - type: deterministic_tests
          required: [test_empty_pw_rejected.py, test_null_pw_rejected.py]
        - type: llm_rubric
          rubric: prompts/code_quality.md
        - type: static_analysis
          commands: [ruff, mypy, bandit]
        - type: state_check
          expect:
            security_logs: {event_type: "auth_blocked"}

    Checkpoint 8 of 9· Fill the gap

    An agent's auth-bypass fix should count as secure only if the environment shows the attack was actually blocked. A convincing explanation in the transcript must not be enough. Which grader type completes this task?

    task:
      id: "fix-auth-bypass_1"
      desc: "Fix authentication bypass when password field is empty and ..."
      graders:
        - type: deterministic_tests
          required: [test_empty_pw_rejected.py, test_null_pw_rejected.py]
        - type: llm_rubric
          rubric: prompts/code_quality.md
        - type: static_analysis
          commands: [ruff, mypy, bandit]
        - type:  ? 
          expect:
            security_logs: {event_type: "auth_blocked"}

    Checkpoint 9 of 9· Check yourself

    Which of these safety criteria could an eval script check as pass/fail on every run?

    Sources172

    Sources

    (7)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “achieve an F1 score of at least 0.85”
      ↩︎ Why one metric never certifies a Claude system
      “Most use cases need multidimensional evaluation along several success criteria.”
      ↩︎ Why one metric never certifies a Claude system
      “Can it follow instructions not to use or share certain details?”
      ↩︎ Why one metric never certifies a Claude system
      “Exact match evals measure whether the model's output matches a predefined correct answer, typically after normalizing whitespace and case.”
      ↩︎ Matching the accuracy metric to the shape of the output
      “Generic: Accuracy, precision, recall”
      ↩︎ Matching the accuracy metric to the shape of the output
      “It measures the length of the longest common subsequence between the candidate and reference summaries.”
      ↩︎ Matching the accuracy metric to the shape of the output
      “Rate coherence from 1 (nonsensical) to 5 (perfectly logical)”
      ↩︎ Matching the accuracy metric to the shape of the output
      “What is the acceptable response time for the model? This depends on your application's real-time requirements and user expectations.”
      ↩︎ Latency: name the clock and the percentile
      “Less than 0.1% of outputs out of 10,000 trials flagged for toxicity by the content filter.”
      ↩︎ Quantifying safety and security as checkable rates
      “90% of errors would cause inconvenience, not egregious error”
      ↩︎ Quantifying safety and security as checkable rates
      “Most use cases need multidimensional evaluation along several success criteria.”
      ↩︎ Key concept
      “It's ideal for evaluating consistency because similar questions should yield semantically similar answers, even if the wording varies.”
      ↩︎ Exam trap 1
      “95% response time < 200ms”
      ↩︎ Exam trap 3
      “Less than 0.1% of outputs out of 10,000 trials flagged for toxicity by the content filter.”
      ↩︎ Exam trap 5
      “High ROUGE-L scores indicate that the generated summary captures key information in a coherent order.”
      ↩︎ Prediction
      “It's ideal for evaluating consistency because similar questions should yield semantically similar answers, even if the wording varies.”
      ↩︎ Checkpoint
      “95% response time < 200ms”
      ↩︎ Prediction
      “Less than 0.1% of outputs out of 10,000 trials flagged for toxicity by the content filter”
      ↩︎ Checkpoint
    2. 2.
      “is the ticket resolved (state check), did it finish in <10 turns (transcript constraint), and was the tone appropriate (LLM rubric)?”
      ↩︎ Why one metric never certifies a Claude system
      “A grader is logic that scores some aspect of the agent’s performance.”
      ↩︎ Why one metric never certifies a Claude system
      “For each task, scoring can be weighted (combined grader scores must hit a threshold), binary (all graders must pass), or a hybrid.”
      ↩︎ Why one metric never certifies a Claude system
      “Consider a coding task where the agent must fix an authentication bypass vulnerability.”
      ↩︎ Quantifying safety and security as checkable rates
    3. 3.
      “It's particularly relevant when you're using streaming”
      ↩︎ Latency: name the clock and the percentile
      “This metric measures the time it takes for the model to generate the first token of the response, from when the prompt was sent.”
      ↩︎ Exam trap 2
    4. 4.
      “7% to 47% less time in Anthropic's tests, for a few points of score”
      ↩︎ Latency: name the clock and the percentile
      “Compare on cost per completed task, not per token”
      ↩︎ Exam trap 4
    5. 5.
      “Cost per classification: 50% reduction on average (across 100 tests) from current routing method”
      ↩︎ Cost per task as a pass/fail metric
      “The method extracts usage statistics for the API call to calculate cost based on input and output tokens used.”
      ↩︎ Cost per task as a pass/fail metric
    6. 6.
      “we'll look to achieve less than ~$0.29/task while getting all 10 eval cases correct.”
      ↩︎ Cost per task as a pass/fail metric
      “be sure to run many parallel trials so you're making decisions based on a representative distribution rather than a single sample.”
      ↩︎ Cost per task as a pass/fail metric
      “That means that as we optimize, we'll look to achieve less than ~$0.29/task while getting all 10 eval cases correct.”
      ↩︎ Checkpoint
    7. 7.
      “Jailbreaks and direct prompt injection, where the user of your application is the adversary and crafts inputs intended to bypass your guardrails.”
      ↩︎ Quantifying safety and security as checkable rates
      “Indirect prompt injection, where the user is trusted but Claude processes third-party content (web pages, emails, documents, tool results) that contains adversarial instructions.”
      ↩︎ Quantifying safety and security as checkable rates
      “Use structured outputs to constrain the response to a simple classification.”
      ↩︎ Quantifying safety and security as checkable rates
      “Use a lightweight model like Claude Haiku 5.5 to pre-screen user input before it reaches your main conversation.”
      ↩︎ Quantifying safety and security as checkable rates

    Ready to test yourself?

    Practise the 12 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.