← Questions
Build an eval harness for local models served by Ollama
0
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI system design interview question asked in Mercor's technical phone screen, last asked Mar 2026. It tests llm evaluation, take-home and ollama.
A take-home: write an evaluation harness for a language model served locally through Ollama. It reads a dataset of test cases, sends each prompt to the model, scores the outputs, and writes per-case results and a summary report. Then explain its design and how you made it reliable and easy to extend.
Requirements
- Functional: read cases from a file (JSONL or CSV), each with an
id, aprompt, and optionally areference_answeror expected label; call the model through Ollama's HTTP API; capture the output, the model name, latency, errors and retry attempts. - Functional: compute metrics such as exact match for deterministic tasks, pass rate, average and percentile latency, and error rate; save per-case results and an aggregate summary.
- Functional: configuration for model name, timeout, retries, temperature and concurrency.
- Non-functional: a failed or slow call never stops the run; a re-run can resume; adding another backend (a hosted API, vLLM) needs only a new adapter.
Clarifying questions
- What tasks are in the dataset: classification with exact labels, short answers, free-form text?
- How should free-form answers be scored: normalized string match, a regex, a judge model?
- How many cases and how many models per run? Is comparing models side by side a goal?
- Must runs be reproducible (fixed seed, temperature 0, logged versions)?
What a strong answer covers
- Components: a dataset loader with validation, a
ModelBackendinterface (generate(prompt, params) -> Response) with an Ollama implementation, a runner, scorers as pluggable functions, and reporters. - The runner: bounded concurrency (a semaphore or worker pool), a timeout per call, retries with backoff for transient errors only, and every outcome recorded, including failures.
- Results written incrementally (one JSON line per case), so a crash loses nothing and a re-run skips finished ids.
- Metrics computed from the stored results, so scoring can change without calling the model again; the summary records the model, its version, parameters and dataset hash.
- Tests with a fake backend: timeouts, malformed responses, retries, and the metric math.
Follow-ups
- Add an LLM-as-judge scorer. How do you check that the judge agrees with people?
- Compare two models on the same cases and report whether the difference is significant.
- Ollama runs out of memory under your concurrency setting. How does the harness notice and adapt?
Where it's asked
- Mercor · Technical phone screen · Last asked Mar 202650 min · Technical screen, often without writing code
What it tests
llm evaluation · take-home · ollama
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
