一句话:提出 AST-Transformer,高效编码树结构 AST 用于代码摘要,显著优于 SOTA 并降低约 90%–95% 编码计算复杂度。
代码摘要旨在为源代码生成简短的自然语言描述。由于源代码具有高度结构化并遵循严格的编程语言文法,现有方法常利用抽象语法树(AST)向编码器提供结构信息。然而,AST 通常远长于源代码,而当前方法忽视编码器长度限制,直接将完整线性化 AST 输入编码器,导致计算开销大、难以扩展。为此,本文提出 AST-Transformer,能够高效编码树结构 AST。实验表明,AST-Transformer 在多个基准上显著优于当时的最先进方法,同时在编码阶段减少约 90%–95% 的计算复杂度,兼顾性能与效率。
Code summarization aims to generate brief natural language descriptions for source code. As source code is highly structured and follows strict programming language grammars, its Abstract Syntax Tree (AST) is often leveraged to inform the encoder about the structural information. However, ASTs are usually much longer than the source code. Current approaches ignore the size limit and simply feed the whole linearized AST into the encoder. To address this problem, we propose AST-Transformer to efficiently encode tree-structured ASTs. Experiments show that AST-Transformer outperforms the state-of-arts by a substantial margin while being able to reduce 90 ~ 95% of the computational complexity in the encoding process.
DOI 原文 ·
@inproceedings{paperbot6549,
title = {AST-Transformer: Encoding Abstract Syntax Trees Efficiently for Code Summarization},
author = {Ze Tang and Chuanyi Li and Jidong Ge and Xiaoyu Shen and Zheling Zhu and Bin Luo},
booktitle = {ASE},
year = {2021},
doi = {10.1109/ase51524.2021.9678882}
}