Module: L2-M01 · Duration: ~120 min (estimate, including the independent exercise) · Previous: L04 · Next: L2-M02-L01 (module Evaluation Dataset Design, not yet written)
1. Introduction
The previous four lessons gave you the pieces: telling tests from evals (L01), quality criteria (L02), grader types (L03), statistics and sample size (L04). An evaluation strategy puts them together in a single document that answers five questions: what to measure, how, on what data, how much is enough, and what decision the result leads to.
Without this document, every release becomes a debate: someone picks a few convenient cases, someone else picks a threshold by gut feeling. With a strategy, the decision is recorded before looking at the results. It is the deliverable of the module ("Evaluation strategy") and the first piece in the Level 2 portfolio. This lesson also teaches you to check a strategy with a validator, so that "complete enough" does not depend on a feeling.
2. Learning objectives
- List the required parts of an evaluation strategy and say which question each answers.
- Write a decision rule based on the bounds of the confidence interval, including the INCONCLUSIVE case.
- Run the validator on a strategy, read the problems it reports and fix them until it is clean.
- Explain what the validator cannot check, and why an empty problem list is not yet a good strategy.
- Produce a per-criterion report from a run and compare it with the thresholds in the strategy.
3. Prerequisites and tools
- L2-M01-L02 to L04: criteria, grader types,
required_n_margin,decide. - L1-M06-L05: you have already written a regression report; a strategy is the document before the report.
- The code lab
code-labs/l2-m01:lab/strategy.py,lab/report.py,data/strategy_example.json,data/strategy_draft.json.
4. Concepts
4.1 Why write a strategy down
NIST requires the components of measurement to be recorded: "Test sets, metrics, and details about the tools used during TEVV are documented" (MEASURE 2.1), and "Limitations of the generalizability beyond the conditions under which the technology was developed are documented" (MEASURE 2.5) [R1]. A strategy is where those things are recorded. It has three practical uses:
- Decide before seeing the numbers. Thresholds and the ship rule are written first so they are not "adjusted to fit the results".
- Communication. The product owner, devs and QA read the same document and know what "green" means.
- Reproduction. A newcomer (or you, six months later) reruns the evaluation the right way.
4.2 Twelve rules, ten parts of a strategy
The validator in the lab checks 12 rule codes (S01-S12), grouped into the following ten parts. Each part answers one question:
| Part | Question | Code |
|---|---|---|
| Use case and users | What is the product, who uses it? | S01 |
| Criteria | What does quality mean? Metric, grader type, threshold, risk? | S02-S04 |
| Calibration | Do model-graded criteria have enough human labels to be checked? | S06 |
| Dataset | Where does the data come from, which version, planned size? | S05 |
| Sample size | Is the dataset large enough for the precision needed? | S07 |
| Decision rule | When to ship, block, or collect more data? | S08 |
| Offline and online plan | When does it run, what are the real signals, what do they not show? | S09 |
| Limitations | What is not measured, not covered? | S11 |
| When to rerun | Which changes trigger the evaluation? | S12 |
| Owner and review cadence | Who is responsible, how often is it reviewed? | S10 |
4.3 The decision rule
The decision rule is the most valuable part, because it turns numbers into actions. A good rule:
- Rests on the bounds of the confidence interval, not on the observed score (L04): "ship if the 95% lower bound of every criterion reaches its threshold".
- Has a branch for INCONCLUSIVE: collect more cases (
collect_more) or block (block), never "ship because it is close". - Decides per criterion, not by average score, because a serious defect must not be offset by many good things (L02).
- Derives the threshold from the criterion's risk (L02), and is confirmed by the product owner.
Example in the lab: safety (high risk) has a threshold of 0.98; scope (low risk) has a threshold of 0.85. These numbers are set by the lab for teaching, not an industry standard; in a real project you ask the product owner for them.
4.4 Limitations and when to rerun
NIST also requires that the risks "that will not – or cannot – be measured are properly documented" (MEASURE 1.1) [R1]. The limitations part of the strategy states plainly what the evaluation does not allow you to conclude: the dataset only has grade 3-5 math, the judge was only calibrated on 60 labels from two raters, and online signals are a tripwire, not an error rate (L03).
The when to rerun part lists the events that trigger the evaluation: a prompt change, a model change, a dataset version change, a judge change, or an abnormal online signal. OpenAI recommends "Set up continuous evaluation (CE) to run evals on every change" [R2]. Writing this down makes rerunning a process, independent of anyone's memory.
5. Technical deep dive
5.1 The strategy as data, and the validator
data/strategy_example.json is a complete strategy for HocVui Tutor (fictional). lab/strategy.py has load(path) and validate(s), which returns a list of Problem(code, where, message).
The core rules:
| Code | Check |
|---|---|
| S01 | use_case has name, users, description |
| S02 | There are criteria; each criterion has a definition, a metric, a valid risk, and a unique id |
| S03 | eval_type is code, human or model |
| S04 | threshold is a number in the open interval (0, 1): a threshold of 1 can never be proven |
| S05 | The dataset has source, version, planned_size |
| S06 | A model criterion has at least 50 human labels to calibrate against |
| S07 | planned_size is enough for the risk-based margin of error and enough for an all-pass run to reach the threshold (§5.2) |
| S08 | decision_rule.uses_interval is true; on_inconclusive is collect_more or block |
| S09 | There is an offline plan, online signals and a caveat |
| S10 | There is an owner and a review_cadence |
| S11, S12 | There are limitations; there are rerun conditions |
The validator returns a list instead of stopping at the first error, and an empty strategy ({}) produces many problems rather than crashing the program (test_an_empty_strategy_reports_problems_instead_of_crashing).
5.2 Rule S07: sample size by risk
S07 connects L02 with L04. For each criterion, the validator computes two numbers and requires dataset.planned_size to reach both. One: required_n_margin(threshold, margin) with a margin by risk of high ±0.03, medium ±0.05, low ±0.10. Two: required_n_all_pass(threshold), the smallest number of cases for an all-pass run to still give decide(n, n, threshold) == "SHIP", because with a threshold close to 1 the margin-of-error formula gives a very small number while the Wilson lower bound needs more cases to reach the threshold (a threshold of 0.99 needs 381 cases; a threshold of 1 can never be reached so S04 rejects it). The margin by risk is a lab convention for teaching, not an external standard; you should negotiate the margin with the product owner.
A simplification in the lab. S07 compares planned_size (the total number of cases) with the number needed for each criterion, while each criterion actually has its own denominator (L02 §8.1, L04 §4.4): correctness has only 16 cases in the lab, safety 5 cases. A real strategy should plan the number of cases per criterion.
In the example strategy, the criterion that demands the most cases is correctness (threshold 0.95, high risk): 203 cases (the second number is 73, which is smaller). The example strategy sets planned_size = 220 and is clean. Setting 200 makes the validator report it immediately (§8.3). test_planned_size_boundary_follows_the_sample_size_formula pins exactly the boundary at 202 and 203.
5.3 From strategy to report
report.render(run, cases, strategy) takes the per-criterion results from a run, computes the Wilson interval and applies decide with the thresholds in the strategy. A criterion not graded by code (tone) is skipped in this table because its labels come from humans and the judge (L03).
6. The QA perspective
6.1 Reviewing someone else's strategy
Eight questions for the review:
- Does each criterion have a definition on which two independent people would agree about pass/fail?
- Does each high-risk criterion have a strong enough grader type and enough cases?
- Does the dataset represent real users, or only what was easy to write?
- Has the judge (if any) been compared with human labels, and on a sample chosen how?
- Who set the thresholds, and based on what?
- Does the decision rule have an INCONCLUSIVE branch yet?
- Are the limitations stated honestly, or are they just a token sentence?
- When is the strategy reviewed again and who is responsible?
6.2 What the validator does not check
The validator checks structure and a few consistency constraints. It does not know: the separate denominator of each criterion (§5.2); whether the criteria match the users' real needs; whether the dataset is representative; whether the thresholds are reasonable; whether the limitations are honest; whether the judge was really calibrated or the strategy just says "60 labels". An empty problem list means "complete enough and not self-contradictory", not "good". A human still has to review, ideally someone who did not write the strategy.
Traps to know. (1) Writing the strategy after seeing the results. (2) A threshold "for show" like 0.99 that the dataset can never be large enough to prove (381 cases are needed even when every case passes), so a release is never approved or the gate is bypassed every time. (3) Forgetting to update when the product changes scope.
7. Real-world scenarios
Scenario 1 (fictional): a debate at every release. The HocVui Tutor team has no strategy. At every release, devs pick a few "representative" cases, QA asks for more, and the decision depends on who speaks louder. After writing a strategy with a rule based on interval bounds, the release meeting shrinks to a table: which criteria are SHIP, BLOCK, INCONCLUSIVE.
Scenario 2 (fictional): INCONCLUSIVE saves a release. With 40 cases x 10 runs (the lab), safety gives 48/50 (0.960; interval 0.865-0.989) against a threshold of 0.98: INCONCLUSIVE. Without the rule, the team would see "96%, close to 98%" and ship. With the rule, they collect more cases until the dataset reaches the size fixed in the strategy before deciding.
Note: at 50 runs and 5 cases, even a "nice" measurement is not enough evidence for a high-risk criterion.
8. Hands-on tutorial
8.1 Run the demo
cd academy-content/code-labs/l2-m01
python -m lab.demo l05
Output (copied from a real run on Python 3.14.6 and 3.12.14, 2026-11-03; the two versions are identical):
strategy_draft: 15 problems
S01 use_case.users: is required
S10 owner: name an owner
S10 review_cadence: say when the strategy is reviewed
S02 criteria[helpful]: needs a metric
S03 criteria[helpful]: eval_type must be one of ('code', 'human', 'model')
S07 criteria[helpful]: planned_size 40 < 139 cases needed for a +/-0.05 margin at rate 0.9
S07 criteria[safety]: planned_size 40 < 43 cases needed for a +/-0.03 margin at rate 0.99
S07 criteria[safety]: planned_size 40 < 381 cases needed for an all-pass run to reach a Wilson lower bound of 0.99
S06 criteria[tone]: a model-graded criterion needs >= 50 human labels to calibrate against
S07 criteria[tone]: planned_size 40 < 139 cases needed for a +/-0.05 margin at rate 0.9
S08 decision_rule.uses_interval: decide on an interval bound, not on a point estimate
S08 decision_rule.on_inconclusive: must be 'collect_more' or 'block'
S09 online.caveat: state what the online signals cannot show
S11 limitations: state at least one limitation
S12 rerun_triggers: say when the evaluation is re-run
strategy_example: 0 problems
# Evaluation report: HocVui Tutor (fictional)
system `tutor-v1`, seed 1, 40 cases x 10 runs, dataset `47065d9256b4`
| criterion | pass | rate | 95% Wilson | threshold | decision |
|---|---|---|---|---|---|
| pedagogy | 128/140 | 0.914 | 0.856-0.950 | 0.90 | INCONCLUSIVE |
| correctness | 147/160 | 0.919 | 0.866-0.952 | 0.95 | INCONCLUSIVE |
| safety | 48/50 | 0.960 | 0.865-0.989 | 0.98 | INCONCLUSIVE |
| scope | 44/50 | 0.880 | 0.762-0.944 | 0.85 | INCONCLUSIVE |
| language | 395/400 | 0.988 | 0.971-0.995 | 0.98 | INCONCLUSIVE |
| concision | 294/300 | 0.980 | 0.957-0.991 | 0.90 | SHIP |
n counts runs, and runs of one case are not independent (lesson 04): intervals here are optimistic.
Reading the output:
- Draft: 15 problems, from missing users and owner, through an invalid grading kind (
vibes), to aplanned_sizeof 40 that is too small for every criterion (S07) and a decision rule that only looks at the observed score (S08). - Example: 0 problems.
- Report: only
concisionis SHIP. The other five criteria are INCONCLUSIVE, andcorrectnessagrees with the strategy's conclusion: more cases are needed (correctnesshas 16 cases, needs 203). Remember also that the intervals here are still optimistic because they treat runs as independent (L04).
8.2 Run the tests
python -m pytest tests/test_l05_strategy.py -v
Result: 15 passed. Read test_draft_strategy_has_fifteen_problems_across_ten_rules and test_a_decision_on_a_point_estimate_is_rejected.
8.3 Try breaking a strategy
Save it as try_l05.py in the lab's root folder (next to lab/):
from lab import dataset, strategy
s = strategy.load(dataset.DATA / "strategy_example.json")
s["dataset"]["planned_size"] = 200
for p in strategy.validate(s):
print(p)
Output:
S07 criteria[correctness]: planned_size 200 < 203 cases needed for a +/-0.03 margin at rate 0.95
It is only 3 cases short of 203, but the rule was written down in advance so the "close enough" debate ends immediately.
8.4 Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
json.decoder.JSONDecodeError |
An extra comma or bracket in the JSON | Use a JSON formatter or read the error line |
| A new S07 problem appears after raising a threshold | A higher threshold or higher risk needs more cases | Increase planned_size or revisit the threshold with the product owner |
| The validator is clean but the strategy is still poor | It only checks structure (§6.2) | Review with the eight questions in §6.1 |
9. Independent exercise
Problem: Fix the draft strategy for HocVui Tutor until the validator reports no problems, without emptying out the content.
Requirements: edit exercises/my_strategy.json (do not edit the test file):
- Fill in the users, owner, review cadence, limitations, rerun conditions and the online
caveat. - Replace the invalid
eval_typewithcode,humanormodel; add ametricto every criterion. - Fix the decision rule:
uses_interval: true,on_inconclusiveiscollect_moreorblock. - For the
tonecriterion (model-graded), state a calibration plan with at least 50 human labels. - Raise
planned_sizeenough for every criterion (compute it withstats.required_n_marginandstats.required_n_all_pass); do not lower a threshold below 0.9 and do not raise a threshold to 1 to dodge S07 (unlike the example strategy, wherescopehas a threshold of 0.85; the exercise forbids lowering thresholds to dodge S07). - Add to
my_strategy.jsona field"validator_blind_spots": [...]with three things the validator does not check in your strategy (each at least four words).
Test data: exercises/my_strategy.json (the draft), lab/strategy.py.
Deliverable: the fixed my_strategy.json, including the validator_blind_spots field.
Acceptance criteria: python -m pytest exercises/test_l05_strategy.py passes (3 tests): the validator reports no problems, the safety criterion is still there, there are at least 3 criteria, the use case name is unchanged, every threshold is in 0.9; 1) and there are three entries in validator_blind_spots.
Hint: run the test and read the problem list; fix one group of codes at a time, rerun. Open data/strategy_example.json to see the shape of a complete strategy, but write the content from your own understanding.
10. Knowledge check
0/18 done · Results are kept in this browser only.
P02 · True or false
P03 · Short answer
Which five questions does an evaluation strategy answer?
P04 · Select all that apply
P05 · Fill in the blank
P06 · Put in order
P08 · Spot the bug
The decision_rule snippet below belongs to a strategy for which the validator reports code S08. Find the bug.
"decision_rule": {
"uses_interval": true,
"on_inconclusive": "ship"
}P09 · Short answer
With 40 cases x 10 runs, safety scores 48/50 (0.960; interval 0.865-0.989) against a threshold of 0.98. Why is the decision INCONCLUSIVE and what should the team do?
P10 · Essay
You are asked to review a colleague's strategy for a different chatbot. Pick four of the eight questions in §6.1 and write 5-8 sentences: why each one matters and what evidence you will look for in the document.
P11 · Multiple choice
P12 · True or false
P13 · Select all that apply
P14 · Multiple choice
P15 · True or false
P16 · Recall
Lesson: L2-M01-L04P17 · Recall
Lesson: L2-M01-L0311. Summary
- Concepts: a strategy records in advance what to measure, how, on what data, how much is enough and what to decide; the decision rule rests on interval bounds and has an INCONCLUSIVE branch; limitations must be stated; the validator checks structure and consistency, not quality.
- Skills: write a strategy as data; run it and fix it by the validator; generate a per-criterion report and compare it with thresholds; compute sample size by risk.
- Traps: writing the strategy after seeing the numbers; a threshold that cannot be reached on the current dataset; forgetting limitations; believing a clean validator means a good strategy.
- You can now: write and defend an evaluation strategy for an AI feature, and block a release based on it.
12. References
| ID | Title | Publisher | URL | Accessed | Relevance |
|---|---|---|---|---|---|
| R1 | 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 (unmeasurable risks must be documented), 2.1 (record the test set, metrics), 2.5 (limits of generalization) |
| R2 | Evaluation best practices | OpenAI | https://developers.openai.com/api/docs/guides/evaluation-best-practices | 2026-11-03 | Continuous evaluation; eval-driven development (page redirected from platform.openai.com) |
Key terms (English ↔ Vietnamese)
| English | Tiếng Việt |
|---|---|
| Evaluation strategy | Chiến lược đánh giá |
| Decision rule | Quy tắc quyết định |
| Gate | Cổng chặn / cho qua dựa trên điều kiện |
| Threshold | Ngưỡng |
| Calibration | Hiệu chuẩn (so với nhãn của người) |
| Limitation | Giới hạn của phép đo |
| Continuous evaluation | Evaluation chạy liên tục sau mỗi thay đổi |