AI Engineer Portal
Your personal operating system for career transition.
Exercise
Build a multi-metric eval pipeline
Build a Multi-Metric Eval Pipeline
Production evaluation rarely relies on a single metric. A useful pipeline runs several scorers in parallel, aggregates their outputs into a composite, and flags cases that fail any individual dimension.
What to build
Implement MultiMetricPipeline:
-
Constructor — accepts
scorers: dict[str, Callable[[str, str], float]]mapping metric name to scorer function. Optionally acceptsweights: dict[str, float](default: equal weight). -
run(cases: list[dict]) -> list[dict]— Each case has"input","response", and"reference". Returns per-case results:{"case_id", "scores": {metric: float}, "composite_score", "passed_all", "failed_metrics"}. -
aggregate(results: list[dict]) -> dict— Returns{"n", "avg_composite", "per_metric_avg": {metric: float}, "cases_failing_any": int}. -
worst_cases(results, n=5) -> list[dict]— Top n cases by lowest composite score, sorted ascending.
Constraints
- Standard library only. If a scorer raises, record score 0.0 for that metric and continue.
- Composite score = weighted average of individual metric scores.
passed_all = Trueonly when every metric score >= 0.7.
Evaluation / hard / Step 27 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.