MMF3:基于多模态细粒度特征融合的神经代码摘要
MMF3: Neural Code Summarization Based on Multi-Modal Fine-Grained Feature Fusion
摘要:
背景:代码摘要根据输入的代码自动生成相应的自然语言描述。代码表示的全面性是代码摘要任务的关键。然而,大多数现有的方法通常使用粗粒度融合方法来集成多模态特征。它们通常表示一段代码的不同模态,例如抽象树(AST)和令牌序列,作为两个嵌入,然后在AST/代码级别融合这两个嵌入。这种粗略的集成使得很难有效地学习跨模态的细粒度代码元素之间的相关性。目的:本研究旨在通过在节点/令牌级别精确对齐和充分融合源代码的语义和语法结构信息,提高模型的预测性能,以获得高质量的代码摘要。方法:提出一种多模态细粒度特征融合方法(MMF 3)用于神经代码摘要。我们介绍了一种新的细粒度融合方法,它允许细粒度融合的令牌和节点级别的多个代码模态。具体来说,我们使用这种方法来融合来自令牌和AST模态的信息,并将融合的特征应用于代码摘要。结果:我们在一个Java和一个Python数据集上进行了实验,并使用四个指标评估生成的摘要。结果表明:1)该模型的性能优于当前最先进的模型; 2)消融实验表明,该细粒度融合方法可以有效提高摘要生成的准确性。结论:MMF 3能够挖掘跨模态元素之间的关系,并据此进行精确的细粒度元素级对齐融合。因此,可以提供更多的线索来提高所生成的代码摘要的准确性。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。