arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2112.00663cs.LGcs.PL
收藏

图条件稀疏注意改进Source Code理解

Graph Conditioned Sparse-Attention for Improved Source Code Understanding

University of Southern California(南加州大学)

Junyan Cheng, Iordanis Fostiropoulos, Barry Boehm

摘要:

Transformer体系结构已成功用于学习源代码表示。像抽象树(AST)和源代码序列之间的融合图表示使得使用当前的方法计算上难以处理的大输入序列长度。源代码可能具有长范围依赖关系,需要更长的序列长度才能有效地建模。目前的方法具有相对于序列长度的计算和存储器成本的二次增长。在实际场景中使用这样的模型是困难的。在这项工作中,我们提出了一个源代码片段与其图形模态的条件,通过使用图形邻接矩阵作为一个稀疏的自我注意力机制和使用的图形扩散机制模型较长范围的令牌依赖的注意力掩码。我们的模型在BLEU,METEOR和ROUGE-L指标中达到了最先进的结果,用于代码摘要任务,在变量误用任务中达到了接近最先进的准确性。我们的模型的内存使用和推理时间相对于输入序列长度线性增长相比,以前的作品的二次增长。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑