EMNLP Findings2025
SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization
摘要
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). sum_to_num is a function that sums numbers from 1 to num. Query (Instruction)def sum_to_num(num: int):"""Calculate the sum of all integers from 0 to num, inclusive."""return sum(range(num+1)) Orig Functiondef sum_to_num(num: int): """Calculate the sum of all integers from 0 to num, inclusive."""return sum(range(num+1))
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
- Precise Zero-Shot Dense Retrieval without Relevance Labels 引用了 Dense Passage Retrieval for Open-Domain Question Answering
- ReACC: A Retrieval-Augmented Code Completion Framework 引用了 Dense Passage Retrieval for Open-Domain Question Answering
- ReACC: A Retrieval-Augmented Code Completion Framework 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
它引用的 Paper11
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
- SWE-bench: Can Language Models Resolve Real-world Github Issues?Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao 等ICLR 2024 · 2,082 次引用
- Precise Zero-Shot Dense Retrieval without Relevance LabelsLuyu Gao, Xueguang Ma, Jimmy Lin, Jamie CallanACL 2023 · 211 次引用
- ReACC: A Retrieval-Augmented Code Completion FrameworkShuai Lu, Nan Duan, Hojae Han, Daya Guo 等ACL 2022 · 208 次引用
- Dense Passage Retrieval for Open-Domain Question AnsweringVladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis 等EMNLP 2020 · 142 次引用
相关 Paper
- SRACG: A Code Generation Framework with Selective Retrieval AugmentationMengzhen Wang, Shukai Ma, Songwen Gong, Jiexin Wang 等AAAI 2026
- RESCUE: Retrieval Augmented Secure Code GenerationJiahao Shi, Tianyi ZhangICLR 2026 · 15 次引用
- cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax TreeYilin Zhang, Xinran Zhao, Zora Zhiruo Wang, Chenyang Yang 等EMNLP Findings 2025 · 11 次引用
- Retrieval Augmented Code Generation and SummarizationMd. Rizwan Parvez, Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray 等EMNLP Findings 2021 · 141 次引用
- Preference-Guided Refactored Tuning for Retrieval Augmented Code GenerationXinyu Gao, Yun Xiong, Deze Wang, Zhenhan Guan 等ASE 2024 · 1 次引用
