Understanding Long Programming Languages with Structure-Aware Sparse Attention
Not on the map. Why?
Abstract (arXiv)
Programming-based Pre-trained Language Models (PPLMs) such as CodeBERT have achieved great success in many downstream code-related tasks. Since the memory and computational complexity of self-attention in the Transformer grow quadratically with the sequence length, PPLMs typically limit the code length to 512. However, codes in real-world applications are generally long, such as code searches, which cannot be processed efficiently by existing PPLMs. To solve this problem, in this paper, we present SASA, a Structure-Aware Sparse Attention mechanism, which reduces the complexity and improves performance for long code understanding tasks. The key components in SASA are top-k sparse attention and Abstract Syntax Tree (AST)-based structure-aware attention. With top-k sparse attention, the most crucial attention relation can be obtained with a lower computational cost. As the code structure represents the logic of the code statements, which is a complement to the code sequence characteristics, we further introduce AST structures into attention. Extensive experiments on CodeXGLUE tasks show that SASA achieves better performance than the competing baselines.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 22 of its 26 references that are in the map. First posted on arXiv 27 May 2022.
Builds on
22 of 26 references.
References · 22
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2018Deep contextualized word representationscited by 2,290
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
- 2020Big Bird: Transformers for Longer Sequencescited by 1,684
- 2019Generating Long Sequences with Sparse Transformerscited by 1,546
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
10 more
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2021Unified Pre-training for Program Understanding and Generationcited by 366
- 2019Revealing the Dark Secrets of BERTcited by 301
- 2019Blockwise Self-Attention for Long Document Understandingcited by 159
- 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 69
- 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
- 2019Learning and Evaluating Contextual Embedding of Source Codecited by 33
- 2021Code Structure Guided Transformer for Source Code Summarizationcited by 30
- 2020Code Summarization with Structure-induced Transformercited by 29
- 2020SCELMo: Source Code Embeddings from Language Modelscited by 16
Built on by
Not cited yet.