RepoShapley:基于Shapley的上下文过滤用于仓库级代码补全
RepoShapley: Shapley-Enhanced Context Filtering for Repository-Level Code Completion
AI总结:
RepoShapley通过Shapley式边际贡献监督,实现仓库级代码补全的上下文过滤,提升补全质量并减少有害上下文和冗余检索。
摘要:
仓库级代码补全受益于检索增强生成(RAG)。然而,控制跨文件证据具有挑战性,因为片段效用通常是交互依赖的:某些片段只有在与互补上下文配对时才有所帮助,而其他片段在冲突时会损害解码。我们提出了RepoShapley,一种由Shapley式边际贡献监督的联盟感知上下文过滤框架。我们的离线标注模块ChunkShapley通过教师强制探测估计带符号的每片段效应,将其输入一个轻量级替代游戏,捕捉饱和和干扰,计算小检索集的精确Shapley值,并通过有界后验证选择最优解码联盟。经过验证的保留/删除决策和检索触发器通过离散控制标记汇总到单一模型中。在多个基准和主干上的实验表明,RepoShapley在提升补全质量的同时,减少了有害上下文和不必要的检索。
英文摘要:
Repository-level code completion benefits from retrieval-augmented generation (RAG). However, controlling cross-file evidence is difficult because chunk utility is often interaction-dependent: some snippets help only when paired with complementary context, while others harm decoding when they conflict. We propose RepoShapley, a coalition-aware context filtering framework supervised by Shapley-style marginal contributions. Our offline labeling module, ChunkShapley, estimates signed per-chunk effects via teacher-forced probing, feeds them into a lightweight surrogate game that captures saturation and interference, computes exact Shapley values for small retrieval sets, and selects a decoding-optimal coalition through bounded post-verification with the frozen generator. The verified keep/drop decisions and retrieval triggers are then distilled into a single model via discrete control tokens. Experiments across benchmarks and backbones show that RepoShapley improves completion quality while reducing harmful context and unnecessary retrieval.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。