Graph Conditioned Sparse-Attention for Improved Source Code Understanding

12/01/2021
by   Junyan Cheng, et al.
0

Transformer architectures have been successfully used in learning source code representations. The fusion between a graph representation like Abstract Syntax Tree (AST) and a source code sequence makes the use of current approaches computationally intractable for large input sequence lengths. Source code can have long-range dependencies that require larger sequence lengths to model effectively. Current approaches have a quadratic growth in computational and memory costs with respect to the sequence length. Using such models in practical scenarios is difficult. In this work, we propose the conditioning of a source code snippet with its graph modality by using the graph adjacency matrix as an attention mask for a sparse self-attention mechanism and the use of a graph diffusion mechanism to model longer-range token dependencies. Our model reaches state-of-the-art results in BLEU, METEOR, and ROUGE-L metrics for the code summarization task and near state-of-the-art accuracy in the variable misuse task. The memory use and inference time of our model have linear growth with respect to the input sequence length as compared to the quadratic growth of previous works.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/17/2021

GN-Transformer: Fusing Sequence and Graph Representation for Improved Code Summarization

As opposed to natural languages, source code understanding is influenced...
research
05/01/2020

A Transformer-based Approach for Source Code Summarization

Generating a readable summary that describes the functionality of a prog...
research
08/10/2023

AST-MHSA : Code Summarization using Multi-Head Self-Attention

Code summarization aims to generate concise natural language description...
research
02/14/2022

Source Code Summarization with Structural Relative Position Guided Transformer

Source code summarization aims at generating concise and clear natural l...
research
03/22/2020

SAC: Accelerating and Structuring Self-Attention via Sparse Adaptive Connection

While the self-attention mechanism has been widely used in a wide variet...
research
01/28/2022

Compositionality-Aware Graph2Seq Learning

Graphs are a highly expressive data structure, but it is often difficult...
research
05/27/2022

Understanding Long Programming Languages with Structure-Aware Sparse Attention

Programming-based Pre-trained Language Models (PPLMs) such as CodeBERT h...

Please sign up or login with your details

Forgot password? Click here to reset