paper-with-me

홈 › Papers

Source Code Summarization with Structural Relative Position Guided Transformer

2022-02-14 · Zi Gong, Cuiyun Gao, Yasheng Wang, Wenchao Gu, Yun Peng, Zenglin Xu

Source code summarization aims at generating concise and clear natural language descriptions for programming languages. Well-written code summaries are beneficial for programmers to participate in the software development and maintenance process. To learn the semantic representations of source code, recent efforts focus on incorporating the syntax structure of code into neural networks such as Transformer. Such Transformer-based approaches can better capture the long-range dependencies than other neural networks including Recurrent Neural Networks (RNNs), however, most of them do not consider the structural relative correlations between tokens, e.g., relative positions in Abstract Syntax Trees (ASTs), which is beneficial for code semantics learning. To model the structural dependency, we propose a Structural Relative Position guided Transformer, named SCRIPT. SCRIPT first obtains the structural relative positions between tokens via parsing the ASTs of source code, and then passes them into two types of Transformer encoders. One Transformer directly adjusts the input according to the structural relative distance; and the other Transformer encodes the structural relative positions during computing the self-attention scores. Finally, we stack these two types of Transformer encoders to learn representations of source code. Experimental results show that the proposed SCRIPT outperforms the state-of-the-art methods by at least 1.6%, 1.4% and 2.8% with respect to BLEU, ROUGE-L and METEOR on benchmark datasets, respectively. We further show that how the proposed SCRIPT captures the structural relative dependencies.

📄 PDF Abstract BibTeX arXiv:2202.06521

Code (1)

gonez5/script 공식 구현 pytorch

Tasks

Code SummarizationPositionSource Code Summarization

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Layer Normalization Unlike batch normalization, Layer Normalization directly estimates the normalization statistics from the summed inputs…
Multi-Head Attention 설명 없음
Dense Connections Dense Connections, or Fully Connected Connections, are a type of layer in a deep neural network that use a linear operation where every input is connected to every output…
BPE Byte Pair Encoding, or BPE, is a subword segmentation algorithm that encodes rare and unknown words as sequences of subword units. The intuition is that various word…
Dropout Dropout is a regularization technique for neural networks that drops a unit (along with connections) at training time with a specified probability $p$ (a common value is…

Similar Papers 제목 키워드 기반

A Structural Transformer with Relative Positions in Trees for Code-to-Sequence Tasks

2020-06-04 · Anonymous

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+1

A Transformer-based Approach for Source Code Summarization

2020-05-01 · ACL 2020 6 · Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, Kai-Wei Chang

Generating a readable summary that describes the functionality of a program is known as source code summarization. In this task, learning code representation by modeling the pairwise relationship between code tokens to c…

Code SummarizationPositionSource Code Summarization

Retrieval-based Layer-wise Adaptive Transformer for Source Code Summarization

2021-11-16 · ACL ARR November 2021 11 · Anonymous

We propose a model that learns both the sequential and the structural features of code for source code summarization. We adopt the Abstract Syntax Tree (AST) and graph convolution to model the structural information and …

Code SummarizationRetrievalSource Code Summarization

Modeling Hierarchical Syntax Structure with Triplet Position for Source Code Summarization

2021-11-16 · ACL ARR November 2021 11 · Anonymous

Automatic code summarization, which aims to describe the source code in natural language, has become an essential task in software maintenance. Our fellow researchers have attempted to achieve such a purpose through vari…

Code SummarizationGraph Neural NetworkPositionSource Code Summarization+1

Modeling Hierarchical Syntax Structure with Triplet Position for Source Code Summarization

2022-05-01 · ACL 2022 5 · Juncai Guo, Jin Liu, Yao Wan, Li Li 외

Automatic code summarization, which aims to describe the source code in natural language, has become an essential task in software maintenance. Our fellow researchers have attempted to achieve such a purpose through vari…

Code SummarizationGraph Neural NetworkPositionSource Code Summarization+1