paperbot · PL 论文追踪

全部论文 待读 收藏

P2 FastMCC: Multiple-hypotheses Code Completion with Natural Language Phrases as Alternative Suggestions

FastMCC:以自然语言短语作为替代建议的多假设代码补全
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 2/10 · 该论文研究基于 LLM 的代码补全与多假设建议,属于开发者工具/LLM 应用方向,不涉及静态分析、形式化验证、浮点程序分析或贝叶斯程序分析,也未探索用 LLM/Agent 改进静态分析;其目标更偏向提升 LLM 补全能力本身。引用 0 inbox
Zhensu Sun
crossref: 2026-09-12

AI 速览

一句话:用自然语言短语表达多假设补全,避免生成多份完整代码,兼顾命中意图与低开销。

基于 LLM 的代码补全通常只提供单条建议,在上下文有歧义时难以覆盖开发者真实意图。现有多假设补全方法生成多个完整代码候选以提高命中率,但带来高延迟和开发者认知负担。本文提出 FastMCC,将多个假设表示为简洁的自然语言短语而非完整代码,并采用两阶段推理:先生成初始代码建议及替代意图短语;当用户选择某个短语后,再生成与该意图对齐的代码。作者设计了轻量微调框架,使基础代码 LLM 获得该能力且不损害原有补全性能。在三个代码 LLM 上的实验表明,FastMCC 保持初始建议的通过率,同时为多假设选项节省 76.6% 的生成 token。

问题
LLM 代码补全通常只给单条建议,在上下文有歧义时难以覆盖开发者意图;现有多假设补全生成多个完整代码候选,延迟高且加重认知负担。
方法
FastMCC 将多假设表示为简洁自然语言短语,并采用两阶段推理:先生成初始代码建议与替代意图短语,用户选中短语后再生成与之对齐的代码;同时用轻量微调框架赋予基础代码 LLM 该能力而不损害原有补全性能。
评估
在三个代码 LLM 上实验,FastMCC 保持初始建议的 pass rate,同时使多假设选项的生成 token 减少 76.6%。
原文摘要(Abstract)

LLM-based code completion systems typically offer only one suggestion, often failing to cover developers’ intent, especially with ambiguous context. Current multiple-hypotheses code completion, i.e., generating multiple full-code candidates to increase the possibility to hit the user intent, can mitigate this but with a price of high latency and developers’ cognitive burden. To fill this gap, we propose FastMCC, which presents multiple hypotheses as concise natural language phrases instead of full code. It uses a two-stage inference: first generating an initial code suggestion followed by alternative intent phrases; then generating intent-aligned code if a phrase is selected. We design a lightweight fine-tuning framework to equip base code LLMs with this capability without compromising their original code completion performance. Experiments on three code LLMs show FastMCC maintains the pass rate of initial suggestions, while saving 76.6% generated tokens for multiple-hypotheses options.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11647,
  title = {FastMCC: Multiple-hypotheses Code Completion with Natural Language Phrases as Alternative Suggestions},
  author = {Zhensu Sun},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3774748.3787758}
}