AI Engineer Portal
Your personal operating system for career transition.
Exercise
Build a regression test suite for LLM outputs
Build a Regression Test Suite for LLM Outputs
A regression suite catches when a change makes previously-passing cases fail. It focuses on non-negotiable behaviors the system has already demonstrated correctly.
What to build
Implement RegressionSuite:
-
add_case(case_id, input, expected_patterns, forbidden_patterns=[], tags=[])—expected_patternsmust appear (case-insensitive).forbidden_patternsmust not appear. -
run(generate_fn: Callable[[str], str]) -> dict— Returns{"passed", "failed", "total", "pass_rate", "failures", "by_case"}.failuresis a list of{"case_id", "missing_patterns", "found_forbidden"}.by_caseis{case_id: bool}. -
diff_against_baseline(current, baseline) -> dict(static method) — Comparesby_casedicts. Returns{"new_failures", "new_passes", "unchanged"}. -
filter_by_tag(tag) -> "RegressionSuite"— Returns new suite with only matching-tag cases.
Constraints
- Standard library only.
Evaluation / hard / Step 23 of 36
Evaluation and review loops
Separate the scoring logic from the interpretation logic. Your goal is not just a number; it is a useful next action.
- - Produces a useful signal, not decorative output
- - Makes regression review easier
- - Would support a benchmark or observability loop
- - Would this output help decide what to fix next?
- - Are important failure modes visible?
- - Does the score hide any ambiguity I should record?
Practice
Generate a variation
Generate a new exercise variation to deepen understanding or practice a related concept.
Attempt history
Recent submissions
Before you submit, decide what a strong answer should make obvious to the reviewer.
No attempts yet.