arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2006.05405cs.LGcs.AI
收藏

基于混合GNN的检索增强代码摘要生成

Retrieval-Augmented Generation for Code Summarization via Hybrid GNN

Nanyang Technology University(南洋理工大学);Rensselaer Polytechnic Institute(伦斯勒理工学院)

Shangqing Liu, Yu Chen, Xiaofei Xie, Jingkai Siow, Yang Liu

摘要:

源代码摘要旨在从结构化代码片段生成自然语言摘要,以便更好地理解代码功能。然而,由于源代码的复杂性以及源代码和自然语言摘要之间的语言差距,自动代码摘要具有挑战性。大多数以前的方法要么依赖于基于检索的方法(可以利用从检索数据库中看到的相似示例,但泛化性能较低),要么依赖于基于生成的方法(具有更好的泛化性能,但不能利用相似示例)。本文提出了一种新的检索增强机制,结合两个世界的好处。此外,针对图神经网络(GNNs)在捕获源代码全局图结构信息方面的局限性,提出了一种基于注意力的动态图来补充源代码的静态图表示,并设计了一种混合消息传递GNN来捕获源代码的局部和全局结构信息.为了评估所提出的方法,我们发布了一个新的具有挑战性的基准测试,从各种大型开源C项目中抓取(数据集中共有95 k+独特的函数)。我们的方法达到了最先进的性能,在BLEU-4,ROUGE-L和METEOR方面将现有方法提高了1.42,2.44和1.29。

英文摘要:

Source code summarization aims to generate natural language summaries from structured code snippets for better understanding code functionalities. However, automatic code summarization is challenging due to the complexity of the source code and the language gap between the source code and natural language summaries. Most previous approaches either rely on retrieval-based (which can take advantage of similar examples seen from the retrieval database, but have low generalization performance) or generation-based methods (which have better generalization performance, but cannot take advantage of similar examples). This paper proposes a novel retrieval-augmented mechanism to combine the benefits of both worlds. Furthermore, to mitigate the limitation of Graph Neural Networks (GNNs) on capturing global graph structure information of source code, we propose a novel attention-based dynamic graph to complement the static graph representation of the source code, and design a hybrid message passing GNN for capturing both the local and global structural information. To evaluate the proposed approach, we release a new challenging benchmark, crawled from diversified large-scale open-source C projects (total 95k+ unique functions in the dataset). Our method achieves the state-of-the-art performance, improving existing methods by 1.42, 2.44 and 1.29 in terms of BLEU-4, ROUGE-L and METEOR.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑