paperbot · PL 论文追踪

全部论文 待读 收藏

P2 AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion

AlignCoder:面向仓库级代码补全对齐检索与目标意图
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 2/10 · 该论文研究仓库级代码补全,使用检索增强生成和强化学习提升代码 LLM 的补全性能,属于 LLM 在代码生成中的应用,而非静态分析、形式化验证或浮点/贝叶斯程序分析,与用户核心研究方向(PL 与 AI 交叉中的静态分析及 LLM 辅助的静态分析)匹配度低。引用 1 inbox
Tianyue Jiang, Yanli Wang, Yanlin Wang, Daya Guo, Ensheng Shi, Yuchi Ma, Jiachi Chen, Zibin Zheng
crossref: 2026-09-12

AI 速览

一句话:提出 AlignCoder,通过查询增强与强化学习检索器对齐检索与目标意图,显著提升仓库级代码补全。

仓库级代码补全要求模型理解仓库特有上下文与领域知识,现有 code LLM 能力有限;基于检索增强生成(RAG)的方法虽能引入跨文件代码片段,却面临检索查询与目标代码不对齐、且无法有效利用推理信息两大问题。为此,本文提出 AlignCoder:一方面设计查询增强机制,通过生成多个候选补全来构造增强查询,弥合初始查询与目标代码之间的语义鸿沟;另一方面采用强化学习训练 AlignRetriever,使其学会利用增强查询中的推理信息进行更准确的检索。作者在 CrossCodeEval 与 RepoEval 两个基准、五种骨干 code LLM 上进行评估,在 CrossCodeEval 上 EM 分数较基线提升 18.1%,并展现出跨模型、跨编程语言的良好泛化性。

问题
现有 code LLM 对仓库特定上下文理解不足,而 RAG 式检索存在查询与目标代码语义不对齐、且未能利用推理信息的问题,导致仓库级代码补全效果受限。
方法
提出 AlignCoder 框架:生成多个候选补全以构造增强查询,桥接初始查询与目标代码的语义差距;并用强化学习训练 AlignRetriever,使其利用增强查询中的推理信息进行更精准的检索。
评估
在 CrossCodeEval 和 RepoEval 两个基准、五种骨干 code LLM 上评估,CrossCodeEval 上 EM 较基线提升 18.1%,并验证了跨模型与跨编程语言的泛化性。
原文摘要(Abstract)

Repository-level code completion remains a challenging task for existing code large language models (code LLMs) due to their limited understanding of repository-specific context and domain knowledge. While retrieval-augmented generation (RAG) approaches have shown promise by retrieving relevant code snippets as cross-file context, they suffer from two fundamental problems: misalignment between the query and the target code in the retrieval process, and the inability of existing retrieval methods to effectively utilize the inference information. To address these challenges, we propose AlignCoder, a repository-level code completion framework that introduces a query enhancement mechanism and a reinforcement learning based retriever training method. Our approach generates multiple candidate completions to construct an enhanced query that bridges the semantic gap between the initial query and the target code. Additionally, we employ reinforcement learning to train an AlignRetriever that learns to leverage inference information in the enhanced query for more accurate retrieval. We evaluate AlignCoder on two widely-used benchmarks (CrossCodeEval and RepoEval) across five backbone code LLMs, demonstrating an 18.1% improvement in EM score compared to baselines on the CrossCodeEval benchmark. The results show that our framework achieves superior performance and exhibits high generalizability across various code LLMs and programming languages.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot9448,
  title = {AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion},
  author = {Tianyue Jiang and Yanli Wang and Yanlin Wang and Daya Guo and Ensheng Shi and Yuchi Ma and Jiachi Chen and Zibin Zheng},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00085}
}