ExecRetrieval: Measuring the Functional-Correctness Gap in Code-Embedding Retrieval
On the map: Retrieval-augmented generation → RAG for code
also in 1 more
Abstract (arXiv)
Embedding-based code retrieval is a core component of coding agents and retrieval-augmented code generation, where retrieving correct code matters more than retrieving lexically similar code. Existing code-retrieval benchmarks do not plant controlled, execution-verified single-edit variants of each query's canonical implementation in the search pool, leaving the question of whether embeddings can functionally discriminate correct from near-clone-but-incorrect code unanswered in a retrieval setting. Resolving this requires a benchmark whose search pool itself contains the relevant counterfactuals -- execution-verified buggy variants near-identical to each canonical -- so that a retriever's rank ordering can be directly tested for functional discrimination rather than topical or identity overlap. We introduce ExecRetrieval, 939 Python tasks each paired with one execution-verified canonical implementation and up to four execution-verified buggy distractors, each generated by a mechanical mutation making a single targeted edit, and evaluate 23 dense embedding configurations plus BM25 under provider-native invocation with paired McNemar tests and query-level bootstrap intervals. With near-clone counterfactuals in the pool, the top hosted system reaches exec@10 = 1.00 but only exec@1 = 0.331; rank-1 misses are paired buggy variants 91.5-99.4% of the time across the four leading systems, and the canonical scores below at least one of its four paired distractors in 67-78% of queries on the leading systems. The full dataset, execution oracle, embedding matrices, environment snapshot, and pairwise statistical tests are released at the URL in Appendix D.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 34 of its 58 references that are in the map. First posted on arXiv 1 Sep 2026.
Builds on
34 of 58 references.
Closest ancestors · 1
Same direction, newest first
Other references · 33
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,824
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,004
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2025Qwen3 Embedding: Advancing Text Embedding and Reranking Through Foundation Modelscited by 1,261
- 2022Text Embeddings by Weakly-Supervised Contrastive Pre-trainingcited by 1,253
- 2024M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillationcited by 1,073
21 more
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2023Towards General Text Embeddings with Multi-stage Contrastive Learningcited by 723
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2023C-Pack: Packed Resources For General Chinese Embeddingscited by 578
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 452
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
- 2022Text and Code Embeddings by Contrastive Pre-Trainingcited by 361
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 300
- 2025Gemini Embedding: Generalizable Embeddings from Geminicited by 94
- 2020Contrastive Code Representation Learningcited by 76
- 2021CoSQA: 20,000+ Web Queries for Code Search and Question Answeringcited by 75
- 2024CoIR: A Comprehensive Benchmark for Code Information Retrieval Modelscited by 60
- 2023xCodeEval: A Large Scale Multilingual Multitask Benchmark for Code Understanding, Generation, Translation and Retrievalcited by 47
- 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Searchcited by 21
- 2022TSSB-3M: Mining single statement bugs at massive scalecited by 14
- 2017Do Code Clones Matter?cited by 12
- 2025CoQuIR: A Comprehensive Benchmark for Code Quality-Aware Information Retrievalcited by 6
- 2025Functional Consistency of LLM Code Embeddings: A Self-Evolving Data Synthesis Framework for Benchmarkingcited by 4
- 2016On the Relationship of Inconsistent Software Clones and Faults: An Empirical Studycited by 2
- 2025Bogus Bugs, Duplicates, and Revealing Comments: Data Quality Issues in NPRcited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026CORE-Bench: A Comprehensive Benchmark for Code Retrieval in the Era of Agentic Coding
- 2024CodeXEmbed: A Generalist Embedding Model Family for Multiligual and Multi-task Code Retrieval
- 2025Towards A Generalist Code Embedding Model Based On Massive Data Synthesis
- 2025SpIDER: Spatially Informed Dense Embedding Retrieval for Software Issue Localization
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
- 2024CoSQA+: Pioneering the Multi-Choice Code Search Benchmark with Test-Driven Agents
- 2024FT2Ra: A Fine-Tuning-Inspired Approach to Retrieval-Augmented Code Completion
- 2024Retrieval-augmented code completion for local projects using large language models