Enriching Source Code with Contextual Data for Code Completion Models

An Empirical Study

Conference Paper (2023)
Authors

Tim van Dam (Student TU Delft)

M. Izadi (TU Delft - Software Engineering)

Arie Van Deursen (TU Delft - Software Technology)

Research Group
Software Engineering
Copyright
© 2023 Tim van Dam, M. Izadi, A. van Deursen
To reference this document use:
https://doi.org/10.1109/MSR59073.2023.00035
More Info
expand_more
Publication Year
2023
Language
English
Copyright
© 2023 Tim van Dam, M. Izadi, A. van Deursen
Research Group
Software Engineering
Pages (from-to)
170-182
ISBN (print)
979-8-3503-1185-3
ISBN (electronic)
979-8-3503-1184-6
DOI:
https://doi.org/10.1109/MSR59073.2023.00035
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

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 multimodal techniques can also be further investigated to improve the practicality and accuracy of auto-completions.

Files

Enriching_Source_Code_with_Con... (pdf)
(pdf | 1.03 Mb)
- Embargo expired in 12-01-2024
License info not available