To What Extent do Deep Learning-based Code Recommenders Generate Predictions by Cloning Code from the Training Set?
Not on the map. Why?
Abstract (arXiv)
Deep Learning (DL) models have been widely used to support code completion. These models, once properly trained, can take as input an incomplete code component (e.g., an incomplete function) and predict the missing tokens to finalize it. GitHub Copilot is an example of code recommender built by training a DL model on millions of open source repositories: The source code of these repositories acts as training data, allowing the model to learn "how to program". The usage of such a code is usually regulated by Free and Open Source Software (FOSS) licenses, that establish under which conditions the licensed code can be redistributed or modified. As of Today, it is unclear whether the code generated by DL models trained on open source code should be considered as "new" or as "derivative" work, with possible implications on license infringements. In this work, we run a large-scale study investigating the extent to which DL models tend to clone code from their training set when recommending code completions. Such an exploratory study can help in assessing the magnitude of the potential licensing issues mentioned before: If these models tend to generate new code that is unseen in the training set, then licensing issues are unlikely to occur. Otherwise, a revision of these licenses urges to regulate how the code generated by these models should be treated when used, for example, in a commercial setting. Highlights from our results show that ~10% to ~0.1% of the predictions generated by a state-of-the-art DL-based code completion tool are Type-1 clones of instances in the training set, depending on the size of the predicted code. Long predictions are unlikely to be cloned.
Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). First posted on arXiv 14 Apr 2022.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2022: 2; 2023: 3; 2024: 4; 2025: 1; 2026: 1.
11 papers.
- 2022Automatic Generation of Programming Exercises and Code Explanations using Large Language Modelscited by 126
- 2024MELTing point: Mobile Evaluation of Language Transformerscited by 36
- 2023Exploring the Robustness of Large Language Models for Solving Programming Problemscited by 16
- 2023From Copilot to Pilot: Towards AI Supported Software Developmentcited by 14
- 2023Do Large Language Models Pay Similar Attention Like Human Programmers When Generating Code?cited by 14
- 2022All You Need Is Logs: Improving Code Completion by Learning from Anonymous IDE Usage Logscited by 9
- 2024Trained Without My Consent: Detecting Code Inclusion In Language Models Trained on Codecited by 8
- 2024GitHub Copilot: the perfect Code compLeeter?cited by 4
- 2024Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorizationcited by 4
- 2025Are AI Coders Snitches? An Empirical Study of Pretraining Data Detection on Code Large Language Modelscited by 0
- 2026Understanding Secret Leakage Risks in Code LLMs: A Tokenization Perspectivecited by 0
- 2026Understanding Secret Leakage Risks in Code LLMs: A Tokenization Perspective20 Apr 2026
- 2025Are AI Coders Snitches? An Empirical Study of Pretraining Data Detection on Code Large Language Models23 Jul 2025
- 2024Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorization18 Sep 2024
- 2024GitHub Copilot: the perfect Code compLeeter?17 Jun 2024
- 2024MELTing point: Mobile Evaluation of Language Transformers19 Mar 2024
- 2024Trained Without My Consent: Detecting Code Inclusion In Language Models Trained on Code14 Feb 2024
- 2023Exploring the Robustness of Large Language Models for Solving Programming Problems26 Jun 2023
- 2023Do Large Language Models Pay Similar Attention Like Human Programmers When Generating Code?2 Jun 2023
- 2023From Copilot to Pilot: Towards AI Supported Software Development7 Mar 2023
- 2022Automatic Generation of Programming Exercises and Code Explanations using Large Language Models3 Jun 2022
- 2022All You Need Is Logs: Improving Code Completion by Learning from Anonymous IDE Usage Logs21 May 2022