paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Combining Program Analysis and Statistical Language Model for Code Statement Completion

结合程序分析与统计语言模型进行代码语句补全
ASE 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE)2019匹配度 3/10 · 该论文将程序分析与统计语言模型结合用于代码语句补全,属于 AI+PL/代码智能的早期工作,与用户关注的程序分析和语言模型交叉有边缘关联;但它不涉及 LLM/Agent、Agentic 程序、静态分析验证、浮点程序分析或贝叶斯程序分析,因此与当前核心研究方向匹配度较低。引用 28 inbox
Son Nguyen, Tien Nguyen, Yi Li, Shaohua Wang
crossref: 2026-09-12

AI 速览

一句话:提出 AutoSC,将程序分析与统计语言模型结合,实现频繁且类型正确的代码语句补全。

代码补全能提升开发者效率,但补全部分代码语句时需兼顾候选项的高频性与语法、类型正确性。AutoSC 在大规模代码语料上训练得到候选语句模板,再利用程序分析对模板进行验证和具体化,生成语法与类型有效的候选语句,最后用基于源代码词法形式训练的语言模型对候选排序。在真实项目的大型数据集上,AutoSC 的语句补全 top-1 准确率为 38.9–41.3%,top-5 为 48.2–50.1%,top-1 较当时最佳方法提升 9X–69X。

问题
如何补全部分完成的代码语句,使生成的候选既常见又语法和类型有效。
方法
AutoSC 先在大规模代码语料上学习语句模板,再用程序分析验证并具体化模板,最后用统计语言模型排序。
评估
在真实项目大型数据集上,AutoSC 达到 38.9–41.3% top-1 和 48.2–50.1% top-5 准确率,top-1 比当时最佳方法提升 9X–69X。
原文摘要(Abstract)

Automatic code completion helps improve developers' productivity in their programming tasks. A program contains instructions expressed via code statements, which are considered as the basic units of program execution. In this paper, we introduce AutoSC, which combines program analysis and the principle of software naturalness to fill in a partially completed statement. AutoSC benefits from the strengths of both directions, in which the completed code statement is both frequent and valid. AutoSC is first trained on a large code corpus to derive the templates of candidate statements. Then, it uses program analysis to validate and concretize the templates into syntactically and type-valid candidate statements. Finally, these candidates are ranked by using a language model trained on the lexical form of the source code in the code corpus. Our empirical evaluation on the large datasets of real-world projects shows that AutoSC achieves 38.9-41.3% top-1 accuracy and 48.2-50.1% top-5 accuracy in statement completion. It also outperforms a state-of-the-art approach from 9X-69X in top-1 accuracy.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot5333,
  title = {Combining Program Analysis and Statistical Language Model for Code Statement Completion},
  author = {Son Nguyen and Tien Nguyen and Yi Li and Shaohua Wang},
  booktitle = {ASE},
  year = {2019},
  doi = {10.1109/ase.2019.00072}
}