Evals and quality Required
Grade with code before a grading model
Grade every quality that code can check with exact code checks. Use a grading model only for qualities code cannot check, and only after it agrees with people on at least 80 of 100 labelled cases.
How to do it
Check the schema, enum values, required facts, forbidden phrases, citations and length in code. They are fast, free and never vary. For tone or helpfulness, write a grading prompt with a fixed rubric and a yes or no answer, not a score from 1 to 10. Have two people label 100 answers, then measure how often the grading model agrees with them. Use a different model, or at least a different prompt, from the one being graded.
Example
export function gradeReturnAnswer(answer: ReturnAnswer, expect: Expectation): string[] {
const failures: string[] = [];
if (answer.eligible !== expect.eligible) failures.push(`eligible was ${answer.eligible}, expected ${expect.eligible}`);
for (const fact of expect.mustMention ?? []) if (!answer.reason.toLowerCase().includes(fact)) failures.push(`missing "${fact}"`);
if (/\bguarantee(d)?\b/i.test(answer.reason)) failures.push('promises a guarantee');
return failures;
}
def grade_return_answer(answer: ReturnAnswer, expect: dict) -> list[str]:
failures = []
if answer.eligible != expect["eligible"]:
failures.append(f"eligible was {answer.eligible}, expected {expect['eligible']}")
failures += [f'missing "{fact}"' for fact in expect.get("must_mention", []) if fact not in answer.reason.lower()]
if re.search(r"\bguarantee(d)?\b", answer.reason, re.I):
failures.append("promises a guarantee")
return failures
How to check
Each eval case has at least one code check. The grading model's agreement with the human labels is stored and is at least 0.8.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers ai features playbook: https://agentwranglers.se/playbook/ai-features/evals-and-quality/code-graders-first.