"...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...
...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...
... 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..."
Even if it generates 10% or 0.1% cloned code, it can be completely avoided by filtering and sampling again. This should not be an issue, there could be strong guarantees of non-duplication.
3 comments
[ 4.0 ms ] story [ 19.2 ms ] thread...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...
... 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..."
PDF: https://arxiv.org/pdf/2204.06894.pdf