Hidden Positives: Why Code Retrieval Benchmarks Underestimate Model Quality
Abstract
Text-code embeddings underpin modern code intelligence systems, but progress in this area is held back by a systemic problem: code retrieval benchmarks routinely treat valid alternative implementations as negatives, making cross-model comparison unstable and depressing measured performance. In a six-benchmark audit of 11{,}861 sampled query-code pairs, between 58.9\% and 92.6\% of candidates marked as relevant by GPT-5.4 are absent from the original positive labels. To address this evaluation inconsistency, we adopt a unified protocol in which a single LLM judge re-annotates the top-10 retrieved candidates for every model under a fixed prompt, replacing heterogeneous annotation protocols with a consistent semantic standard. Applying a related idea at training time, we use a smaller LLM-supervised reranker to construct MegaCode, the largest semantically curated dataset for code search to date, with 193M positive (text, code) pairs, roughly an order of magnitude larger than prior curated corpora, and train a family of embedding models on it at four scales (0.5B-7B) with contrastive learning. Under the unified LLM-judged protocol, our fine-tuned 0.5B model achieves a higher average MRR@10 than the evaluated prior open code-retrieval embeddings with up to 8B parameters, while the fine-tuned 7B model outperforms the strongest baseline by 4.6 points.