Bridge and Hint: Extending Pre-trained Language Models for Long-Range Code
Open Access
- 11 September 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 274-286
Abstract
In the field of code intelligence, effectively modeling long-range code poses a significant challenge. Existing pre-trained language models (PLMs) such as UniXcoder have achieved remarkable success, but they still face difficulties with long code inputs. This is mainly due to their limited capacity to maintain contextual continuity and memorize the key information over long-range code. To alleviate the difficulties, we propose EXPO, a framework for EXtending Pre-trained language models for lOng-range code. EXPO incorporates two innovative memory mechanisms we propose in this paper: Bridge Memory and Hint Memory. Bridge Memory uses a tagging mechanism to connect disparate snippets of long-range code, helping the model maintain contextual coherence. Hint Memory focuses on crucial code elements throughout the global context, such as package imports, by integrating a 𝑘NN attention layer to adaptively select the relevant code elements. This dual-memory approach bridges the gap between understanding local code snippets and maintaining global code coherence, thereby enhancing the model’s overall comprehension of long code sequences. We validate the effectiveness of EXPO on five popular pre-trained language models such as UniXcoder and two code intelligence tasks including API recommendation and vulnerability detection. Experimental results demonstrate that EXPO significantly improves the pre-training language models.Keywords
All Related Versions
Funding Information
- Natural Science Foundation of Guangdong Province (No. 2023A1515011959)
- Shenzhen-Hong Kong Jointly Funded Project (No. SGDX20230116091246007)
- Shenzhen Basic Research (No. JCYJ20220531095214031)
- Shenzhen International Science and Technology Cooperation Project (No. GJHZ20220913143008015)
- The Major Key Project of PCL (No. PCL2022A03)
This publication has 21 references indexed in Scilit:
- API Usage Recommendation Via Multi-View Heterogeneous Graph Representation LearningIEEE Transactions on Software Engineering, 2023
- Revisiting, Benchmarking and Exploring API Recommendation: How Far Are We?IEEE Transactions on Software Engineering, 2022
- CRaDLe: Deep code retrieval based on semantic Dependency LearningNeural Networks, 2021
- Deep Learning Based Vulnerability Detection: Are We There Yet?IEEE Transactions on Software Engineering, 2021
- Code Prediction by Feeding Trees to Transformers2021
- Boosting API Recommendation With Implicit FeedbackIEEE Transactions on Software Engineering, 2021
- SySeVR: A Framework for Using Deep Learning to Detect Software VulnerabilitiesIEEE Transactions on Dependable and Secure Computing, 2021
- A Novel Neural Source Code Representation Based on Abstract Syntax Tree2019
- Do developers update their library dependencies?Empirical Software Engineering, 2017
- An empirical study of the impact of modern code review practices on software qualityEmpirical Software Engineering, 2015