Running the Benchmark
Start the server
The script talks to http://127.0.0.1:9931 by default. For example:
llama serve -m model.gguf --port 9931 -c 32768
Use a context of at least 28672 tokens with the default --max-tokens (answer cap plus 4096 for the prompt). With a smaller one the script warns that long answers will be cut off.
Run
python3 codebench.py # one answer per task
python3 codebench.py --runs 3 # three answers per task: mean and standard deviation
With a single run, differences of a few points are sampling noise. Use --runs 3 or more, and the same number of runs for every model you compare.
Another address or an API key
python3 codebench.py --url http://127.0.0.1:8080
python3 codebench.py --api-key YOUR_KEY # or set LLAMA_API_KEY
Sampling and requests
Configure the model on the server. By default the script sends only the seed (base seed plus the run number) and the token cap. Overrides are sent only when you ask for them:
python3 codebench.py --temperature 0.2 --top-p 0.9
python3 codebench.py --extra-json '{"reasoning_effort":"high"}'
python3 codebench.py --system "You are a careful programmer."
python3 codebench.py --seed 42
Limits per answer
--max-tokens(default 24576): token cap, reasoning included.--task-timeout(default 1800): wall-clock cap in seconds.- Loop detection: an answer that keeps repeating the same text is stopped early and marked
loop. Disable it with--no-loop-detection.
Slow machines
--time-scale multiplies the time limits of the tests:
python3 codebench.py --time-scale 1.5
Running only some tasks
python3 codebench.py --list # task ids, languages, categories
python3 codebench.py --only sql,java_ --out experiments
--only takes task ids or parts of them, separated by commas.
A run made with --only is marked as incomplete: its score covers only the tasks it answered. --compare prefers the latest complete run of each model, so a partial experiment does not replace a full run in the ranking. To answer the remaining tasks later, use --resume on the same folder without --only.
Missing toolchains
If a toolchain is missing, the script stops and shows what to install. With --skip-missing it skips those languages instead; the result is marked incomplete and is not comparable with full runs.
Other options
--name: model name used in reports and folder names (default: taken from the server).--keep-work: keep the build folder of every answer, to inspect it (not for SQL).