Module L2-M02 exercises: Releasing the hocvui-eval 2.0.0 evaluation dataset

Study time
≈ 4 h (estimate)
Updated
2026-11-03
Draft · reviewed by AI, not yet by a person. Content may change. English translation: AI-assisted, not human-reviewed.
On this page

Estimated time: ~4 hours for someone who has finished the five independent exercises of L01-L05 (an estimate, not yet measured with real learners). Main tools: lab.sources, lab.pii, lab.coverage, lab.labeling, lab.synth, lab.versioning, lab.system in code-labs/l2-m02.

Main hands-on assignment

Business context

The HocVui team (fictional) is about to evaluate tutor v2 and needs a versioned evaluation dataset to run the evaluation. The QA lead has left behind a v2 draft (43 cases) and a draft manifest with errors. You are assigned to turn the draft into a hocvui-eval release with a source plan, coverage, a labelling guideline, a changelog and a dataset card, and then answer one question: is this release good enough to publish, and what does the release gate not check?

Problem to solve

The draft has silent gaps: a cell of the matrix may still be empty, a case may already be in the prompt, two near-identical cases may land on opposite sides of dev and test, and the manifest declares the wrong version bump. An evaluation number computed on this draft would look good without being trustworthy. Your job is to find these gaps with the lab's tools, fix them under the fixed rules below, and record your decisions.

Input data

  • Product and policy: data/tutor_policy.md (the source of every expectation), data/tutor_prompt.txt (the prompt with three few-shot examples).
  • Sources: data/production_log.jsonl (600 messages, 30 days), data/expert_cases.jsonl, lab.synth.SimulatedGenerator.
  • Dataset: data/eval_v1.jsonl with data/manifest_v1.json (released, 1.0.0); data/eval_v2.jsonl (draft, 43 cases); data/manifest_v2_draft.json (draft manifest, kept as a reference for the errors).
  • Labelling: data/label_items.jsonl (80 items, two annotators for each guideline), data/guideline_v1.json, data/guideline_v2.json.
  • Black-box rule: the simulated system (lab.system) is used only to learn the true pass rate; do not edit lab/ or data/.

The fixed configuration (so that every submission is reproducible and comparable):

Item Value
Required cells 20 intent × style cells, each with ≥ 1 case; at most 2 cells may be excluded, each with a reason in notes/decisions.md
Sampling in Task 1 random n = 100 and first n = 100 and thumbs_down n = 30, seed=3
Equal sample in Task 2 coverage.stratified_sample(log, "intent", 100, seed=7, mode="equal"); repeat 300 times with seeds 0-299 to take the average
Contamination check n = 5, gate threshold 0.5, against the Học sinh: lines of tutor_prompt.txt; watch threshold 0.3
Synthetic data SimulatedGenerator(seed=21, existing_texts=<questions of expert_cases.jsonl>), 200 candidates; when adding to the dataset: existing_texts = the questions of the draft after removing the contaminated cases plus the questions of expert_cases.jsonl, per_template_cap=1; id G + the number of cand_id; origin: synthetic; field generator
Version previous_version = 1.0.0; the new version follows the L05 §4.1 rule
Dev/test split salt="hocvui-v2", dev_share=0.5; near-duplicate pairs at threshold 0.8 must not sit on both sides

Tasks

  1. Sources and privacy (L01). Write source_plan.json for the release: three sources, each with a specific known_bias, and the production source with all three privacy fields; each source's share deviates by at most 0.10 from the real composition of the final release. Run the PII screener on the whole log and report: the number of messages with a detection (in total and by type), how much of the planted PII of each type (pii_truth) the screener sees and which type is missed entirely, and the true pass rate of the simulated system on the whole log and on the three samples drawn in three ways. Record the PII handling decision (redact, pseudonymise or exclude) for each group of cases.
  2. Coverage and sampling (L02). Compute the intent × style matrix of the draft, its empty cells, and a decision for each empty cell (fill, exclude with a reason, or accept the risk). For every empty cell that is not excluded, add at least one case taken from the log (picked by hand within the cell, with the reason for the pick, PII redacted, the expectation written from the policy; if the cell belongs to the check intent, the cell needs both a correct-answer case and a wrong-answer case). Add a sampling plan for the next round: the probability that a random sample of 40 messages contains no pii message, the smallest number of messages for that probability to be at most 0.05, how to split 40 cases with floor and a floor of 5, and a comparison of the overall pass rate with the weighted pass rate on the equal sample (once, and as the average of 300 runs) against the true pass rate.
  3. Labelling (L03). Write guideline.json for the label "does the tutor state the final answer" (policy §1): empty lint, at least three borderline-case rules, and examples that do not duplicate a question of the released dataset or a reply of label_items.jsonl. Measure raw agreement, chance agreement, agreement by case group and the number of disagreeing items for both existing guidelines; adjudicate with the gold label; report the number of items where both annotators agree but the final label differs (which guideline has them, and why this is dangerous). Run the "does not contain the answer" check in code on all 80 items, and report the number and ids of items whose final label differs, and the cause.
  4. Synthetic data (L04). Generate and filter with the configuration above; report the funnel (kept, and how many removed for each reason), the number of planted errors still left in the kept part, the share of division problems before the cap, and the true pass rate on the log and on the kept synthetic set. Add the cases that pass the one-case-per-template cap to the dataset (the must_not_include expectation contains the answer rounded to an integer; source policy §1). State in notes/decisions.md one thing the filter does not catch.
  5. Release (L05). Assemble the release: drop the cases whose n-gram overlap with the few-shot examples is ≥ 0.5 (with the reason), and add the cases from Tasks 2 and 4. Compute the diff against 1.0.0, the new version, manifest.json (fingerprint computed by the lab, a changelog with both the old 1.0.0 entry and the new entry whose lists match the diff and give reasons, a PII exemption with a reason for each case that still has PII), the dev/test split (no near-duplicate pair on both sides), dataset_card.json (seven sections, maintenance with owner, update policy and retire rule; limitations stating what was measured), and run the release gate. At the end of notes/decisions.md, state what the gate does not check.
  6. Reproduction. Write build_release.py, which generates every file in release/ and reports/ (every number comes from the lab, none typed by hand), and test_build_release.py, which checks the constraints of AC1-AC5 on the files you generate.

Deliverables

dataset_release/
  __init__.py                    (file rỗng)
  source_plan.json               (Nhiệm vụ 1)
  guideline.json                 (Nhiệm vụ 3)
  new_cases.json                 (Nhiệm vụ 2: các case lấy từ log, viết tay)
  build_release.py               (Nhiệm vụ 6; chạy: python -m dataset_release.build_release)
  test_build_release.py          (Nhiệm vụ 6; chạy: python -m pytest dataset_release)
  notes/
    decisions.md                 (quyết định, năm mục: Ô trống, PII, Contamination, Chia dev/test, Điều cổng không kiểm)
  release/                       (sinh bởi build_release.py)
    cases.jsonl
    manifest.json
    dataset_card.json
    split.json                   (id của dev và test, id phải chuyển phía, cặp gần trùng còn lại)
  reports/                       (sinh bởi build_release.py)
    sources.md
    coverage.md
    labelling.md
    synthetic.md
    release.md

Put the dataset_release/ folder in code-labs/l2-m02 so that import lab works. Run from the lab folder.

Acceptance criteria (required)

# Criterion How to check
AC1 source_plan.json passes validate_source_plan (empty list), has all three source types, the production source's sampling is random, each share deviates ≤ 0.10 from the composition of release/cases.jsonl; reports/sources.md has the number of PII messages by type, the detection rate for each planted PII type, and the table of the three sampling methods; the PII section of notes/decisions.md names the types the screener does not see python -c "import json; from lab import sources; print(sources.validate_source_plan(json.load(open('dataset_release/source_plan.json', encoding='utf-8'))))" prints []; recompute every number with lab.pii.report and lab.sources.sample_log; the grader cross-checks
AC2 Every required cell (except at most 2 cells with a reason) has ≥ 1 case in release/cases.jsonl; each case in new_cases.json is a PII-redacted log message, in the right cell, with an expectation matching the student's calculation; reports/coverage.md has the 20-cell matrix, the list of empty cells of the draft, and the numbers of the sampling plan coverage.gaps(cases, required, 1) returns [] (or exactly the excluded cells); python -m pytest dataset_release; recompute the numbers with lab.coverage
AC3 guideline.json passes lint_guideline (empty), has ≥ 3 borderline-case rules, examples_in_dataset is empty for both the question of the released dataset and the reply of label_items.jsonl; reports/labelling.md has the table of the two guidelines (raw agreement, chance agreement, borderline cases, number of disagreeing items, number of items that agree but have a wrong final label) and the number of ids that differ in the code check python -c calling lab.labeling.lint_guideline and examples_in_dataset; recompute with raw_agreement, chance_agreement, agreement_by; the numbers must match
AC4 reports/synthetic.md has a funnel that matches a rerun of filter_candidates; every G... case in the dataset passes filter_candidates([candidate]) and verify_answer, has origin: synthetic, generator, and the tag generated; the synthetic share does not exceed the synthetic share in source_plan.json by more than 0.10; reports the true pass rate of the log versus the synthetic set Rerun SimulatedGenerator(seed=21, ...); compare each id with the candidate; the grader cross-checks the blind spot in decisions.md
AC5 validate_release(manifest, v1, cases, "1.0.0") returns []; the changelog has the 1.0.0 entry and a new entry with added, removed, changed matching the diff and with reasons; contamination(cases, few-shot, flag_at=0.5) is empty; split_leaks(dev, test, 0.8) is empty with the exact split.json; lint_card is empty; limitations states what was measured; reports/release.md records the diff, the bump, the fingerprint and the gate result python -c calling the functions above on the generated files; recompute the fingerprint with versioning.fingerprint; the numbers must match
AC6 Rerunning python -m dataset_release.build_release produces exactly the files in release/ and reports/ (compared byte by byte, for example with git diff or diff); python -m pytest dataset_release passes; the reports state the seed and the configuration; notes/decisions.md has all five sections, says plainly that every number is simulated, and states what the gate does not check Run twice and compare; the grader reads decisions.md against the rubric

Grading rubric (100 points)

Dimension 0 1 2 3 Weight
Sources and privacy (AC1) Does not meet AC1 The plan passes the validator but the bias is written generically or the PII measurement is missing The plan passes the validator, shares match the real composition, PII is measured by type, handling is stated for each group As level 2, states clearly what the screener does not see (addresses, numbers written in words), points out where the thumbs_down and first samples are skewed, and does not treat "filtered" as "clean" 15
Coverage and sampling (AC2) Does not meet AC2 Has the matrix but an empty cell has no decision, or an added case is in the wrong cell Empty cells are filled with log cases in the right cell, the sampling plan has the right numbers As level 2, explains why the pooled number of the equal sample is skewed and how far the weights correct it (including that a single sample is still noisy), states the number of cells with few cases and the decision with a responsible owner 20
Labelling (AC3) Does not meet AC3 The guideline passes lint but has no concrete borderline-case rule, or reports only raw agreement A complete guideline, reports raw and chance agreement by group for both guidelines As level 2, points out items where both agree but are wrong and says adjudication does not see them, explains the cause of the items that differ in the code check 15
Synthetic data (AC4) Does not meet AC4 Has the funnel but added cases do not pass all the steps, or no blind spot is stated Correct funnel, added cases match the spec, states one blind spot As level 2, explains why the synthetic set gives a nicer number than the log by construction, proposes an extra check, and reports separately by source 15
Version, contamination, release gate (AC5) Does not meet AC5 The manifest passes the gate but the changelog lacks real reasons or forgets the PII exemption The gate passes, the diff and bump are right, contaminated cases are removed with reasons, the dev/test split does not leak As level 2, finds the near-duplicate pair on both sides and handles it in a principled way, names the case flagged at threshold 0.3, and states clearly what the gate does not check 25
Reproduction and notes (AC6) Does not meet AC6 Files generated by hand or the seed/configuration is missing The script generates every file, a rerun produces exactly the same files, has tests As level 2, the tests catch a deliberate bug (for example changing the version bump), decisions.md is honest that every number is simulated 10

Each dimension's score = (level reached / 3) × weight. Mapping to the module: practical = Coverage + Synthetic data + Reproduction (45); applied QA analysis = Labelling + Version and release gate (40); conceptual understanding = Sources and privacy (15).

Hints

Hint 1: planted PII and detection rateEvery log record has `pii_truth`, the list of PII types that were planted in the message. Compare it with `pii.find(text)` to see which types are detected; `address` and `spelled_phone` are the two types the screener was not designed to find.
Hint 2: finding empty cells and choosing messages in a cell`coverage.matrix(..., row_values=list(system.INTENTS), col_values=list(system.STYLES))` lists the 0 cells as well. Filter the log by the `intent` and `style` of the cell, read the messages, and pick by hand. The id of a case taken from the log is `log_id`. Run `pii.redact` on the question and copy the result into `new_cases.json`.
Hint 3: items where both agree but the final label differs`labeling.resolve` asks for adjudication only for items where the two annotators **disagree**. For items where they agree, the final label is the shared label, even if `gold` differs. Compare `resolve(...)` with `gold` over all 80 items.
Hint 4: dev/test split and near-duplicate pairs`split_of` looks only at the id, so two near-identical cases can still land on opposite sides. After splitting, run `split_leaks(dev, test, 0.8)`; for each pair, move the later id to the same side as the earlier id, then rerun until no pairs are left. Record the ids that were moved.
Hint 5: order of assembling the releaseRemove the contaminated cases first, because the `existing_texts` of the synthetic-data filtering step is taken from the draft **after removal**. Then add the log cases and the synthetic cases, and only then compute the diff, the fingerprint and the dev/test split.

Independent challenge (practical challenge)

Less guidance. You do not need to run the tutor; use lab.coverage, lab.labeling and lab.versioning to compute.

Context: ThuQuan (fictional) is a chatbot that answers students about a library's borrowing rules. The fictional log has 2,000 messages over 60 days, by five intents: borrow 1,100, renew 520, fines 260, student_data 50 (students send a student ID or a phone number, high risk), complaint 70. About 30% of messages are typed without diacritics. The budget for the first release is 120 cases and two annotators.

Tasks:

  1. Write a source plan for ThuQuan (three sources, shares, sampling method, known biases, privacy notes) and say how you handle the following three kinds of personal data (redact, pseudonymise or exclude) and why: the student ID in a message, the student's phone number, the dormitory address.
  2. Choose at least two dimensions for the coverage matrix and say why each one changes behaviour. Allocate the 120 cases across the five intents in proportional mode and with floor at a floor of 10. Compute the probability that a random sample of 120 messages misses the student_data group entirely, the smallest number of messages for that probability to be at most 0.05, and the expected number of student_data cases in a random sample of 120 messages. Conclude: is a random sample enough for that group?
  3. An equal sample of 24 cases per intent gives the pass counts (pass, n): borrow (22, 24), renew (21, 24), fines (19, 24), student_data (14, 24), complaint (17, 24). Compute the overall pass rate (every case equal) and the pass rate weighted by the log's shares. Which one is more trustworthy for the whole log, and what is it missing?
  4. Two annotators label 12 items ok or bad (the table below). Compute raw agreement, chance agreement, the confusion matrix and the disagreeing items. Write two borderline-case rules concrete enough to resolve one kind of disagreement you see in the data (assume you can see the content), and say who adjudicates and where it is recorded.
  5. Release: the dataset is at 1.4.2. Compute the next version for three scenarios: (a) add 5 cases, remove 1, change the expectation of 2, change the tags of 3; (b) only add 5 cases; (c) only change the tags of 3 cases. Run the contamination check (n = 4) for the four cases below at thresholds 0.5 and 0.3 and state your decision for each case. Split the ids T01-T08 with salt="thuquan", dev_share=0.5; if T09-T11 are added, does the side of T01-T08 change?
  6. Write a three-sentence paragraph for the library manager, who only wants to hear "is this dataset usable yet".

Data for task 4 (items 1-12; each row is the label of annotator A and annotator B):

Item 1 2 3 4 5 6 7 8 9 10 11 12
A ok ok bad ok bad ok ok bad ok bad ok ok
B ok bad bad ok ok ok ok bad bad bad ok ok

Data for task 5 (the prompt has two few-shot examples; four cases of the dataset):

Ví dụ 1: Sinh viên mượn tối đa 5 cuốn sách trong 14 ngày.
Ví dụ 2: Muốn gia hạn sách, bạn đăng nhập tài khoản thư viện và chọn nút gia hạn.

T01: Sinh viên mượn tối đa 5 cuốn sách trong 14 ngày.
T02: Em là sinh viên năm nhất, mượn tối đa 5 cuốn sách trong 14 ngày có đúng không ạ?
T03: Muốn gia hạn sách thì làm sao? Tôi cần đăng nhập tài khoản thư viện và chọn nút gia hạn đúng không?
T04: Phạt trả sách muộn là bao nhiêu mỗi ngày?

Separate rubric (100 points, pass at ≥ 70):

Dimension 0 1 2 3 Weight
Sources and privacy Missing The plan lacks biases or handles PII one way for every type The plan has all fields; each PII group is handled with a reason As level 2, states which types the screener may miss and proposes a manual review step 15
Coverage and sampling Missing Dimensions without reasons, or wrong numbers Dimensions with reasons, four correct numbers (two allocations, miss probability, n for 0.05) As level 2, recognises that the miss probability is small but the expectation is only a few cases, so a floor is needed; compares the two estimates correctly and states what the weights do not give (a confidence interval) 30
Labelling Missing Reports only raw agreement Raw and chance agreement correct, lists the disagreeing items As level 2, two concrete borderline-case rules and a recorded adjudication process 20
Version and contamination Missing Wrong bump in one scenario Three bumps correct, contamination correct at both thresholds As level 2, explains why T02 and T03 are not caught by the gate but still deserve a look, and that the hash split does not change sides when ids are added 25
Communication Missing The paragraph only says "yes" or "not yet" The paragraph states the decision and the reason As level 2, honest about what is unknown and does not confuse simulated numbers with real behaviour 10

Rules

  • Do not use real data or a real API in your submission. The phone numbers, names and IDs in the data are all made up; do not call or message them.
  • Do not edit lab/, data/ or exercises/. Proposed changes go in notes/decisions.md.
  • Do not lower a threshold, exclude more than two cells, or drop a PII exemption to make the release gate pass.
  • Every number in the reports comes from a script; state the seed and the configuration.
  • Vietnam's data protection law has not been confirmed; every statement about a legal basis is an assumption that needs confirmation from legal counsel.