Vibeleaderboard
← All Intel
Intel / post

Why code retrieval benchmarks mislead, and how to rebuild them

Source
x.com
Publisher
Voyage AI
Date

Vector-based code retrieval is a critical building block in code assistants and agents. However, many people complained about the lack of diverse, high-quality evaluation datasets for it. We surveyed existing ones and proposed some methods to build better ones. 🧵🧵

Context

Code is the search step a coding assistant runs before it writes anything: it looks through a large repository for the functions, files or documentation relevant to the request. Most systems do this with models, which turn both the query and the code into lists of numbers and return the closest matches. Voyage AI, which sells such models, argues in a December 2024 analysis that the public benchmarks used to compare them (CodeSearchNet, CoSQA, CodeXGLUE and CoIR) measure that search poorly. It says the argument draws on feedback from about ten code generation companies that are its partners or customers.

The post names three failures. CoSQA pairs queries taken from Bing searches with code drawn from a different collection, and Voyage cites an estimate by Gong et al. that 51% of its labeled answers are wrong. With that much noise, nearly all models score about the same, so the test cannot separate a good model from a weak one. CodeSearchNet has the opposite problem: its queries are copied nearly verbatim from the comment attached to each , so a model only has to match repeated wording, and Voyage says this inflates scores on CoIR, which includes those datasets. The third failure is contamination. Many public sets ship with training data drawn from the same pool as the test, and Voyage points to Jina-v2-code scoring 0.41 on CoSQA, against 0.28 to 0.33 for the other models it names, an advantage that did not appear on other datasets, including one built from . The score here, NDCG@10, rates how well the top ten results line up with the labeled correct answers.

Voyage's remedy is to start from data where the right answer is already settled. A question-answer dataset can become a search test by treating each question as a query and the full set of answers as the collection to search, and because an answer has to be correct, false labels are rare. Voyage anticipated the objection that such answers might be too different from one another to make search hard, and reports that models still score very differently on these sets. The second method uses real repositories: a GitHub issue becomes the query, and the files edited to resolve it become the correct results. Voyage applied this to SWE-bench, a collection of real GitHub issues used to test whether AI can fix them. Using an AI model as a judge is mentioned as a third approach and left for later posts.

The critique of the public sets is the part a reader can check, since it rests on named datasets and a cited error estimate. The comparison of models is weaker evidence. Voyage built its own suite from these methods, covering nine programming languages and eight repurposed question-answer sets, says it curated the data so that no model, including its own, saw it in training, and reports its own voyage-code-3 as the best performer. That is a vendor ranking its product on a test it controls. The post says many of the datasets can be shared under a non-disclosure agreement and that portions will be released publicly; until then, outsiders cannot rerun the ranking.

Terms in this piece · Glossary
  • Retrieval — Selecting evidence relevant to the current request.
  • embedding — A list of numbers representing a piece of text's meaning, so that similar meanings end up numerically close and can be searched.
  • Function — A named block of instructions that takes inputs, called arguments, and hands back a result, called its return value.
  • SWE-bench — The standard benchmark for AI coding agents: real GitHub issues from real repositories, scored by whether the agent's patch passes the project's own tests.

Get the Brief

A cited digest of what matters for people building with AI, every morning. Unsubscribe anytime. See today’s edition

More from Voyage AI by MongoDB
Recommended reads