AST-Transformer: Encoding Abstract Syntax Trees Efficiently for Code Summarization
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\sim95\%$ of the computational complexity in the encoding process.
Code (0)
등록된 구현이 없습니다.
Tasks
Code SummarizationSimilar Papers 제목 키워드 기반
A Structural Transformer with Relative Positions in Trees for Code-to-Sequence Tasks
We suggest two approaches to incorporate syntactic information into transformer models encoding trees (e.g. abstract syntax trees) and generating sequences. First, we use self-attention with relative position representat…
Code SummarizationMachine TranslationPositionSource Code Summarization+1Syntax-BERT: Improving Pre-trained Transformers with Syntax Trees
Pre-trained language models like BERT achieve superior performances in various NLP tasks without explicit consideration of syntactic information. Meanwhile, syntactic information has been proved to be crucial for the suc…
Natural Language UnderstandingSparse Attention-Based Neural Networks for Code Classification
Categorizing source codes accurately and efficiently is a challenging problem in real-world programming education platform management. In recent years, model-based approaches utilizing abstract syntax trees (ASTs) have b…
ClassificationCode ClassificationExplainable Natural Language to Bash Translation using Abstract Syntax Tree
Natural language processing for program synthesis has been widely researched. In this work, we focus on generating Bash commands from natural language invocations with explanations. We propose a novel transformer based s…
Program SynthesisTranslationImproving Code Summarization with Block-wise Abstract Syntax Tree Splitting
Automatic code summarization frees software developers from the heavy burden of manual commenting and benefits software development and maintenance. Abstract Syntax Tree (AST), which depicts the source code's syntactic s…
Code SummarizationSource Code Summarization