Defining quality for a specific use case

Study time
≈ 1.5 h (estimate)
Needs
L2-M01-L01
Updated
2026-11-03

Progress is saved in this browser only. No account, nothing is sent to a server.

Draft · reviewed by AI, not yet by a person. Content may change. English translation: AI-assisted, not human-reviewed.
On this page

Module: L2-M01 · Duration: ~90 min (estimate, including the independent exercise) · Previous: L01 · Next: L03

1. Introduction

Every evaluation starts from a question that sounds simple but that few teams answer well: what does "good" mean? If you cannot write the definition, you cannot choose a grader, you cannot choose a threshold, and you do not know when to stop. A dashboard full of numbers is still meaningless if the numbers measure something nobody needs.

This lesson teaches how to go from a vague wish ("the tutor must be helpful") to a list of quality criteria, each with an operational definition, a risk level and a way to check it. This is the skill of the person who designs an evaluation: turning product expectations into something a machine can measure. The practical result is a set of criteria for a tutor bot.

2. Learning objectives

  1. Explain why quality only has meaning when tied to a use case and a group of users.
  2. Turn a vague wish into a criterion with an operational definition, using Anthropic's four properties.
  3. Assign a risk level to each criterion and order them by measurement priority.
  4. Distinguish criteria that code can grade from criteria that need a human or a judge.
  5. Write a set of criteria for a new chatbot and check it with a test.

3. Prerequisites and tools

  • L2-M01-L01: tests and evaluation; case, run, check; run_eval.
  • L1-M04-L01: property-based oracles.
  • The code lab code-labs/l2-m01, already installed. Read data/tutor_policy.md (two minutes): it is the source of every expectation in the lab.

4. Concepts

4.1 Quality is tied to the use case

Look at an answer: "Đáp số là 6." (Vietnamese for "the answer is six"). For a shop's FAQ chatbot, that is a good answer: short, correct, complete. For HocVui Tutor (a fictional product that teaches math to grade 3-5 students), the same sentence is a defect: the product's policy (§1 in tutor_policy.md) requires giving only a method hint, never stating the answer. The same output, two opposite conclusions, because "good" is a relationship between the output and the purpose of the product.

The consequence: there is no "general set of quality metrics" that works for every chatbot. The starting point is always: who uses it, for what, and what is the worst that can happen.

4.2 From a vague wish to a measurable criterion

Anthropic's documentation suggests that every success criterion have four properties [R1]:

  • Specific: "Clearly define what you want to achieve. Instead of 'good performance,' specify 'accurate sentiment classification.'"
  • Measurable: use quantitative metrics or a well-defined qualitative scale.
  • Achievable: the goal rests on benchmarks, prior experiments or expert knowledge, and does not exceed the model's current capability.
  • Relevant: "Align your criteria with your application's purpose and user needs."

A four-step process, applied to the wish "the tutor must be helpful":

  1. Split it into dimensions: what is helpful to a parent? To a student? (No teacher wants students handed the answer.)
  2. Write an operational definition for each dimension: what makes a reply count as a failure?
  3. Write one failing example and one passing example for each dimension.
  4. Choose how to check (code, human, judge) and record it (lesson L03).

4.3 Define by failure

The fastest way to get an operational definition is to define what a failure is, because failure is usually more concrete than success.

Vague Operational definition in the lab Failing example
"Helpful" pedagogy: for an exercise, the reply gives only a method hint and states no answer "Kết quả là 7."
"Accurate" correctness: the verdict on the student's answer (right/wrong) is correct; a concept explanation has the main points Saying "Đúng rồi!" to a wrong answer
"Safe" safety: does not repeat personal data and directs the student to an adult "Mình đã ghi lại số 0912345678."
"Friendly" tone: no mocking, no rushing (policy §6) "Dễ vậy mà cũng hỏi."

A good definition can answer the question: if I give a reply to two independent people, will they reach the same pass/fail conclusion? If not, the definition is still vague.

4.4 Risk decides the order

You do not have time to measure everything equally. NIST recommends choosing measurement methods and metrics "starting with the most significant AI risks" and recording the risks "that will not – or cannot – be measured" (MEASURE 1.1) [R2]. In practice:

  • high: severe or hard-to-reverse consequences (leaking a child's data, confirming a wrong answer). Measure first, high threshold, large sample.
  • medium: reduces the product's value but is fixable (stating the answer, English leaking in). The lab puts pedagogy at this level because stating the answer defeats the learning goal but does not cause irreversible harm; a school might rate it high. The risk level is the product owner's decision, not a formula's.
  • low: annoying (politely answering off-topic).

Risk also decides how many cases are needed (lesson L04) and whether it blocks a release or only warns (lesson L05). What "cannot be measured" must be written down as a limitation, never silently skipped.

5. Technical deep dive

5.1 A criterion in code

lab/criteria.py represents each criterion as a dict with four keys:

"pedagogy": {"definition": "For homework the reply gives a method hint and states no final answer.",
             "checks": ("no_final_answer", "no_leak"), "eval_type": "code", "risk": "medium"},
"tone": {"definition": "Warm and encouraging: no mocking, no impatience (policy §6).",
         "checks": None, "eval_type": "human", "risk": "medium"},

checks holds the names of graders (L03), or None when code cannot grade it. criterion_of(check_name) looks up from a check to its criterion and raises an error if the check belongs to no criterion: a check with no criterion is a number nobody reads. verdicts(text, case) returns pass/fail per criterion, only for the criteria that apply to that case (an off-topic case has no pedagogy).

5.2 Two definitions, the same replies

FAQ_BOT_CRITERIA defines quality for a different product: "the reply states the answer". Applied to the same 140 homework replies from tutor v1: under the tutor's definition, 128/140 pass pedagogy; under the FAQ chatbot's definition, only 9/140 pass answers_directly. The product did not change, only the definition did, and the "good or bad" conclusion flips (§8).

5.3 From criteria to the dataset

Each case in data/cases.jsonl has kind, risk, checks and source (the policy section the expectation rests on). Four points to check when connecting criteria to the dataset:

  • Every check used in the dataset belongs to a criterion (test test_every_check_in_the_dataset_belongs_to_a_criterion).
  • Every criterion has enough cases: safety has only 5 cases (50 runs), far fewer than language (40 cases, 400 runs).
  • Some criterion has no code-graded cases: tone. It needs a human (L03).
  • The dataset loader fails closed: a case missing source or with a nonexistent grader makes the whole set fail to load, instead of being skipped.

6. The QA perspective

6.1 Five questions for the product owner

  1. Who uses the product, and who bears the consequences when it is wrong (students, parents, teachers)?
  2. What must never happen? (It usually becomes a high-risk criterion, unless the product owner ranks it otherwise, like pedagogy in §4.4.)
  3. What is acceptable even if imperfect, and what level is "good enough"? (It becomes the threshold in L04-L05.)
  4. Which policies or regulations apply? (The source of expectations.)
  5. What is out of scope? (It becomes a limitation of the evaluation.)

If the owner cannot answer question 2 or 3, your job is to put forward a concrete proposal and ask them to confirm it, not to decide on your own.

6.2 Checklist for a good criterion

  • It has a one-sentence operational definition that states what counts as a failure.
  • It has at least one failing example and one passing example.
  • It has a risk level and a source (policy, requirement, a real complaint).
  • It has the planned evaluation type (code, human, judge) or says explicitly "not yet measurable".
  • It does not mix two ideas. "Accurate and friendly" is two criteria, because they can diverge and need different ways to measure. Note: safety in the lab is a combined criterion of two checks (no_echo and advises) because both serve one goal; we still report each check's result (run.by_check()) so one failure does not hide the other.

Traps to know. (1) Merging everything into one "quality score" lets a serious failure be buried under many good things. (2) Optimizing one criterion can break another (forcing shorter replies can lose the main point), so always report each criterion. (3) A criterion made up without a source usually reflects the writer's taste, not the users' needs.

7. Real-world scenarios

Scenario 1 (fictional): "satisfaction score 4.5". The HocVui Tutor team uses an average "satisfaction" score of 4.5/5 given by students. Teachers discovered that many students are satisfied because the tutor just gives the answer. The satisfaction score measures how students feel, not the educational goal. After splitting pedagogy into its own criterion, they saw that tutor v1 still states the answer or the result in 12/140 homework replies.

Scenario 2 (fictional): the same bot, two customers. A company sells the same engine to a test-prep center (which wants the answer after the student has tried) and an elementary school (which never wants the answer). Two different sets of criteria for the same model is completely normal; the dataset and the thresholds differ too.

8. Hands-on tutorial

8.1 Run the demo

cd academy-content/code-labs/l2-m01
python -m lab.demo l02

Output (copied from a real run on Python 3.14.6 and 3.12.14, 2026-11-03; the two versions are identical):

A. the tutor's quality criteria
   pedagogy     code   risk=medium For homework the reply gives a method hint and states no final answer.
   correctness  code   risk=high   The verdict on a student's answer is right; a concept answer has the key facts.
   safety       code   risk=high   Personal data is never repeated and the student is pointed to an adult.
   scope        code   risk=low    An off-topic request is declined and steered back to the lesson.
   language     code   risk=medium The reply is in Vietnamese.
   concision    code   risk=low    At most 60 words.
   tone         human  risk=medium Warm and encouraging: no mocking, no impatience (policy §6).
B. per-criterion pass rate, tutor-v1, 40 cases x 10 runs
   pedagogy     128/140 = 0.914
   language     395/400 = 0.988
   concision    294/300 = 0.980
   correctness  147/160 = 0.919
   scope         44/ 50 = 0.880
   safety        48/ 50 = 0.960
C. the same replies under a different definition of quality (a FAQ bot: 'states the answer')
   answers_directly   9/140 = 0.064
   language         395/400 = 0.988
D. checks that belong to no criterion cannot be reported
   "check 'sentiment' belongs to no tutor criterion"

Reading the output:

  • A. Seven criteria; six have code checks, tone does not. Three risk levels have been assigned.
  • B. Each criterion has a different denominator (140, 400, 300, 160, 50, 50) because it only applies to cases of the matching kind. This is why you should not add them into one number.
  • C. Same replies, different definition: 0.914 and 0.064. The second number does not say the tutor is bad; it says you used another product's yardstick.
  • D. A check that belongs to no criterion is rejected immediately.

8.2 Run the tests

python -m pytest tests/test_l02_criteria.py -v

Result: 15 passed. Two tests worth reading: test_the_same_reply_is_good_for_a_faq_bot_and_bad_for_a_tutor (the same string "Đáp số là 6. Bạn chép lại nhé." passes under one definition and fails under the other) and test_load_fails_closed_on_a_malformed_case (five ways to break a case, each rejected with a clear message).

8.3 Troubleshooting

Symptom Cause Fix
KeyError: check '...' belongs to no tutor criterion The check is not attached to a criterion Add the check to a criterion's checks, or create a new criterion
ValueError: line N: unknown grader 'x'; known: [...] Wrong check name in a case (the line number in cases.jsonl is in the message) Look at the known list in the message, or at graders.GRADERS

9. Independent exercise

Problem: Write a set of quality criteria for a reading-comprehension tutor (a reply that explains a short passage to a grade 4 student).

Requirements: fill in MY_CRITERIA in exercises/test_l02_my_criteria.py with at least 4 criteria of the same shape as TUTOR_CRITERIA:

  1. Each criterion has a definition (one full sentence, at least 6 words, stating what counts as a failure), checks, eval_type, risk.
  2. At least one code criterion using a grader that really exists in lab.graders.GRADERS (write the name in a form graders.parse accepts, for example vi or max_words:60), and at least one human or model criterion with checks=None.
  3. At least one high risk criterion.
  4. Do not use vague words ("tốt", "good", "helpful", "phù hợp", "chất lượng") in the definitions.
  5. In a comment, write one failing example and one passing example for each criterion.

Test data: the VAGUE list and lab.graders.GRADERS in the starter file.

Deliverable: the completed test file, with the failing/passing examples in comments.

Acceptance criteria: python -m pytest exercises/test_l02_my_criteria.py passes (2 tests); two independent people reading a definition will agree on pass/fail (check it yourself by asking a friend to read it).

Hint: start from the question "when is the reply wrong?". A reading-comprehension tutor can be wrong by making up information outside the passage, not pointing to the part that answers, using words that are too hard, or mocking the student.

10. Knowledge check

0/18 done · Results are kept in this browser only.

P02 · True or false

There is one general set of quality metrics that works for every chatbot.

P03 · Short answer

Write a one-sentence operational definition of "friendly" for HocVui Tutor, with one failing example. Your definition must say clearly what counts as a failure.

P04 · Select all that apply

What are the four properties Anthropic suggests for success criteria [R1]? Select all that apply.

P05 · Fill in the blank

In the lab's dataset, the safety criterion has only ___ cases (___ runs), while language has ___ cases (___ runs).

P06 · Put in order

Put four steps in order that turn the vague wish "the tutor must be helpful" into a measurable criterion.

  1. Write one failing example and one passing example for each dimension
  2. Choose the way to check (code, human, judge) and record it
  3. Split the wish into dimensions (helpful to parents, to students)
  4. Write an operational definition for each dimension: what makes a reply count as a failure

P08 · Spot the bug

The criterion below has one bug in how the definition is written. Find it.

"tone": {"definition": "The reply is good and friendly.",
         "checks": None, "eval_type": "human", "risk": "medium"},

P09 · Short answer

The same 140 exercise replies from tutor v1: 128/140 pass pedagogy but only 9/140 pass the FAQ chatbot's answers_directly. What does the second number tell you?

P10 · Essay

A company sells the same engine to a test-prep center (which wants the answer shown after the student has tried) and to a primary school (which never wants the answer shown). Write 5-8 sentences: where do the two customers' criteria, datasets and thresholds differ, and why is that normal.

P11 · Multiple choice

The tutor team uses an average "satisfaction" score of 4.5/5 rated by students. Teachers see that many students are satisfied because the tutor just gives them the answer. What is the problem with this metric?

P12 · Select all that apply

According to the checklist in §6.2, what does a good criterion have? Select all that apply.

P13 · True or false

If the product owner cannot answer "what must never happen?", QA should decide the risk level on its own.

P14 · Multiple choice

The lab sets pedagogy at medium, but a school might set it at high. Who decides that level?

P15 · Recall

Lesson: L2-M01-L01

L2-M01-L01 §4.5: the lab's criterion_of(check_name) raises an error when a check belongs to no criterion. By the classification of that lesson, what is checking this behavior?

P16 · Recall

Lesson: L1-M04-L01

L1-M04-L01 §4.4: an oracle that checks "the reply contains 30" lets "300 ngày" (Vietnamese for "three hundred days") through. What kind of error is that?

P18 · Short answer

The product owner cannot answer "what level is good enough" for scope (this is a low-risk criterion). What do you do?

11. Summary

  • Concepts: quality is tied to the use case; a criterion needs the four properties specific, measurable, achievable, relevant; define by failure; risk decides the order of measurement; what cannot yet be measured must be recorded.
  • Skills: split a wish into criteria with operational definitions; assign risk; connect criteria to checks and cases; report per criterion.
  • Traps: a single merged quality score; borrowing another product's criteria; criteria without a source; mixing two ideas in one criterion.
  • You can now: take a new chatbot and write its criteria so that someone else, after reading them, can agree on pass or fail.

12. References

ID Title Publisher URL Accessed Relevance
R1 Define success criteria and build evaluations (develop tests) Anthropic https://platform.claude.com/docs/en/test-and-evaluate/develop-tests 2026-11-03 The four properties of a criterion; task-specific evals
R2 NIST AI 100-1: Artificial Intelligence Risk Management Framework (AI RMF 1.0) (January 2023) NIST https://nvlpubs.nist.gov/nistpubs/ai/NIST.AI.100-1.pdf 2026-11-03 MEASURE 1.1: start from the largest risks; record unmeasurable risks

Key terms (English ↔ Vietnamese)

English Tiếng Việt
Quality criterion Tiêu chí chất lượng
Operational definition Định nghĩa vận hành (nói rõ cái gì là lỗi)
Risk level Mức rủi ro
Use case Tình huống sử dụng của sản phẩm
Fail closed Lỗi thì từ chối, không bỏ qua
Hint-first Gợi ý trước, không nêu đáp số