方寸 Portal

AI Engineer Portal

Your personal operating system for career transition.

Private mode

Exercise

Build a human-in-the-loop annotation queue

Build a Human-in-the-Loop Annotation Queue

Automated evaluation is fast but imperfect. An annotation queue routes only the cases where human judgment adds the most value: borderline scores, judge disagreements, and new failure modes.

What to build

Implement AnnotationQueue:

  1. enqueue(case_id, prediction, reference, auto_score, priority="normal") — Priority: "high", "normal", or "low". Raises ValueError if case_id already exists.

  2. next_for_review(reviewer_id) -> dict | None — Returns highest-priority unreviewed case (high > normal > low, then FIFO), marks it "in_review". Returns None if empty.

  3. submit_review(case_id, reviewer_id, human_score, notes="") -> dict — Records score, marks "reviewed". Returns {"case_id", "auto_score", "human_score", "delta", "agrees"} where agrees = abs(delta) <= 0.2.

  4. stats() -> dict — Returns {"total", "pending", "in_review", "reviewed", "agreement_rate"}.

Constraints

  • Standard library only. Use time.time() for enqueue timestamps.

Evaluation / hard / Step 21 of 36

Practice stage

Evaluation and review loops

Hint

Separate the scoring logic from the interpretation logic. Your goal is not just a number; it is a useful next action.

Success criteria
  • - Produces a useful signal, not decorative output
  • - Makes regression review easier
  • - Would support a benchmark or observability loop
Review checklist
  • - 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.