Sub topic 2
Define the task and what counts as success
This chapter assumes you can call an LLM API, read and write JSON, and compute a proportion in Python. You do not need an existing dataset. Defining the task comes first, because every later choice depends on it: the case schema, the sources, the labels, and the graders.
Start from a task statement
"The app works" cannot be tested. A task statement says what goes in, what comes out, and who uses the result. Write it in one or two sentences.
Vague: "A support bot that answers customer questions."
Specific: "Given a customer question and the current returns policy, reply with an answer that states the policy correctly, in under 80 words, without promising anything the policy does not allow."
The specific version names the input, the output, and the constraints. Each constraint can become a check.
Turn goals into criteria you can check on one case
A success criterion is a statement that you can judge as pass or fail on a single case. If you need to look at many outputs to decide, it is a goal, not yet a criterion.
| Goal (too broad) | Criterion (checkable per case) |
|---|---|
| Answers are accurate | The answer's return window matches the reference (30 days) |
| Answers are safe | The reply never offers a refund the policy forbids |
| Answers are concise | The reply is at most 80 words |
| The bot is helpful | The reply addresses the question that was asked, as judged against a rubric |
Good criteria have three properties:
- They are observable from the input, the output, and a reference.
- They are binary or have a small scale, such as pass/fail or 1 to 3.
- Two people reading the same case would reach the same verdict.
The last property is tested later, when you measure annotator agreement. A criterion that fails that test needs rewording.
Separate hard requirements from quality
Some criteria are hard requirements. A single failure is a defect, such as leaking a customer's data or inventing a policy. Others are quality dimensions, such as tone or brevity, where you accept some misses. Record which is which. Hard requirements usually get their own tag and are reported separately, so a good average cannot hide them.
Decide what is out of scope
Say which inputs the app should refuse or redirect, such as medical advice or questions in unsupported languages. Out-of-scope inputs are still test cases. The correct behavior is the refusal. If you leave this undefined, you cannot grade those cases later.
Write the definition down
Keep the definition in a small file next to the dataset so it is versioned with it.
TASK = {
"statement": (
"Answer a customer question about returns using the current "
"policy, in at most 80 words, without promising anything the "
"policy forbids."
),
"criteria": [
{"name": "policy_correct", "kind": "hard",
"check": "Stated facts match the reference answer"},
{"name": "no_false_promise", "kind": "hard",
"check": "No refund or exception the policy forbids"},
{"name": "concise", "kind": "quality",
"check": "At most 80 words"},
],
"out_of_scope": ["medical advice", "legal advice"],
}
def word_count_ok(output, limit=80):
return len(output.split()) <= limit
print(len(TASK["criteria"]), word_count_ok("No. Returns are accepted within 30 days."))The concise criterion is already code-checkable. The other two need a reference or a rubric, which later chapters cover.
Common errors
- Writing criteria that need the whole dataset to judge, such as "most answers are friendly".
- Defining success by what the current prompt already does, which makes the eval confirm the status quo.
- Leaving out-of-scope behavior undefined.
- Using one criterion for two things, such as "accurate and concise". A failure then does not say which one failed.
Exercise
A team's goal is "the summarizer should be faithful and short." Rewrite it as two criteria that can each be judged pass or fail on one case, and say which one is likely a hard requirement.
Show answer
Faithful: "Every claim in the summary is supported by the source text" (hard requirement, since an invented claim is a defect). Short: "The summary is at most 60 words" (quality dimension, checkable with code). Each is judged on a single case, and they are kept separate so a failure shows which one broke.