Skip to main content
HS
HiSETSuccess
LeetCode Prep

AI & FDE Interview Room

Role paths, mocks, cost studio, chapters, cases, and staff-level depth.

Case study · Architect · 35 min

Offline + Online LLM Eval Harness

Create a continuous evaluation system that gates prompt and model changes with golden sets, LLM-as-judge, and online metrics.

evalsCIquality

Interview opener

Design the eval harness that gates production prompt/model changes.

  1. 1.LLM-as-judge disagrees with humans — now what?
  2. 2.How large a golden set for the first gate?
  3. 3.Online vs offline metrics — which blocks the deploy?

Strong signals

Hit 0/3

Weak signals (avoid)

  • Only thumbs-up in production
  • Uncalibrated LLM judge as sole truth

Requirements

  • Functional: golden Q&A sets; rubric judges; regression CI gate; online shadow eval
  • Non-functional: full suite < 20 min; deterministic seeds; versioned datasets
  • Coverage: faithfulness, relevance, toxicity, tool-correctness, latency/cost
  • Scale: 5 products × 2,000 cases; 10 PR runs/day

Back-of-envelope Estimation

MetricCalculationResult
Cases/run2,0002,000
Tokens/case3K in + 500 out + 1K judge4.5K
Tokens/run2K × 4.5K9M
Cost/run @ $2/1M9M × $2/1M~$18
CI cost/day10 × $18~$180
Judge disagreement audit5% human review100 cases/run

API Design

EndpointMethodDescription
POST /v1/evals/runsPOST{ suiteId, candidateConfig } → run_id
GET /v1/evals/runs/{id}GETScores, diffs vs baseline
POST /v1/datasetsPOSTUpload versioned golden JSONL
POST /v1/online/shadowPOSTLog production sample for offline replay

Data Model

EntityKey fieldsNotes
datasetsdataset_id, version, hash, schemaImmutable versions
casescase_id, input, expected, rubricsSupports multi-turn
runsrun_id, config_hash, scores_json, costCompare to baseline run
judgmentsjudgment_id, case_id, judge_model, scoreStore rationales

High-level Design

CI gate flow
PR → CI → Load dataset@v → Run candidate pipeline
                 → Metrics (exact / rubric / LLM judge)
                 → Diff vs main baseline
                 → Pass if Δfaithfulness ≥ −1pt AND toxicity not↑
                 → Publish report artifact

Prod → sample 1% → shadow store → nightly replay vs new prompts

Deep Dive: LLM-as-Judge Bias

  • Use pairwise judgments with position swap to reduce order bias
  • Calibrate judge against 200 human-labeled cases quarterly
  • Separate reference-free (faithfulness) from reference-based (exact slot fill)
  • Never let the candidate model judge itself

Bottlenecks at Scale

  • Judge API rate limits — shard cases; cache identical prompts
  • Flaky nondeterminism — temperature 0 + seed; retry on schema fail
  • Suite runtime — parallel workers; smoke suite on every PR, full nightly

Failure Modes & Monitoring

SLOTargetAlert
CI suite runtime< 20 minWarn if > 30
Judge–human kappa> 0.6Quarterly review
False gate fails< 5%Track engineer overrides
Online quality drift< 3pt weeklyPage product owner

Attempt the case aloud first. Then unlock a staff model answer outline.