SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Retrieval-Augmented Code Generation (RACG) is a critical technique for enhancing code generation by retrieving relevant information. In this work, we conduct an in-depth analysis of code retrieval by systematically masking specific features while preserving code functionality. Our discoveries include: (1) although trained on code, current retrievers heavily rely on surface-level textual features (e.g., docstrings, identifier names), and (2) they exhibit a strong bias towards well-documented code, even if the documentation is irrelevant. Based on our discoveries, we propose SACL, a framework that enriches textual information and reduces bias by augmenting code or structural knowledge with semantic information. Extensive experiments show that SACL substantially improves code retrieval (e.g., by 12.8% / 9.4% / 7.0% Recall@1 on HumanEval / MBPP / SWE-Bench-Lite), which also leads to better code generation performance (e.g., by 4.88% Pass@1 on HumanEval).
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 20 of its 24 references that are in the map. First posted on arXiv 25 Jun 2025.
Builds on
20 of 24 references.
Closest ancestors · 4
Same direction, newest first
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?20 Jun
- 2023Retrieval-Augmented Code Generation for Universal Information Extraction6 Nov
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
- 2021Retrieval Augmented Code Generation and Summarization26 Aug
Other references · 16
- 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
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021BEIR: A Heterogenous Benchmark for Zero-shot Evaluation of Information Retrieval Modelscited by 1,252
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2022Precise Zero-Shot Dense Retrieval without Relevance Labelscited by 517
- 2024Agentless: Demystifying LLM-based Software Engineering Agentscited by 421
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 221
4 more
- 2020Generation-Augmented Retrieval for Open-domain Question Answeringcited by 186
- 2024AgentFL: Scaling LLM-based Fault Localization to Project-Level Contextcited by 47
- 2023Neural Retrievers are Biased Towards LLM-Generated Contentcited by 38
- 2024Rewriting the Code: A Simple Method for Large Language Model Augmented Code Searchcited by 17
Built on by
Citing papers per year: 2025: 2; 2026: 2.
4 papers.
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 23
- 2025Agentic Software Issue Resolution with Large Language Models: A Surveycited by 6
- 2026Recall Before Rerank: Benchmarking Deep Learning Models for Large-Scale Code-to-Code Retrievalcited by 0
- 2026A^2Agent: Action-Aware Reinforcement Learning for Repository-Level Code Localization Agentscited by 0
- 2026A^2Agent: Action-Aware Reinforcement Learning for Repository-Level Code Localization Agents30 Aug 2026
- 2026Recall Before Rerank: Benchmarking Deep Learning Models for Large-Scale Code-to-Code Retrieval24 Jun 2026
- 2025Agentic Software Issue Resolution with Large Language Models: A Survey24 Dec 2025
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities
- 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2025ReCode: Improving LLM-based Code Repair with Fine-Grained Retrieval-Augmented Generation
- 2024Building A Coding Assistant via the Retrieval-Augmented Language Model
- 2026Do Not Treat Code as Natural Language: Implications for Repository-Level Code Generation and Beyond
- 2026CodeMMR: Bridging Natural Language, Code, and Image for Unified Retrieval
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond