arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2403.15149cs.SE
收藏

基于深度学习的代码补全在不同编程语言版本间的泛化能力研究

On the Generalizability of Deep Learning-based Code Completion Across Programming Language Versions

Matteo Ciniselli, Alberto Martin-Lopez, Gabriele Bavota

AI总结:

本文评估了CodeT5模型在仅用Java 8训练后对九个Java版本的泛化能力,发现版本差异显著影响性能,并提出版本特定微调可部分缓解此问题。

摘要:

代码补全是集成开发环境(IDEs)的一项关键功能,旨在预测开发者可能编写的下一个词元,帮助他们更快、更省力地编写代码。现代代码补全方法通常由深度学习(DL)模型驱动。然而,编程语言的快速演进对基于DL的代码补全模型的性能构成了严峻挑战:这些模型能否在不同语言版本间泛化?本文深入探讨了这一问题。具体而言,我们评估了最先进的模型CodeT5在九个不同Java版本(从Java 2到Java 17)间的泛化能力,且该模型仅在Java 8代码上进行训练。我们的评估涵盖三种补全场景,即预测词元、构造(如if语句的条件)以及整个代码块。研究结果显示,不同语言版本间存在显著差异,其中Java 2和17的表现最差——这两个版本与Java 8的差异最大。我们调查了性能下降的可能原因,并表明采用有限的版本特定微调可以部分缓解该问题。我们的工作提升了对持续模型优化重要性的认识,并可为设计使代码补全模型对语言演进更具鲁棒性的替代方案提供参考。

英文摘要:

Code completion is a key feature of Integrated Development Environments (IDEs), aimed at predicting the next tokens a developer is likely to write, helping them write code faster and with less effort. Modern code completion approaches are often powered by deep learning (DL) models. However, the swift evolution of programming languages poses a critical challenge to the performance of DL-based code completion models: Can these models generalize across different language versions? This paper delves into such a question. In particular, we assess the capabilities of a state-of-the-art model, CodeT5, to generalize across nine different Java versions, ranging from Java 2 to Java 17, while being exclusively trained on Java 8 code. Our evaluation spans three completion scenarios, namely, predicting tokens, constructs (e.g., the condition of an if statement) and entire code blocks. The results of our study reveal a noticeable disparity among language versions, with the worst performance being obtained in Java 2 and 17 - the most far apart versions compared to Java 8. We investigate possible causes for the performance degradation and show that the adoption of a limited version-specific fine-tuning can partially alleviate the problem. Our work raises awareness on the importance of continuous model refinement, and it can inform the design of alternatives to make code completion models more robust to language evolution.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑