An Empirical Study on the Usage of Transformer Models for Code Completion
Open accessThe DOI matches its Crossref record; 25 of the 25 references it cites were found in a registry or an index.
Abstract
Code completion aims at speeding up code writing by predicting the next code token(s) the developer is likely to write. Works in this field focused on improving the accuracy of the generated predictions, with substantial leaps forward made possible by deep learning (DL) models. However, code completion techniques are mostly evaluated in the scenario of predicting the next token to type, with few exceptions pushing the boundaries to the prediction of an entire code statement. Thus, little is known about the performance of state-of-the-art code completion approaches in more challenging scenarios in which, for example, an entire code block must be generated. We present a large-scale study exploring the capabilities of state-of-the-art Transformer-based models in supporting code completion at different granularity levels, including single tokens, one or multiple entire statements, up to entire code blocks (e.g., the iterated block of a for loop). We experimented with several variants of two recently proposed Transformer-based models, namely RoBERTa and the Text-To-Text Transfer Transformer (T5), for the task of code completion. The achieved results show that Transformer-based models, and in particular the T5, represent a viable solution for code completion, with perfect predictions ranging from ~29%, obtained when asking the model to guess entire blocks, up to ~69%, reached in the simpler scenario of few tokens masked from the same code statement.
Overview
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Integrity signals
Registry
Cites
Statistics
Verification
Claims the paper makes
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Self-check
Percentages, sums and reported differences re-computed from the paper’s own numbers.
The self-check needs the paper’s full text.
Citations
Cites
Controlling the False Discovery Rate: A Practical and Powerful Approach to Multiple Testing
Benjamini, Y., & Hochberg, Y. (1995) · Journal of the Royal Statistical Society Series B: Statistical Methodology · doi:10.1111/j.2517-6161.1995.tb02031.x · Cited by 109,482
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2018) · arXiv · doi:10.48550/arxiv.1810.04805 · Cited by 73,173
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019) · Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers) · doi:10.18653/v1/n19-1423 · Cited by 54,325
RoBERTa: A Robustly Optimized BERT Pretraining Approach
Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., & Stoyanov, V. (2019) · arXiv · doi:10.48550/arxiv.1907.11692 · Cited by 16,515
Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., & Liu, P. J. (2019) · arXiv · doi:10.48550/arxiv.1910.10683 · Cited by 10,929
A NEW MEASURE OF RANK CORRELATION
KENDALL, M. G. (1938) · Biometrika · doi:10.1093/biomet/30.1-2.81 · Cited by 7,269
Note on the Sampling Error of the Difference Between Correlated Proportions or Percentages
McNemar, Q. (1947) · Psychometrika · doi:10.1007/bf02295996 · Cited by 4,754
HuggingFace's Transformers: State-of-the-art Natural Language Processing
Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., et al. (2019) · arXiv · doi:10.48550/arxiv.1910.03771 · Cited by 3,347
Kudo, T., & Richardson, J. (2018) · Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations · doi:10.18653/v1/d18-2012 · Cited by 2,869
Code completion with statistical language models
Raychev, V., Vechev, M., & Yahav, E. (2014) · Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation · doi:10.1145/2594291.2594321 · Cited by 555 · cited 1×
“[69] approach the code completion problem through statistical language models.”
CodeSearchNet Challenge: Evaluating the State of Semantic Code Search
Husain, H., Wu, H.-H., Gazit, T., Allamanis, M., & Brockschmidt, M. (2019) · arXiv · doi:10.48550/arxiv.1909.09436 · Cited by 483 · cited 1×
“The finetuning dataset has been built starting from the CodeSearchNet dataset [41], which features Java methods mined from open source projects.”
MethodIntelliCode compose: code generation using transformer
Svyatkovskiy, A., Deng, S. K., Fu, S., & Sundaresan, N. (2020) · Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering · doi:10.1145/3368089.3417058 · Cited by 474 · cited 3×
“Last, but not least, Deep Learning (DL) models have been applied to code completion [8], [22], [47], [49], [73], [84], setting new standards in terms of prediction performance.”
On the naturalness of software
Hindle, A., Barr, E. T., Su, Z., Gabel, M., & Devanbu, P. (2012) · 2012 34th International Conference on Software Engineering (ICSE) · doi:10.1109/icse.2012.6227135 · Cited by 425 · cited 2×
“[39] pioneered the work on statistical lan-”
MethodAn Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translation
Tufano, M., Watson, C., Bavota, G., Penta, M. D., White, M., & Poshyvanyk, D. (2019) · ACM Transactions on Software Engineering and Methodology · doi:10.1145/3340544 · Cited by 370 · cited 3×
“[80], we excluded from our datasets all the methods having more than 100 tokens.”
MethodSelf-citationAre deep neural networks the best choice for modeling source code?
Hellendoorn, V. J., & Devanbu, P. (2017) · Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering · doi:10.1145/3106237.3106290 · Cited by 292 · cited 13×
“nism as proposed byHellendoorn andDevanbu [36].”
BackgroundMethodResultInfluentialTu, Z., Su, Z., & Devanbu, P. (2014) · Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering · doi:10.1145/2635868.2635875 · Cited by 238 · cited 3×
“[77] introduced a cache component to exploit the “localness of code” in the n-gram model.”
BackgroundMethodCodeBLEU: a Method for Automatic Evaluation of Code Synthesis
Ren, S., Guo, D., Lu, S., Zhou, L., Liu, S., Tang, D., Sundaresan, N., Zhou, M., Blanco, A., & Ma, S. (2020) · arXiv · doi:10.48550/arxiv.2009.10297 · Cited by 214 · cited 1×
“However, the BLEU score may be sufficient to assess the performance of code-related tasks [71] and, in general, it is difficult to evaluate the usefulness of semantic equivalent predictions or”
BackgroundCode Prediction by Feeding Trees to Transformers
Kim, S., Zhao, J., Tian, Y., & Chandra, S. (2021) · 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE) · doi:10.1109/icse43902.2021.00026 · Cited by 209 · cited 3×
“Last, but not least, Deep Learning (DL) models have been applied to code completion [8], [22], [47], [49], [73], [84], setting new standards in terms of prediction performance.”
BackgroundMulti-task Learning based Pre-trained Language Model for Code Completion
Liu, F., Li, G., Zhao, Y., & Jin, Z. (2020) · Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering · doi:10.1145/3324884.3416591 · Cited by 188
Big code != big vocabulary: open-vocabulary models for source code
Karampatsis, R.-M., Babii, H., Robbes, R., Sutton, C., & Janes, A. (2020) · Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering · doi:10.1145/3377811.3380342 · Cited by 182
Improving code completion with program history
Robbes, R., & Lanza, M. (2010) · Automated Software Engineering · doi:10.1007/s10515-010-0064-x · Cited by 95 · cited 3×
“Robbes and Lanza [72] used information extracted from the change history of software systems to support the code completion of method calls and class names.”
BackgroundMethodFast and Memory-Efficient Neural Code Completion
Svyatkovskiy, A., Lee, S., Hadjitofi, A., Riechert, M., Franco, J. V., & Allamanis, M. (2021) · 2021 IEEE/ACM 18th International Conference on Mining Software Repositories (MSR) · doi:10.1109/msr52588.2021.00045 · Cited by 95
When Code Completion Fails: A Case Study on Real-World Completions
Hellendoorn, V. J., Proksch, S., Gall, H. C., & Bacchelli, A. (2019) · 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE) · doi:10.1109/icse.2019.00101 · Cited by 76
CACHECA: A Cache Language Model Based Code Suggestion Tool
Franks, C., Tu, Z., Devanbu, P., & Hellendoorn, V. (2015) · 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering · doi:10.1109/icse.2015.228 · Cited by 30 · cited 1×
“[26] implemented CACHECA, an Eclipse auto-completion plugin exploiting the aforementioned cache language model [77].”
MethodLearning Autocompletion from Real-World Datasets
Aye, G. A., Kim, S., & Li, H. (2021) · 2021 IEEE/ACM 43rd International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP) · doi:10.1109/icse-seip52600.2021.00022 · Cited by 29
Research works printed but not linked: 56
- 10.1109/ICSE.2009.5070525 · DOI · Paper page
- 10.1109/ASE.2008.43 · DOI · Paper page
- 10.1145/1321631.1321663 · DOI · Paper page
- 10.1109/ASE.2004.1342740 · DOI
- 10.1109/ICSE.2019.00021 · DOI · Paper page
- 10.1109/ASE.2009.64 · DOI · Paper page
- 10.1145/2491956.2462192 · DOI · Paper page
- 10.1145/2950290.2950334 · DOI · Paper page
- grissom, 2005, Effect Sizes for Research A Broad Practical Approach
- 10.1007/s10515-011-0083-2 · DOI
- 10.1109/ASE.2009.64 · DOI · Paper page
- 10.1109/TSE.2011.84 · DOI · Paper page
- nguyen, 2016, A Large-Scale Study on Repetitiveness, Containment, and Composability of Routines in Open-Source Projects, 2016 IEEE/ACM 13th Conference on Mining Software Repositories (MSR), 362
- 10.1109/ICSE.2012.6227205 · DOI · Paper page
- 10.1145/3196398.3196460 · DOI
- nguyen, 2015, Graph-based statistical language model for code, Proceedings of the International Conference on Software Engineering ICSE'94, 858
- gage, 1994, A new algorithm for data compression, C Users J, 12, 23
- 10.1016/j.jss.2016.07.026 · DOI
- 10.1145/2744200 · DOI · Paper page
- 10.1145/1806799.1806868 · DOI
- 10.1109/MSR.2013.6624031 · DOI
- 0, Hugging Face’s Tokenizer Repositor
- 10.1109/TSE.2019.2940179 · DOI · Paper page
- 10.1109/MSR52588.2021.00024 · DOI · Paper page
- 10.1109/MSR52588.2021.00074 · DOI
- dreyer, 2012, HyTER: Meaning-equivalent semantics for translation evaluation, Proc Conf North Amer Chapter Assoc Comput Linguistics Hum Lang Technol, 162
- levenshtein, 1966, Binary codes capable of correcting deletions, insertions and reversals, Sov Phys Doklady, 10, 707
- 10.1109/ICSE43902.2021.00041 · DOI · Paper page
- 10.1145/3196398.3196450 · DOI
- 10.1145/1065010.1065018 · DOI · Paper page
- 10.1109/TSE.2019.2924886 · DOI
- 10.1109/TSE.2020.3018481 · DOI
- 10.24963/ijcai.2018/578 · DOI · Paper page
- 10.1109/ICSME.2014.110 · DOI
- 10.1109/ICSM.2011.6080790 · DOI · Paper page
- 10.1109/ICSME.2017.80 · doi:10.1109/icsme.2017.80
- 10.1145/3360585 · DOI · Paper page
- 10.1145/1176617.1176671 · DOI · Paper page
- 10.1145/3377811.3380429 · DOI · Paper page
- vaswani, 2017, Attention is all you need, Proc Adv Neural Inf Process Syst, 6000
- 10.1109/MSR.2015.38 · DOI · Paper page
- 10.1145/1595696.1595728 · DOI · Paper page
- 10.1109/ICSE43902.2021.00025 · DOI
- 10.1109/TSE.2021.3074309 · DOI
- 0, ScrML Website
- 0, N-gram Cached Model
- 10.1007/978-0-387-32833-1_11 · DOI
- 0, Weights and Biases Website
- 10.2307/3001968 · DOI · Paper page
- alon, 2020, Structural language models of code, Proc Int Conf Mach Learn, 245
- allamanis, 0, CodeSearchNet Deduplication Algorithm
- 10.1109/ICSE.2012.6227136 · DOI
- 10.1145/3290353 · DOI · Paper page
- 10.1109/ASE.2019.00062 · DOI
- 10.1145/3196398.3196474 · DOI
- 10.1109/ASE.2017.8115626 · DOI · Paper page
Cited by
Large Language Models for Software Engineering: A Systematic Literature Review
Hou, X., Zhao, Y., Liu, Y., Yang, Z., Wang, K., Li, L., Luo, X., Lo, D., Grundy, J., & Wang, H. (2024) · ACM Transactions on Software Engineering and Methodology · doi:10.1145/3695988 · Cited by 1,029
Large Language Models for Software Engineering: A Systematic Literature Review
Hou, X., Zhao, Y., Liu, Y., Yang, Z., Wang, K., Li, L., Luo, X., Lo, D., Grundy, J., & Wang, H. (2023) · arXiv · doi:10.48550/arxiv.2308.10620 · Cited by 114
“Specifically, LLMs have already shown success in SE-based tasks like code completion [44, 123, 303], bug detection [66], and comment generation [74, 184].”
BackgroundLarge language models for code completion: A systematic literature review
Husein, R. A., Aburajouh, H., & Catal, C. (2025) · Computer Standards & Interfaces · doi:10.1016/j.csi.2024.103917 · Cited by 72
Language Models for Code Completion: A Practical Evaluation
Izadi, M., Katzy, J., van Dam, T., Otten, M., Popescu, R. M., & van Deursen, A. (2024) · arXiv · doi:10.48550/arxiv.2402.16197 · Cited by 57
Unveiling ChatGPT’s usage in open source projects: A mining-based study
Tufano, R., Mastropaolo, A., Pepe, F., Dabic, O., Di Penta, M., & Bavota, G. (2024) · Proceedings of the 21st International Conference on Mining Software Repositories · doi:10.1145/3643991.3644918 · Cited by 38
Self-citation
Metadata
- Authors
- Ciniselli, M., Cooper, N., Pascarella, L., Mastropaolo, A., Aghajani, E., Poshyvanyk, D., Di Penta, M., & Bavota, G.
- Venue
- IEEE Transactions on Software Engineering
- Published
- 2021
- Pages
- 1-1
- ISSN
- 0098-5589 (ISSN-L)
- 1939-3520
- 2326-3881
- OpenAlex
- W3189653670
- Cited by
- 94
- References
- 25
- FWCI
- 14.41
- Type
- journal article
- Language
- en
- Open access
- green
- Licence
- Funders
- H2020 European Research Council (851720)
About these checks
Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.
Statistics and arithmetic are recomputed, not judged.
Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.
What counts as a claim ›How we measure confidence ›How we check this ›
Are you an author, or do you see a problem with this page? Request a review
Data sources
Bibliographic data: Semantic Scholar, OpenAlex, Crossref.
Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).
Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.