arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2607.24884cs.SEcs.AIcs.CLcs.LG

超越“检索什么”:检索增强代码生成中的不确定性

Beyond "What to Retrieve": Uncertainty in Retrieval-Augmented Code Generation

  • Beihang University(北京航空航天大学)

机构由 AI 辅助整理,请以论文原文为准。

Chandan Kumar Sah, Li Zhang, Xiaoli Lian

AI总结:

研究存储库级代码生成中异构证据不确定性问题,提出不确定性感知框架OpenCoder,通过估计特定源不确定性来过滤和排序证据以指导相关操作,实验表明其能提高输出正确性,支持将不确定性作为可操作控制信号。

AI中文摘要:

存储库级代码生成依赖于异构证据,其相关性、兼容性和完整性本质上是不确定的。类似代码示例、存储库上下文和特定项目的API可能提供补充信息,但也可能引入噪声、冗余或冲突信号。现有检索增强方法主要优化检索相关性,而未明确建模检索证据中的不确定性如何影响下游生成。我们引入了OpenCoder,一个不确定性感知框架,它估计特定源的不确定性,用于过滤和排序异构证据,并指导生成、验证和修复。对API知识、存储库上下文和类似代码证据的因子分析表明,没有通用的加法源排名;相反,显著的跨源交互取决于伴随的证据和LLM后端。在扩展后的32任务RepoExec-inline评估中,OpenCoder将GPT选定输出的正确性从基线RAG的56.25%提高到78.13%。然而,它与验证和修复控制相匹配,Gemini的相应改进在统计上不成立,表明了后端相关的好处。目标感知API细化也显著改进了API集检索。这些发现支持将不确定性视为存储库级检索、验证和修复的可操作控制信号。

英文摘要:

Repository-level code generation relies on heterogeneous evidence whose relevance, compatibility, and completeness are inherently uncertain. Similar-code examples, repository context, and project-specific APIs may provide complementary information, but can also introduce noisy, redundant, or conflicting signals. Existing retrieval-augmented approaches primarily optimize retrieval relevance without explicitly modeling how uncertainty in retrieved evidence affects downstream generation. We introduce OpenCoder, an uncertainty-aware framework that estimates source-specific uncertainty, uses it to filter and rank heterogeneous evidence, and guides generation, verification, and repair. A factorial analysis over API knowledge, repository context, and similar-code evidence reveals no universal additive source ranking; instead, significant cross-source interactions depend on the accompanying evidence and LLM backend. On an expanded 32-task RepoExec-inline evaluation, OpenCoder improves GPT selected-output correctness over Baseline RAG from 56.25\% to 78.13\%. However, it matches a verification-and-repair control, and the corresponding Gemini improvement is not statistically supported, indicating backend-dependent benefits. Target-aware API refinement also substantially improves API-set retrieval. These findings support treating uncertainty as an actionable control signal for repository-level retrieval, verification, and repair.

补充信息

↑