ACL-2021 Learning Sequential and Structural Information for Source Code Summarization

· ACL· · Transformer, GNN

Paper: Learning Sequential and Structural Information for Source Code Summarization

mAST + GCN for structure, Transformer for sequence

Abstract

Structural information is encoded with mAST and a GCN; the resulting sequence of AST nodes is then encoded by a Transformer.

Introduction

To represent structural information more effectively, the authors modify the AST by adding sibling edges among nodes at the same level to capture adjacent blocks.

Model

Representing Code as mAST

avatar

For Java code, adjacent edges are added between same-level neighbors.

avatar For Python, the authors find function names especially important and therefore introduce a dedicated function-name node with additional edges. #### Proposed Model
avatar The authors argue that mAST captures information from adjacent blocks, GCN brings representations of structurally neighboring nodes closer in semantic space, and the Transformer models long-range dependencies within the same block. ### Experiment
avatar
avatar Ablation results and datasets are shown above.
avatar The authors also study where to place the GCN relative to the Transformer encoder (before, after, or both). Performance differs little across placements; placing GCN before the encoder appears slightly preferable.
avatar Experiments on the number of GCN layers are also reported. <HR align=left color=#987cb9 SIZE=1>