|
|
||
|---|---|---|
| data | ||
| scripts | ||
| src | ||
| test | ||
| web | ||
| .gitignore | ||
| bun.lock | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
opencode-bench
Runs a set of LLM benchmarks against every free OpenCode Go model. Each task runs the host's opencode inside a Docker container. Results go to SQLite. A CLI and a dark web UI show progress, charts and past runs.
Requirements
- Bun 1.4 or newer
- Docker (the
python:3.12-slimimage is pulled on first use) opencodeon the host, inPATHor at~/.opencode/bin/opencode
Long runs
scripts/monitor.sh <run> [concurrency] [interval] keeps a run going in a tmux session named bench-run-<run> and logs progress, running containers and free disk space to data/monitor-<run>.log. If the session dies with tasks left, it starts the run again, at most once every 15 minutes. Start it in tmux too:
tmux new -d -s bench-monitor 'scripts/monitor.sh 2 8'
tmux attach -t bench-run-2 # watch the run
Public link
scripts/tunnel.sh [port] opens a free Pinggy tunnel to the read-only server (BENCH_READONLY=1 bun src/cli.ts serve --port 3056, which refuses every request that is not a GET). Free tunnels last 60 minutes, so the script opens a new one each time the old one stops. It writes each address to data/tunnel-url.txt and data/tunnel.log.
BENCH_READONLY=1 tmux new -d -s bench-public 'bun src/cli.ts serve --port 3056'
tmux new -d -s bench-tunnel 'scripts/tunnel.sh 3056'
cat data/tunnel-url.txt
Usage
bun install
bun src/cli.ts models # free `opencode-go/*-free` models, discovered from `opencode models`
bun src/cli.ts benchmarks
bun src/cli.ts run --name first # all models, all benchmarks
bun src/cli.ts run --detach --limit 3 # background run, 3 tasks per benchmark
bun src/cli.ts status --watch # live progress of the latest run
bun src/cli.ts index --run 1,2 # intelligence index table
bun src/cli.ts serve --port 3000 # web UI
runs, resume <id>, cancel <id> and results are also available. index, results and status accept --run, --model and --benchmark filters (comma separated).
How a task runs
- The task's files are written to
data/artifacts/<run>/<result>/work. - A container starts with that directory at
/workand the hostopencodebinary mounted read-only. It runsopencode run --format json --auto -m <model> "<prompt>". - The JSON event stream gives steps (
step_finishevents) and tokens (input, cache, output, reasoning). - A second container with no network runs the task's Python grader against
/work. Exit code 0 scores 1. A finalSCORE: xline gives partial credit.
The container uses --dns 1.1.1.1 because Docker's default resolver fails on hosts that use systemd-resolved. Override with BENCH_DNS.
Benchmarks
| id | tasks | what it checks |
|---|---|---|
| humaneval-lite | 10 | Python functions against hidden unit tests |
| gsm-lite | 12 | math word problems with numeric answers |
| ifeval-lite | 10 | verifiable instruction constraints |
| logic-lite | 10 | short reasoning puzzles |
| agentic-files | 6 | debugging, refactoring, file transforms, search in a workspace |
| needle-long | 3 | one fact hidden in 400, 3000 and 12000 line files |
The -lite suites and agentic-files are compact and ship with the repo. The full public datasets download on demand:
bun src/cli.ts import humaneval # 164 tasks
bun src/cli.ts import mbpp # 500 tasks
bun src/cli.ts import gsm8k # 1319 tasks
bun src/cli.ts import mmlu # 1000 tasks, spread evenly over the 14042 test questions
bun src/cli.ts import arc # 1172 tasks, ARC-Challenge test split
bun src/cli.ts import bbh # 540 tasks, 20 from each of the 27 BIG-Bench Hard tasks
bun src/cli.ts import math # 500 tasks, MATH-500
bun src/cli.ts import ifeval # 510 tasks, the 541 prompts minus the 31 that ask for a response language
bun src/cli.ts import livecodebench # 175 tasks, release v6, up to 12 tests each
Imported datasets land in data/datasets/ and then show up in benchmarks and in the New run dialog. Use --limit to sample them. Answers are compared exactly, except MATH, which normalises LaTeX first, and IFEval, which uses ports of the original checkers with approximate word and sentence splitting. LiveCodeBench keeps at most 12 tests per problem. SWE-bench and the other suites that need a Docker image per task are not ported. Add a benchmark by exporting a Benchmark from src/benchmarks/ and listing it in src/benchmarks/index.ts.
Scoring
- Benchmark score: mean task score, 0 to 100. Tasks that failed for infrastructure reasons (container or API error) have no score and are left out. Timeouts are also left out of every score and average (index, time, tokens, steps). A model with timeouts or pending tasks counts as partial and is drawn striped.
- Intelligence index: mean of a model's benchmark scores. Benchmarks with no finished task yet are skipped, so the index of a running run is partial and moves as results arrive.
- Efficiency: average tokens, steps and seconds per scored task.
Web UI
Charts: intelligence index, index across runs, intelligence vs tokens, steps and time, task status, one chart per benchmark, and tokens, steps and time per task. The Run, Model and Benchmark filters apply to every chart and the results table, and live in the URL. The page refreshes when the runner writes to the database. "New run" starts a run from the browser.
Configuration
| variable | default |
|---|---|
BENCH_DB |
data/bench.sqlite |
BENCH_ARTIFACTS |
data/artifacts/ |
BENCH_IMAGE |
python:3.12-slim |
BENCH_DNS |
1.1.1.1 |
BENCH_TASK_TIMEOUT |
600 (seconds) |
OPENCODE_BIN |
opencode from PATH |
Tests
bun test
Checks that every grader fails on an untouched workspace and that event parsing sums tokens correctly.