arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.11074cs.AI
收藏

Tram:一种用于源代码摘要生成的令牌级检索增强机制

Tram: A Token-level Retrieval-augmented Mechanism for Source Code Summarization

Zhejiang University(浙江大学);Stony Brook University(石溪大学)

Tong Ye, Lingfei Wu, Tengfei Ma, Xuhong Zhang, Yangkai Du, Peiyu Liu, Shouling Ji, Wenhai Wang

AI总结:

本文提出解码器侧令牌级检索增强机制Tram,通过将代码语义集成到摘要令牌中,解决句子级检索粒度粗、噪声多的问题,显著提升源代码摘要生成性能并增强可解释性。

摘要:

自动生成描述程序功能的人类可读文本是源代码摘要生成的目标。尽管神经语言模型在该领域取得了显著性能,但它们因无法访问外部知识而受到限制。为了解决这一限制,一种新兴趋势是通过检索方法将神经模型与外部知识相结合。以往的方法依赖编码器侧的句子级检索范式。然而,这种范式粒度较粗、充满噪声,并且无法直接利用解码器侧高质量的检索摘要令牌。在本文中,我们在解码器侧而非编码器侧提出了一种细粒度的令牌级检索增强机制(Tram),以增强神经模型的性能,并在生成摘要时产生更多低频令牌。此外,为了克服令牌级检索在捕获上下文代码语义方面的挑战,我们还提出将代码语义集成到单个摘要令牌中。大量实验和人工评估的结果表明,我们的令牌级检索增强方法显著提高了性能,并且更具可解释性。

英文摘要:

Automatically generating human-readable text describing the functionality of a program is the intent of source code summarization. Although neural language models achieve significant performance in this field, they are limited by their inability to access external knowledge. To address this limitation, an emerging trend is combining neural models with external knowledge through retrieval methods. Previous methods have relied on the sentence-level retrieval paradigm on the encoder side. However, this paradigm is coarse-grained, noise-filled and cannot directly take advantage of the high-quality retrieved summary tokens on the decoder side. In this paper, we propose a fine-grained Token-level retrieval-augmented mechanism (Tram) on the decoder side rather than the encoder side to enhance the performance of neural models and produce more low-frequency tokens in generating summaries. Furthermore, to overcome the challenge of token-level retrieval in capturing contextual code semantics, we also propose integrating code semantics into individual summary tokens. The results of extensive experiments and human evaluation show that our token-level retrieval-augmented approach significantly improves performance and is more interpretable.

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

↑