论文标题
MMF3:基于多模式细粒特征融合的神经代码摘要
MMF3: Neural Code Summarization Based on Multi-Modal Fine-Grained Feature Fusion
论文作者
论文摘要
背景:代码汇总会根据输入代码自动生成相应的自然语言描述。代码表示的综合性对于代码摘要任务至关重要。但是,大多数现有方法通常使用粗粒融合方法来整合多模式特征。它们通常表示一件代码的不同模态,例如抽象语法树(AST)和令牌序列,作为两个嵌入,然后在AST/代码级别融合两个。这样的粗糙整合使得很难有效地学习跨模式的细粒度代码元素之间的相关性。目的:本研究旨在通过准确对齐和完全融合源代码的语义和句法结构信息在节点/令牌级别的语义和句法结构信息,以提高模型对高质量代码摘要的预测性能。方法:本文提出了一种用于神经代码摘要的多模式细粒特征融合方法(MMF3)。我们引入了一种新型的细粒融合方法,该方法允许在令牌和节点级别上进行多种代码模态的细粒融合。具体来说,我们使用此方法将来自令牌和AST模式的信息融合在一起,并将融合功能应用于代码摘要。结果:我们对一个Java和一个Python数据集进行了实验,并使用四个指标评估了生成的摘要。结果表明:1)我们的模型的性能优于当前的最新模型,2)消融实验表明,我们提出的细粒融合方法可以有效地提高生成的摘要的准确性。结论:MMF3可以挖掘跨模式元件之间的关系,并相应地执行准确的细粒元素级比对融合。结果,可以提供更多的线索来提高生成的代码摘要的准确性。
Background: Code summarization automatically generates the corresponding natural language descriptions according to the input code. Comprehensiveness of code representation is critical to code summarization task. However, most existing approaches typically use coarse-grained fusion methods to integrate multi-modal features. They generally represent different modalities of a piece of code, such as an Abstract Syntax Tree (AST) and a token sequence, as two embeddings and then fuse the two ones at the AST/code levels. Such a coarse integration makes it difficult to learn the correlations between fine-grained code elements across modalities effectively. Aims: This study intends to improve the model's prediction performance for high-quality code summarization by accurately aligning and fully fusing semantic and syntactic structure information of source code at node/token levels. Method: This paper proposes a Multi-Modal Fine-grained Feature Fusion approach (MMF3) for neural code summarization. We introduce a novel fine-grained fusion method, which allows fine-grained fusion of multiple code modalities at the token and node levels. Specifically, we use this method to fuse information from both token and AST modalities and apply the fused features to code summarization. Results: We conduct experiments on one Java and one Python datasets, and evaluate generated summaries using four metrics. The results show that: 1) the performance of our model outperforms the current state-of-the-art models, and 2) the ablation experiments show that our proposed fine-grained fusion method can effectively improve the accuracy of generated summaries. Conclusion: MMF3 can mine the relationships between crossmodal elements and perform accurate fine-grained element-level alignment fusion accordingly. As a result, more clues can be provided to improve the accuracy of the generated code summaries.