Enriching Source Code with Contextual Data for Code Completion Models: An Empirical Study
Not on the map. Why?
Abstract (arXiv)
Transformer-based pre-trained models have recently achieved great results in solving many software engineering tasks including automatic code completion which is a staple in a developer's toolkit. While many have striven to improve the code-understanding abilities of such models, the opposite -- making the code easier to understand -- has not been properly investigated. In this study, we aim to answer whether making code easier to understand through using contextual data improves the performance of pre-trained code language models for the task of code completion. We consider type annotations and comments as two common forms of additional contextual information that often help developers understand code better. For the experiments, we study code completion in two granularity levels; token and line completion and take three recent and large-scale language models for source code: UniXcoder, CodeGPT, and InCoder with five evaluation metrics. Finally, we perform the Wilcoxon Signed Rank test to gauge significance and measure the effect size. Contrary to our expectations, all models perform better if type annotations are removed (albeit the effect sizes are small). For comments, we find that the models perform better in the presence of multi-line comments (again with small effect sizes). Based on our observations, we recommend making proper design choices when training, fine-tuning, or simply selecting such models given the intended data and application. Better evaluations and multi-modal techniques can also be further investigated to improve the practicality and accuracy of auto-completions.
Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). Builds on 32 of its 51 references that are in the map. First posted on arXiv 24 Apr 2023.
Builds on
32 of 51 references.
References · 32
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2018A Call for Clarity in Reporting BLEU Scorescited by 1,799
- 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
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
20 more
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2020IntelliCode Compose: Code Generation Using Transformercited by 227
- 2022CM3: A Causal Masked Multimodal Model of the Internetcited by 142
- 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 126
- 2019A Neural Model for Generating Natural Language Summaries of Program Subroutinescited by 77
- 2022CodeFill: Multi-token Code Completion by Jointly Learning from Structure and Naming Sequencescited by 50
- 2020LambdaNet: Probabilistic Type Inference using Graph Neural Networkscited by 44
- 2019Cloze-driven Pretraining of Self-attention Networkscited by 41
- 2023Extending Source Code Pre-Trained Language Models to Summarise Decompiled Binariescited by 26
- 2021An Empirical Study on the Usage of BERT Models for Code Completioncited by 22
- 2021An Empirical Study on the Usage of Transformer Models for Code Completioncited by 22
- 2020Topic Recommendation for Software Repositories using Multi-label Classification Algorithmscited by 20
- 2020Empirical Study of Transformers for Source Codecited by 13
- 2020Predicting the Objective and Priority of Issue Reports in Software Repositoriescited by 11
- 2019Combining Program Analysis and Statistical Language Model for Code Statement Completioncited by 5
- 2021An Empirical Study on Code Comment Completioncited by 5
- 2022On the Evaluation of NLP-based Models for Software Engineeringcited by 5
- 2022CatIss: An Intelligent Tool for Categorizing Issues Reports using Transformerscited by 5
- 2023STACC: Code Comment Classification using SentenceTransformerscited by 5
- 2022An Empirical Study on Data Leakage and Generalizability of Link Prediction Models for Issues and Commitscited by 1
Built on by
Citing papers per year: 2023: 2; 2024: 3; 2025: 2; 2026: 1.
8 papers.
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 353
- 2024Language Models for Code Completion: A Practical Evaluationcited by 39
- 2024Investigating the Performance of Language Models for Completing Code in Functional Programming Languages: a Haskell Case Studycited by 7
- 2024GitChameleon: Unmasking the Version-Switching Capabilities of Code Generation Modelscited by 6
- 2023On the Impact of Language Selection for Training and Evaluating Programming Language Modelscited by 4
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuningcited by 3
- 2025Structure-Aware Corpus Construction and User-Perception-Aligned Metrics for Large-Language-Model Code Completioncited by 0
- 2026On the Impact of Code Comments for Automated Bug-Fixing: An Empirical Studycited by 0
- 2026On the Impact of Code Comments for Automated Bug-Fixing: An Empirical Study30 Jan 2026
- 2025Structure-Aware Corpus Construction and User-Perception-Aligned Metrics for Large-Language-Model Code Completion19 May 2025
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuning29 Jan 2025
- 2024GitChameleon: Unmasking the Version-Switching Capabilities of Code Generation Models5 Nov 2024
- 2024Investigating the Performance of Language Models for Completing Code in Functional Programming Languages: a Haskell Case Study22 Mar 2024
- 2024Language Models for Code Completion: A Practical Evaluation25 Feb 2024
- 2023On the Impact of Language Selection for Training and Evaluating Programming Language Models25 Aug 2023
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systems5 Jun 2023