Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

These exercises practice retrieving what the Module 7 reading explained. They aren’t graded. Work each one on paper first, then check your answer, and only then confirm it with code from Lab 7 if you like. Every case, label, and score here is illustrative, written for the course. The answers are in the collapsed blocks; open one only after you have an answer of your own.

Worked example: a criterion for evidence and an answer

Module 6 asked the dispatcher for two sections, <evidence> and <answer>. Write a measurable pass criterion for that reply.

A criterion is measurable when code, or a person following written rules, can apply it the same way every time. Name each condition, then the threshold:

  1. The reply contains exactly one <evidence> section and exactly one <answer> section, and nothing outside them but whitespace.

  2. The evidence, with surrounding whitespace stripped, appears exactly in the ticket.

  3. The answer is repair, billing, or account, and it equals the case’s expected label.

  4. At least 90% of held-out cases pass all three conditions, a threshold written before the final run.

“The evidence should support the answer” isn’t on the list, because two readers could disagree about it. If it matters, it needs a rubric and a grader checked against human labels.

Exercise P7.1 (LO-7.1, ★, about 10 minutes)

Write a measurable pass criterion for a one-line routing answer that can abstain.

Hint

Specify allowed labels and the condition for abstention.

Another hint

Decide who says a ticket is ambiguous, and when: the model, or the person who labels the case.

Answer

Require one exact line. For an ambiguous ticket, require Label: unknown. For a clear ticket, require the annotated queue.

In full: the reply is exactly one line, Label: <queue>, where the queue is repair, billing, account, or unknown. Each case’s expected label is set by the person who labels it, and unknown is expected only for tickets that person judged ambiguous. The reply passes when its label equals the expected one. Then add a threshold, set before the final run.

The common mistake is a criterion that lets the model decide what is ambiguous, such as “abstain when unsure”. A prompt that answers unknown to everything would then pass every case it found hard. Fixing the expected label per case makes abstaining on a clear ticket a failure. Report the abstention rate on clear tickets separately, so that failure is visible.

Worked example: kappa with unequal pass rates

A person and a model grader judge 10 replies. Both pass 5, the person passes 2 that the grader fails, the grader passes 1 that the person fails, and both fail 2. What are the percent agreement and kappa?

  1. Observed agreement: they agree on 5 + 2 = 7 of 10, so 0.7.

  2. Pass shares: the person passes 5 + 2 = 7 of 10 (0.7), and the grader 5 + 1 = 6 of 10 (0.6).

  3. Expected agreement: both pass by chance 0.7 × 0.6 = 0.42 of the time, and both fail 0.3 × 0.4 = 0.12 of the time, so 0.42 + 0.12 = 0.54.

  4. Kappa: (0.7 − 0.54) / (1 − 0.54) = 0.16 / 0.46 ≈ 0.35.

Agreement of 70% is only modestly better than the 54% that chance would give, and kappa shows it. Read the three disagreements before trusting this grader.

Exercise P7.2 (LO-7.2, ★★, about 15 minutes)

You agree on 8 of 10 items and each grader passes exactly 5. What is kappa?

Hint

Chance agreement is 0.5 × 0.5 plus 0.5 × 0.5.

Answer

Observed 0.8, chance 0.5, kappa (0.8 − 0.5) / 0.5 = 0.6.

Each grader passes 5 of 10, a share of 0.5. Two graders with those shares, labeling independently, would both pass 0.5 × 0.5 = 0.25 of the time and both fail 0.25 of the time, so chance agreement is 0.5. Kappa takes the agreement beyond chance, 0.8 − 0.5 = 0.3, as a share of the most there could be, 1 − 0.5 = 0.5.

A common mistake is counting only the chance that both pass, 0.25, which gives (0.8 − 0.25) / 0.75 ≈ 0.73. Agreeing to fail is agreement too. Another is reporting the 0.8 as if it were kappa.

Worked example: reading a paired difference

On one case, prompt A passes two of three runs and B passes all three. That case contributes +1/3 to the paired comparison: B’s score, 1, minus A’s, 2/3. Keep all six results together when resampling, because they share one ticket.

Now suppose 30 such case differences give an estimate of +0.12, with a 95% paired bootstrap interval from +0.02 to +0.22. The interval excludes 0, so on these cases B is better than A. How much better is uncertain: anywhere from 2 to 22 runs in 100 is plausible. Report the estimate and the interval together, and say what the cases were, so a reader knows what they describe.

Exercise P7.3 (LO-7.3, ★★, about 15 minutes)

You see a difference of +0.03 with interval −0.04 to +0.10. What can you conclude?

Hint

The interval crosses zero.

Answer

The point estimate favors B. The interval includes both an improvement and a loss, so the comparison is inconclusive.

Values from 4 runs in 100 worse to 10 better are all plausible on these cases. Neither “B is better” nor “they are the same” follows. To tell the two apart, add independent cases. More runs of the same cases help less: they steady each case’s score, but they add no new tickets.

The common mistake is reporting “B improves by 3 points” because +0.03 is positive. Another is concluding the prompts are equal; the data allow a real 10-point gain.

Worked example: choosing on the held-out set

You have two prompt versions and can’t decide between them on the development cases. You run both on the 10 held-out cases. Version 1 passes 9 and version 2 passes 8, so you ship version 1 and report 9 of 10.

That report is biased. The held-out run chose the winner, so it was used as development data, and the winner’s score includes the luck that made it win. The reading’s best-of-five example shows how large that luck can be. Report that the held-out set was used to choose. Then collect fresh cases and run version 1 on them once, and report that score as the estimate.

Exercise P7.4 (LO-7.4, ★★★, about 25 minutes)

You inspect holdout errors, add matching examples, and rerun the same split. How should you report it?

Hint

Ask which data influenced selection.

Another hint

The new examples were written to match the cases they will be scored on.

Answer

Treat that split as development and disclose the reuse. Gather fresh held-out cases.

The added examples were chosen because of those exact held-out errors, so the prompt now fits that split. A rerun on it will likely improve whether or not the prompt got better on new tickets, so its score no longer estimates performance on them. Say in the report that the split was inspected and used to revise the prompt, and report its new score as a development result. Then estimate the final version on cases it has never seen.

A common mistake is reporting the rerun as the held-out result because the split’s name hasn’t changed. Another is thinking a small change is harmless. Even a few examples copied from the failing cases can fix exactly those cases and nothing else.