Skip to content

How the benchmark works

The benchmark sends the same questions to Engineering Corpus and to public code search tools, then scores the files each one returns. The method says what is asked, how each tool is called, who judged the answers and how the scores are computed, so you can rerun it and check the numbers.

The scores are on the results page, each with the date of the run it belongs to, so the method stays true when the scores change.

Each query is a question a developer would ask an agent, such as “sign a value with HMAC and verify the signature”. A query names the repo where its answer lives and the files that answer it. A tool does well when those files come back near the top.

Three scores, all at file level, averaged over the queries a tool answered:

  • Recall@20 is the share of the relevant files that appear in a tool’s first 20 results.
  • nDCG@10 says how high the relevant files rank in the first 10. A relevant file at rank 1 counts for more than one at rank 10.
  • MRR is 1 divided by the rank of the first relevant file.

A fourth number says what an answer costs an agent: tokens per relevant hit. It is the tokens of all the answers a tool gave, as an agent reads them, divided by the number of relevant files those answers put in their first 10. Tokens are counted with the o200k_base encoding of tiktoken, which gives the same count on every machine once its file is cached. It counts Claude’s tokens only roughly, so the report names the unit “o200k_base tokens”. The number exists for Engineering Corpus, searchcode and GitHub code search. Sourcegraph is asked for file names alone, so its row shows n/a.

The report also gives each tool’s median (p50) and 95th percentile (p95) latency. Latency is the round trip of each request from the machine that ran the benchmark. Engineering Corpus runs as a local stdio server and the other tools answer over the network, so the latency columns do not compare speed like for like.

  • 133 queries over 12 pinned repos: 85 how-to, 16 config-docs, 14 identifier, 10 turkish and 8 cross-repo.
  • Track A is the first track. It keeps the 124 queries whose relevant files live in one repo and asks each tool inside that repo. The 8 cross-repo queries and one translated query whose answer spans three repos belong to track B, which is scored apart. Its results are in the engine repository’s eval/benchmark/README.md (lines 107 to 153), public from the release, and the results page does not draw them.
  • The Turkish queries go to every tool in their English translation, the way an agent translates before it searches. The engine is English only. In track A they form the stratum turkish-translated, with 9 queries.

The strata are reported next to the means, so no average hides one: how-to 85, config-docs 16, identifier 14 and turkish-translated 9. The query files are eval/bakeoff_gate.toml and eval/bakeoff_turkish_en.toml, and the pinned commits are in bakeoff/corpus.toml.

Some of our ranking settings were chosen on the 133 queries, so a second set checks them, and the results page leads with it.

  • 58 queries over 13 pinned repos, none of them among the 12 repos of the 133 queries. They are in eval/heldout_queries.toml, and the script that builds the file checks every proof against the pinned clone.
  • The queries were fixed before any ranking change was measured on them, and none comes from the engine’s list of misses. 24 are phrased from the topic of a public issue (the topic is the reporter’s, the question a paraphrase), 5 from a documentation index and 29 from the file layout. eval/heldout_sources.json names the source of each one.
  • Ours, GitHub code search and searchcode were asked all of them, the last two in keyword form. Sourcegraph is not measured on this set.
  • The labels are the proofs plus one grade from 0 to 3, given by Claude Sonnet to each file that ours, GitHub code search and searchcode returned in their first 10. A file graded 2 or 3 is relevant.
  • Files no judge has graded count as not relevant, and grading them could move any tool’s score either way. The judges graded each tool’s first 10 files, so unjudged@10 counts the ungraded files in the 10 that nDCG@10 and MRR read, and unjudged@20 those in the 20 that Recall@20 reads.
  • GitHub code search and searchcode search the upstream HEAD, and the labels are at the pinned commit. A file they return that did not exist at the pin counts as not relevant. The post-pin upper bound counts every such file in the first 20 as relevant, for those two tools only: it is the most the rule can cost them. One query’s proof is gone at HEAD, so every score is also given on the 57 queries whose proofs are all there.
  • The queries, the proof files with the place each was found, the judge’s grades (files and grades only, no text), each tool’s answers in rank order and the files the other two tools returned that did not exist at the pinned commit are in the repository: eval/heldout_queries.toml, eval/heldout_sources.json and eval/benchmark/held-out/, which also holds the day of the grades and the judge. The recorded figures are in eval/benchmark/sources/held-out-score.json. To recompute them, run python -m engineering_corpus.bench.held_out from the engine repository’s folder, inside its virtual environment. It needs no model and no network, takes about six seconds on a 16 GB Apple M2, and prints 58 queries, 916 graded files, graded 2026-11-13 and then a line for each tool with its Recall@20, nDCG@10 and MRR. corpus bench runs track A, the 124 queries.

A change to ranking, or to which files and chunks are indexed, is scored on the tuned set before it ships: the 124 queries of track A over 12 repos, which some of our ranking settings were chosen on. The engine before the change is the baseline. A fall of Recall@20 or nDCG@10 in the mean, or in any of the four strata, keeps the change out. This is the track A gate. Because those queries were used for tuning, the gate says a change did not make that set worse; whether a change helps elsewhere is what the held-out sets check. A smaller gate runs in CI on every change (CONTRIBUTING.md).

On 18 November 2026 the gate kept a change out of v0.1: heading-aware chunking, in which each Markdown chunk carried its heading path in the text that is embedded and searched. Measured on the tuned set against the build before it, nDCG@10 went from 0.8714 to 0.8697, with falls in all four strata, so the rule kept it out. Relevant Markdown files found in the first 20 results rose from 127 to 129 of 143 and Recall@20 from 0.9534 to 0.9538; the rule does not trade a fall for a gain. Files no judge graded count as not relevant, and their share of the first ten rose from 9.1% to 9.6%, so some of the fall may be files that are right; no judge round was run. The change is not in the released code, so this run cannot be repeated from the repository.

Tool How it is called What it searches
Engineering Corpus corpus_search over stdio, with k 20 and repos set to the query’s repo the pinned commit
searchcode its MCP server’s code_search, by the repo’s Git URL, 20 results the default branch
Sourcegraph the anonymous streaming search API, keyword mode, files only, the pinned commit in the repo: filter the pinned commit
GitHub code search its MCP server’s search_code with repo:owner/name, 20 per page, and a token in GH_TOKEN the default branch

grep.app and Context7 are left out. Their terms forbid a published benchmark without written permission, and they join only with it.

Each tool is asked one request at a time, at the pace its service allows: 6.5 seconds between requests for GitHub code search, 1 second for searchcode and 10 seconds for Sourcegraph. Engineering Corpus runs on the same machine and is not paced.

Sourcegraph is the one tool the harness retries. After an HTTP 429 or a 5xx it waits (the Retry-After it sent, else 30 seconds) and asks again. A second failure in a row, or a Retry-After longer than 120 seconds, stops the run, and the answers so far stay in the store. A failed call to any other tool is recorded as an error and the run goes on.

Every tool gets each query as written. The lexical tools (searchcode, Sourcegraph and GitHub code search) also get a keyword form. One fixed rule makes it from the query alone: drop English function words and generic code nouns, keep identifier-like words first and then the longest words, at most three terms, in the query’s order. Three terms, because lexical tools require every term to appear in the file. Nobody tunes a keyword query by hand and nothing looks at the answers. “Sign a value with HMAC and verify the signature” becomes HMAC verify signature.

A tool is scored on its better form: the form that answered the most queries, then the one with the higher Recall@20, then nDCG@10, then MRR. The answered count comes first so that a form cannot win on the few queries it happened to get answered. The report prints both forms for every tool.

GitHub code search and searchcode search the default branch. Engineering Corpus and Sourcegraph search the pinned commit. A query’s relevant files are paths at the pinned commit, so a file renamed or deleted since then cannot be found by its old path.

A separate check, python -m engineering_corpus.bench.drift, reads the commit searchcode names in its answers and maps each relevant file from the pinned commit to that commit with git diff -M. It lists the queries whose files were renamed, deleted or rewritten, and those queries stay in the scores.

A tool can return a file the query’s author never listed. Someone has to decide whether it also answers the question.

  • A file counts as relevant when the query lists it as a proof, or when a judge grades it 2 or 3 on a scale from 0 to 3.
  • The earlier rounds graded files that the bake-off’s arms returned. The arms are our own configurations. The judges are two language models, Claude Sonnet and Claude Haiku. A pair carries Sonnet’s grade, and where only Haiku graded a pair, Haiku’s grade stands. No Opus round took place, so no pair has the median of three grades.
  • The final round covers every tool’s answer, ours included. It has one judge, Claude Sonnet 5.5, and it grades the first 10 files of each answer, per query, that no earlier round had graded. Earlier grades stay. The report states that a single judge graded this round.
  • A returned file that no judge has graded and no query lists counts as not relevant. Unjudged@10 is the share of a tool’s first 10 files with neither a grade nor a proof. Grading those files could move any tool’s score either way: a relevant file a tool returned raises its own score, and a relevant file only another tool returned lowers the others’, because it joins the relevant set they are scored against. Because the final round stops at the first 10 files, files ranked 11 to 20 that no earlier round graded stay ungraded for every tool, and Recall@20 reads them.

A failed call is an error, never a score of zero. A tool with errors is marked partial, its row covers fewer queries than the others, and each stratum shows answered/queries. For Sourcegraph, an alert, a stream that ends before done, and a progress event that reports skipped results (other than forks and archives) all count as errors, so a short list is never scored as a complete one. A tool whose answers are not all recorded is named in the report and left out of the table, instead of being scored on a part.

The harness stores every raw answer in a JSON file under the SHA-256 of its canonical request (tool, query id, form and arguments) and the store’s schema version. The entry also holds the SHA-256 of the response and the time it was recorded. A request that carries a credential is refused, so no token reaches the store. Writes go through a temporary file, fsync and os.replace.

Scoring reads only the store. It stops with an error when an entry is missing, damaged or recorded for another request. --record asks only for answers the store lacks or holds as errors, and --refresh asks for every answer again.

Raw answers hold other projects’ code, so the report publishes rankings, metrics and token counts, and no raw answer.

The benchmark is part of the engine: corpus bench. Its scoring libraries (ranx and tiktoken) live in the bench extra of the package, so a plain install gains nothing. These runs used the engine’s source checkout, from its own folder.

Terminal window
$ corpus bench --help
usage: corpus bench [-h] [--data-dir DATA_DIR] [--queries QUERIES]
[--tool {engineering-corpus,sourcegraph,searchcode,github}]
[--form {query,keywords}] [--pins PINS] [--judged JUDGED]
--store STORE [--record] [--refresh] [--out OUT]

The default queries are all 133, and track A sends 124 of them to each tool. To see the mechanics first, save two of the gate’s queries as two.toml:

[[queries]]
id = "itsdangerous-hmac-sign-verify"
stratum = "how-to"
query = "sign a value with HMAC and verify the signature"
relevant = ["github.com/pallets/itsdangerous/src/itsdangerous/signer.py"]
[[queries]]
id = "itsdangerous-max-age"
stratum = "how-to"
query = "reject a signed value whose timestamp is older than max_age"
relevant = ["github.com/pallets/itsdangerous/src/itsdangerous/timed.py"]

Scoring needs answers first. With an empty store, the command says so and stops with exit status 1:

Terminal window
$ corpus bench --tool searchcode --form keywords --queries two.toml --store answers
corpus: missing answer 83abc4861f17bb07f9ca6f4578725c9e9d28c22f110f86f64601ecab5a1b40ab; record it with --record

Add --record to ask searchcode for the missing answers, and --out to write the report as JSON. This sends two requests, one second apart:

Terminal window
$ corpus bench --tool searchcode --form keywords --queries two.toml --store answers --record --out searchcode.json
asked searchcode 2 of 2 queries (keywords)
searchcode (keywords): 2/2 answered, 0 errors; recall@20 0.500, ndcg@10 0.500, mrr 0.500; unjudged@10 0.50; p50 870 ms, p95 1575 ms; 766 o200k_base tokens per relevant hit

Run the same command again without --record and it scores from the store, with no request to any service. The latency figures are the recorded ones, so the line is the same:

Terminal window
$ corpus bench --tool searchcode --form keywords --queries two.toml --store answers
searchcode (keywords): 2/2 answered, 0 errors; recall@20 0.500, ndcg@10 0.500, mrr 0.500; unjudged@10 0.50; p50 870 ms, p95 1575 ms; 766 o200k_base tokens per relevant hit

On two queries a score can only be 0, 0.5 or 1, so this run shows the mechanics and says nothing about quality. The unjudged@10 of 0.50 shows what an ungraded file does: no judge graded the files searchcode returned, so they count as not relevant.

Our server answers only from an index. These two queries ask in one repo, itsdangerous, so the run used the demo index (corpus demo --data-dir demo-only, two repos and 172 chunks) with the models/ folder linked at demo-only/models. The command starts the server over stdio itself:

Terminal window
$ corpus bench --queries two.toml --store answers --record --out ours.json --data-dir demo-only
asked engineering-corpus 2 of 2 queries
engineering-corpus: 2/2 answered, 0 errors; recall@20 1.000, ndcg@10 1.000, mrr 1.000; unjudged@10 0.90; p50 634 ms, p95 1084 ms; 15,190 o200k_base tokens per relevant hit

The same command without --record scored from the store and printed the same result line. Only 85 chunks of one small repo answer these queries, so the scores say nothing about quality. The token column does show what it measures: an answer from our server averaged 15,190 o200k_base tokens in this run, and an answer from searchcode averaged 383 (answer_tokens_mean in the two JSON reports).

For the full set, index the 12 pinned repos with corpus index bakeoff/corpus.toml and leave out --queries; that run was not made, because indexing 12 repos is a heavy job. GitHub code search needs a token in GH_TOKEN, and its 124 requests at 6.5 seconds apart take about 13 minutes of waiting.

Every change that could move a number or the way a number is read, oldest first. The date is the day it happened.

  • 2026-10-29. The twelve repositories of track A were pinned to one commit each (bakeoff/corpus.toml): our index, the relevant files and the scoring refer to those commits. The public tools search their own copies of the repositories, which move.
  • 2026-11-13. The first held-out set was recorded on 12 November and graded on 13 November. After that we used its 58 queries to find and fix ranking problems, so the set no longer counts as held out. The second set was written for that reason.
  • 2026-11-18, about 10:33. A few details of the first held-out set (counts of relevant files in two repositories and a few file names) were sent by mistake to the developer working on the Markdown rules, and withdrawn minutes later. That set was already published as used for tuning.
  • 2026-11-18, about 13:23. A search of the whole source tree by the same developer printed four lines of the second set’s sampling frame: titles of four public issues about an unrelated model name. None of the four is among the 40 queries or their proofs, nothing was used, and the frame file’s checksum is unchanged since 2026-11-13.
  • 2026-11-19. The second held-out set, 40 queries, was recorded before launch. It is graded after launch, and its scores will be published whichever way they fall.
  • It tests search for questions about code in a fixed set of repos. It does not test how well an agent writes code with the results.
  • It scores files. A tool that returns the right file at the right lines and one that returns the right file with no lines look the same.
  • Language models grade most of the labels. One of the four tools is the project’s own, and the project chose the repositories and the queries, so this benchmark is not independent of it. The held-out set was fixed before any ranking change was measured on it. Pass your own query files with --queries and rerun.
  • Public tools change. A score is a snapshot with a date.