Walkthrough
Build it yourself, part by part.
You want to know whether the cheaper model is good enough for your task, or whether last week's prompt change helped. The honest way is to run the same tasks past each one and count.
Two things spoil that count. Code a model wrote should not run on your laptop, and a machine that already has leftovers from the last run is not a fair test. So each model gets a clean machine, set up identically, and the tests run there.
-
A task is a request and the tests it must pass
Each task is a sentence asking for something and a few lines that check the answer. There is no judging by eye and no second model grading the first: the tests pass or they don't.
tasks.json
{ "name": "intervals", "prompt": "Write merge(intervals) that merges overlapping [start, end] lists and returns them sorted by start.", "test": "from solution import merge\nassert merge([[1,3],[2,6],[8,10]]) == [[1,6],[8,10]]\nassert merge([]) == []" } -
Judge one model on one clean machine
For a model, start a sandbox from the template and wait for it to be ready. Then, task by task: ask the model for a solution, put it on the machine beside its tests, run them, and write down pass or fail from the exit code.
The tasks run one at a time on purpose, so each has the machine to itself and a slow one can't make another time out.
evals.mjs
async function judge(model) { const sb = await annex.start({ template: 'evals' }) try { await annex.ready(sb.id) const row = { model } for (const task of tasks) { // one at a time: each gets the machine to itself const dir = `/tmp/${task.name}` await annex.run(sb.id, `mkdir -p ${dir}`) await annex.upload(sb.id, `${dir}/solution.py`, (await solve(model, task)) || 'raise SystemExit("no answer")') await annex.upload(sb.id, `${dir}/test.py`, task.test) const r = await annex.run(sb.id, 'python3 test.py', { cwd: dir, timeout: 60 }) row[task.name] = r.exit_code === 0 ? 'pass' : 'FAIL' } row.score = `${tasks.filter((t) => row[t.name] === 'pass').length}/${tasks.length}` return row } finally { await annex.stop(sb.id) } } -
All the models at once
Each model's run is independent, so they all go at the same time, one sandbox each. You get a table with a row a model and a column a task.
evals.mjs
const rows = await Promise.allSettled(models.map(judge)) // one sandbox a model, side by side console.table(rows.map((r) => r.value))
Before you rely on it
- Five tasks show the shape; they don't compare models. Use your own tasks, enough of them, and more than one run.
- Whatever your tests need goes in the template, so every machine has exactly the same.
- The example asks each model directly, with no fallback to another: an eval should score the model it names.