paperbot · PL 论文追踪

全部论文 待读 收藏

P2 EditSum: A Retrieve-and-Edit Framework for Source Code Summarization

EditSum:面向源代码摘要的检索-编辑框架
ASE 2021 36th IEEE/ACM International Conference on Automated Software Engineering (ASE)2021匹配度 2/10 · 论文属于代码摘要与机器学习交叉,但与用户关注的静态分析、Agentic 程序、LLM 改进静态分析/形式化验证、浮点程序分析及贝叶斯程序分析均无直接关联。引用 59 inbox
Jia Allen Li, Yongmin Li, Ge Li, Xing Hu, Xin Xia, Zhi Jin
crossref: 2026-09-12

AI 速览

一句话:提出检索-编辑框架 EditSum,利用相似代码摘要原型并自动编辑,提升代码摘要的信息量与关键词预测。

代码摘要能帮助开发者理解和维护源代码,但项目中摘要常缺失或过时,自动生成摘要因此重要。已有研究表明代码摘要高度模式化,同时包含反映代码功能的关键词,而现有方法在关键词预测上表现不佳,导致生成摘要信息量不足。为此,本文提出检索-编辑式方法 EditSum:先从预定义语料中检索相似代码片段,将其摘要作为原型以学习模式,再自动编辑该原型,把原型中的模式化表达与输入代码的语义信息结合,从而生成关键词并复用模式化短语。作者在 200 万规模 Java 语料上实验,结果表明 EditSum 显著优于当前最佳方法;人工评估也表明生成摘要更具信息量和实用性,并验证了其在模式化词和关键词预测上的良好表现。

问题
自动代码摘要中,现有方法难以准确预测反映代码功能的关键词,导致生成摘要信息量不足,且代码摘要常缺失或过时。
方法
提出 EditSum 检索-编辑框架:检索相似代码片段及其摘要作为原型,再自动编辑原型,融合其模式化表达与输入代码语义以生成摘要。
评估
在 200 万规模 Java 语料上与当前最佳方法对比,并进行人工评估,同时验证模式化词和关键词预测效果。
原文摘要(Abstract)

Existing studies show that code summaries help developers understand and maintain source code. Unfortunately, these summaries are often missing or outdated in software projects. Code summarization aims to generate natural language descriptions automatically for source code. According to Gros et al., code summaries are highly structured and have repetitive patterns (e.g. "return true if..."). Besides the patternized words, a code summary also contains important keywords, which are the key to reflecting the functionality of the code. However, the state-of-the-art approaches perform poorly on predicting the keywords, which leads to the generated summaries suffer a loss in informativeness. To alleviate this problem, this paper proposes a novel retrieve-and-edit approach named EditSum for code summarization. Specifically, EditSum first retrieves a similar code snippet from a pre-defined corpus and treats its summary as a prototype summary to learn the pattern. Then, EditSum edits the prototype automatically to combine the pattern in the prototype with the semantic information of input code. Our motivation is that the retrieved prototype provides a good start-point for post-generation because the summaries of similar code snippets often have the same pattern. The post-editing process further reuses the patternized words in prototype and generates keywords based on the semantic information of input code. We conduct experiments on a large-scale Java corpus (2M) and experimental results demonstrate that EditSum outperforms the state-of-the-art approaches by a substantial margin. The human evaluation also proves the summaries generated by EditSum are more informative and useful. We also verify that EditSum performs well on predicting the patternized words and keywords.

链接与引用

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

BibTeX
@inproceedings{paperbot6507,
  title = {EditSum: A Retrieve-and-Edit Framework for Source Code Summarization},
  author = {Jia Allen Li and Yongmin Li and Ge Li and Xing Hu and Xin Xia and Zhi Jin},
  booktitle = {ASE},
  year = {2021},
  doi = {10.1109/ase51524.2021.9678724}
}