Code-based checks
A model-graded eval says your invoice extractor is "92% helpful". A ten-line Python check says 31 of 400 outputs aren't valid JSON, and 12 have a total that doesn't equal the sum of the line items. Whenever a property can be checked with code, check it with code. It's exact, instant, free, and it never has an off day.
In this lesson you'll learn to
- Use the main kinds of code checks (exact and normalised match, regex and contains, schema validation, numeric tolerance, and running generated code) and pick the right one for a criterion.
- Write property checks that need no reference answer, such as length limits, required fields, consistency between fields and banned content.
- Run checks as a test suite over the test set, with per-check pass rates rather than one combined score.
- Recognise when code checks are too strict or too loose, and when a criterion needs a model judge instead.
Create a free account to open this lesson
It's free. You'll get every free lesson, quizzes that save your progress, daily flashcards and streaks.