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

    Domain 4 · Lesson 20/38

    Latency, Cost, Safety and Security Metrics

    Define evaluation metrics

    10 min read
    2.67% of exam
    7 sources
    Published 4 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Distinguish baseline latency from time to first token and set a percentile response-time target
    • Measure cost per call from API usage data and compare options on cost per completed task
    • Write quantified safety criteria and define security checks for jailbreaks, prompt injection and sensitive data

    1.Latency: which clock are you measuring?

    Latency is the time the model takes to process a prompt and produce an output. It depends on model size, prompt complexity and the infrastructure in between. Saying 'it should be fast' isn't enough, because the latency guide distinguishes two different measurements. Baseline latency is the time to process the prompt and generate the response, without considering input and output tokens per second, so it gives a general sense of the model's speed. Time to first token (TTFT) is the time from sending the prompt until the first token of the response appears. TTFT matters most when you stream responses and want users to see output quickly.

    Checkpoint 1 of 7· Check yourself

    A chat product streams Claude's replies to users, and the team wants a metric for how responsive the interface feels. Which latency measure fits best?

    The acceptable value depends on your application's real-time requirements and on what users expect, so write the target as a distribution rather than an average. The guide's multidimensional example requires 95% of responses in under 200ms. For agent evaluations, Anthropic's agent post tracks latency next to transcript metrics such as turns, tool calls and total tokens, so a single evaluation run records them all.

    Metrics tracked alongside graders in an illustrative coding-agent eval taskyaml
      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

    Sources12

    2.Cost: per call, per task, against a threshold

    The testing guidance asks what your budget is for running the model, and points to three factors: the cost of each API call, the size of the model, and how often it's used. To turn that into a metric, record token usage on every call. The ticket-routing evaluation does this by reading the usage statistics the API returns with each response, then calculating cost from the input and output tokens.

    Checkpoint 2 of 7· Fill the gap

    Which attribute of the response gives you the input and output token counts needed to calculate cost per classification?

        message = client.messages.create(
            model=DEFAULT_MODEL,
            max_tokens=500,
            messages=[{"role": "user", "content": classification_prompt}],
        )
        usage = message. ?   # Get the usage statistics for the API call for how many input and output tokens were used.

    Like accuracy, cost needs a threshold. The routing guide's target is relative: a 50% average reduction in cost per classification, across 100 tests, compared with the current routing method.

    Per-token price is an input to the metric, not the metric itself. Anthropic's cost guidance says to compare models on cost per completed task, and its agent-evaluation post notes that once you have an evaluation, cost per task can be tracked over a fixed set of tasks together with latency, token usage and error rates. That gives you regression baselines without extra work.

    Checkpoint 3 of 7· Check yourself

    You're choosing between two models for an agent. Which comparison does Anthropic's cost guidance recommend?

    Checkpoint 4 of 7· 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?

    Sources234

    3.Safety: quantify the 'hazy' criteria

    Safety can seem too subjective to measure, but the testing guidance treats it like any other criterion: give it a rate, a sample size and a measuring instrument. Its bad example is simply 'Safe outputs'. Its good example is: less than 0.1% of outputs, out of 10,000 trials, flagged for toxicity by the content filter. That criterion names the rate, the sample size and the tool that decides what counts as toxic.

    The multidimensional criterion from the guide adds a second, severity-weighted safety target: 90% of errors should cause inconvenience rather than egregious error. The guide notes that you would also have to define 'inconvenience' and 'egregious' for your own application. Safety can also cover knowing when to stop: the customer-support guide measures whether the model escalates conversations that need a human, aiming for 95% escalation accuracy or higher.

    Checkpoint 5 of 7· Check yourself

    Which of these is a well-formed safety success criterion according to the testing guidance?

    Sources25

    4.Security: define what an attack looks like, then check for it

    These sources give no numeric security target to copy. They do provide two things you need to write one: the threats to measure against, and the kinds of checks that can detect them. The resulting criterion should follow the same specific, measurable approach as safety.

    Start with the threat model. Anthropic's guardrail documentation describes jailbreaking and prompt injection as attempts to make Claude ignore its guidelines or your instructions, and splits them into two categories. In jailbreaks and direct prompt injection, the user is the adversary and crafts inputs to bypass your guardrails. In indirect prompt injection, the user is trusted, but Claude processes third-party content, such as web pages, emails, documents or tool results, that contains adversarial instructions. A security evaluation that only includes malicious user inputs misses the second category.

    The testing guidance adds a data-protection dimension. Decide what a successful metric looks like for how the model handles personal or sensitive information, including whether it follows instructions not to use or share certain details.

    For agents, the agent-evaluation post lists security among the static-analysis checks a code-based grader can run. Its illustrative authentication-bypass task combines a static_analysis grader running bandit with a state_check that expects an auth_blocked event in security_logs. In other words, it checks the security outcome in the environment, not only the agent's claim that it fixed the problem.

    Checkpoint 6 of 7· Match them up

    Match each security concept to what it means or checks

    Tap a term, then the definition that fits it.

    Checkpoint 7 of 7· 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?

    Sources624

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Time to first token and overall response latency are the same measurement.Why is that wrong?

      TTFT measures only the wait until the first token arrives, which matters most for streaming. Baseline latency covers processing the prompt and generating the response.

      Covered in Latency: which clock are you measuring?

    2. 2.The model with the lowest per-token price is the cheapest choice.Why is that wrong?

      Compare models on cost per completed task. A cheaper token can still cost more overall if the model needs more turns or retries to succeed.

      Covered in Cost: per call, per task, against a threshold

    3. 3.Prompt-injection testing only needs adversarial inputs from users.Why is that wrong?

      Indirect prompt injection comes from third-party content such as web pages, emails, documents and tool results, even when the user is trusted.

      Covered in Security: define what an attack looks like, then check for it

    Sources

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

    1. 1.
      “Latency refers to the time it takes for the model to process a prompt and generate an output.”
      ↩︎ Latency: which clock are you measuring?
      “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 1
      “This metric measures the time it takes for the model to generate the first token of the response, from when the prompt was sent.”
      ↩︎ Checkpoint
    2. 2.
      “This depends on your application's real-time requirements and user expectations.”
      ↩︎ Latency: which clock are you measuring?
      “95% response time < 200ms”
      ↩︎ Latency: which clock are you measuring?
      “Consider factors like the cost for each API call, the size of the model, and the frequency of usage.”
      ↩︎ Cost: per call, per task, against a threshold
      “99.5% of outputs are non-toxic”
      ↩︎ Safety: quantify the 'hazy' criteria
      “90% of errors would cause inconvenience, not egregious error”
      ↩︎ Safety: quantify the 'hazy' criteria
      “What is a successful metric for how the model handles personal or sensitive information?”
      ↩︎ Security: define what an attack looks like, then check for it
      “Less than 0.1% of outputs out of 10,000 trials flagged for toxicity by the content filter”
      ↩︎ Checkpoint
    3. 3.
      “Cost per classification: 50% reduction on average (across 100 tests) from current routing method”
      ↩︎ Cost: per call, per task, against a threshold
    4. 4.
      “latency, token usage, cost per task, and error rates can be tracked on a static bank of tasks.”
      ↩︎ Cost: per call, per task, against a threshold
    5. 6.
      “Jailbreaking and prompt injection are attempts to make Claude ignore its guidelines or your instructions.”
      ↩︎ Security: define what an attack looks like, then check for it
      “Jailbreaks and direct prompt injection, where the user of your application is the adversary and crafts inputs intended to bypass your guardrails.”
      ↩︎ Security: define what an attack looks like, then check for it
      “Indirect prompt injection, where the user is trusted but Claude processes third-party content (web pages, emails, documents, tool results) that contains adversarial instructions.”
      ↩︎ Exam trap 3
      “Indirect prompt injection, where the user is trusted but Claude processes third-party content (web pages, emails, documents, tool results) that contains adversarial instructions.”
      ↩︎ Checkpoint

    Also cited

    Ready to test yourself?

    Practise the 12 questions on this subdomain.

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