ESALE:增强源代码摘要生成中的代码-摘要对齐学习
ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarization
AI总结:
本文提出 ESALE,通过 ULM、MLM 和 AWP 三个以摘要为中心的多任务增强代码-摘要对齐学习,并在四个数据集上显著提升代码摘要性能。
摘要:
(源代码)摘要生成旨在为给定代码片段自动生成简洁的自然语言摘要。此类摘要在促进开发者理解和维护代码方面发挥着重要作用。受神经机器翻译启发,基于深度学习的代码摘要技术广泛采用编码器-解码器框架,其中编码器将给定代码片段转换为上下文向量,解码器将上下文向量解码为摘要。近来,面向源代码的大规模预训练模型配备了能够生成通用上下文向量的编码器,并在代码摘要任务上取得了显著提升。然而,尽管这些模型通常主要在以代码为中心的任务上训练,并且能够捕获通用代码特征,但它们在捕获需要被摘要化的特定特征方面仍显不足。本文提出一种基于以摘要为中心的任务来改进代码摘要的新颖方法。具体而言,我们利用多任务学习范式,在三个以摘要为中心的任务上训练编码器,以增强其学习代码-摘要对齐的能力,这些任务包括单向语言建模(ULM)、掩码语言建模(MLM)和动作词预测(AWP)。不同于主要预测代码片段中被掩码 token 的预训练模型,我们设计 ULM 和 MLM 来预测摘要中的被掩码词。直观上,基于给定代码片段预测词语将有助于学习代码-摘要对齐。此外,我们引入领域特定任务 AWP,以增强编码器学习动作词与代码片段之间对齐的能力。在四个数据集上进行的大量实验表明,我们称为 ESALE 的方法在 BLEU、METEOR 和 ROUGE-L 这三个广泛使用的指标上均显著优于基线方法。
英文摘要:
(Source) code summarization aims to automatically generate succinct natural language summaries for given code snippets. Such summaries play a significant role in promoting developers to understand and maintain code. Inspired by neural machine translation, deep learning-based code summarization techniques widely adopt an encoder-decoder framework, where the encoder transforms given code snippets into context vectors, and the decoder decodes context vectors into summaries. Recently, large-scale pre-trained models for source code are equipped with encoders capable of producing general context vectors and have achieved substantial improvements on code summarization. However, although they are usually trained mainly on code-focused tasks and can capture general code features, they still fall short in capturing specific features that need to be summarized. This paper proposes a novel approach to improve code summarization based on summary-focused tasks. Specifically, we exploit a multi-task learning paradigm to train the encoder on three summary-focused tasks to enhance its ability to learn code-summary alignment, including unidirectional language modeling (ULM), masked language modeling (MLM), and action word prediction (AWP). Unlike pre-trained models that mainly predict masked tokens in code snippets, we design ULM and MLM to predict masked words in summaries. Intuitively, predicting words based on given code snippets would help learn the code-summary alignment. Additionally, we introduce the domain-specific task AWP to enhance the ability of the encoder to learn the alignment between action words and code snippets. The extensive experiments on four datasets demonstrate that our approach, called ESALE significantly outperforms baselines in all three widely used metrics, including BLEU, METEOR, and ROUGE-L.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。