Skip to content
twinnydotdevPublic

About

Tests local code completion models through twinny's own prompts, stopping rules and cleanup, by running the code they write

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

twinny completion benchmark

Tests local fill-in-the-middle models on what twinny would show you. It uses twinny's own code for the prompt, request, stopping rules and cleanup, then runs each suggestion against tests. Made by the twinny project. The tasks and test code were written with an AI model (Claude).

Scores describe one Ollama download of each model, Ollama 0.33.2 and twinny 4.3.25 together, not the models in general. Results: results/full/report.txt. Known problems: diagnostics/README.md.

Rules, set before any model was scored

  • 102 gaps in 24 modules (48 Python, 54 TypeScript), three rounds each, temperature 0.2 and no fixed seed.
  • The main score leaves out the 9 gaps in tasks/twinny-limited.json, where twinny 4.3.25 breaks the correct answer. All 102 gaps are reported too, before and after twinny's cleanup.
  • The 95% ranges resample whole modules. Models whose ranges overlap are not ranked.
  • Added after seeing the results: paired comparisons between neighbouring models, labelled as extra in the report.
  • If a model gets stuck on one token and the stream ends without a "done" message, that is its answer. Only other cut-off streams are retried. The loop handling was added after a small trial showed the problem, before the full run.
  • codegemma:7b-code is left out, not scored as zero: our copy wrote nonsense without twinny. starcoder2:7b is tested as twinny 4.3.25 sends it and as starcoder2:7b#raw, with raw: true.

Run it

You need Linux, Git, Docker, Python 3, Ollama, and Node 22 or later (run on Node 22.23.4). The benchmark runs code written by models. Each suggestion runs in its own locked-down container (see src/sandbox.mjs), but no sandbox is perfect, so use a machine you can afford to lose.

git clone https://github.com/twinnydotdev/twinny.git vendor/twinny
git -C vendor/twinny checkout "$(cat vendor/TWINNY_COMMIT)"
(cd vendor/twinny && npm ci)
ln -s vendor/twinny/node_modules node_modules
docker pull "$(cat SANDBOX_IMAGE)"
./build.sh
node src/stream-check.mjs     # checks how finished, looping and dropped streams are handled
node src/selfcheck.mjs        # must say "twinny-limited 9" and "problems 0"

Pull every model in models.json first (name#raw uses the same download as name). Close anything else using the GPU or Ollama, because the run unloads every model Ollama has loaded. Then:

node src/run.mjs results/mine       # set OLLAMA=http://host:port if Ollama isn't at 127.0.0.1:11434
python3 -I src/analyze.py results/mine

If it stops, run the same command again and it skips finished rows. It won't mix results from different code, models or settings, so always use a new folder. Don't reuse results/full, because your build of twinny's code won't match it byte for byte. analyze.py needs a complete run with the default settings. To get the published report from the saved results, run python3 -I src/analyze.py results/full (this also rewrites summary.json).

Files

Path What it is
tasks/ The modules. Gaps are marked ⟦answer⟧, and the tests come after @TEST.
results/full/quality.jsonl Every suggestion: the raw reply, the text before and after cleanup, and whether it passed
results/full/speed.jsonl, loads.jsonl Ollama's timings, plus GPU memory and context size each time a model was loaded
results/full/meta.json Model digests, quantization, templates and versions
hardware.json The GPU, driver and network setup
diagnostics/ Checks made before scoring. They don't count towards any score.
src/bracket-repro.cjs Shows the bracket bug on its own (run ./build.sh first)

Client-side times include the SSH tunnel between the test server and the GPU machine. They don't include twinny's default 300 ms pause after you type. Memory figures use each model's default context, so they aren't like for like.

Licence

MIT. twinny is not included in this repo: the setup steps download it, and it has its own licence. The replies in results/ and diagnostics/ were written by the models listed there, so check each model's own terms before reusing them.

About

Tests local code completion models through twinny's own prompts, stopping rules and cleanup, by running the code they write

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages