I'm thinking of such issue (from the position of an open source/source available software developer).

In our days it is very easy to rephrase every text with the help of AI so that the meaning remains the same, but the text itself looks different. I see that currently it is possible to do the same with a source code as well (for example, using GPT-4).

I'm concerned that now such situation is possible. Some existing open source/source available code is processed by some AI tool (for example, which uses a large language model (LLM)) and the source is just 'rephrased' so that it provides the initial functionality, but just looks different (to some extent). Then this 'new' code may be claimed as different code and be published/used on a different license. It is quite an easy way to take open source code and after some relatively easy manipulations use it without any restrictions (for example, in proprietary software).

It is already possible, but I believe that AI possibilities will increase dramatically over time in this area and then open source/source available software which was developed through many years (or even decades) may be easily used without any limitations.

Interesting, is there any work in this area like altering the existing licenses to protect open source projects in the AI era?

  • 2
    Maybe AI should be prevented from learning from code with copyleft licenses and learn to cite authors of non-copyleft licensed code... Mar 22, 2023 at 21:40
  • 1
    @akostadinov Isn't the point of copyleft to increase sharing? That would seem to go against the original licensor's designs.
    – Barmar
    Mar 23, 2023 at 15:58
  • 4
    @Barmar, it is very simpified to say that intention is to increase sharing. Some may say it was to assure software freedom and for software freedom you have to enforce that derivative work is also free. Then you will need a separate AI to give you suggestions different license groups. For example one for copyless, another from GPL compatible, another for some other group, etc. Or you must prove that suggestions are fare use or non-copyrightable excerpts. Mar 23, 2023 at 20:27
  • 1
    @chm you've now got multiple answers, so could we ask that either (a) you accept one, or (b) indicate (by comments, edits, or both) what is lacking, to your mind, and still needs to be answered? Thank you, and my apologies if you were already about to do one of these!
    – MadHatter
    Mar 29, 2023 at 7:19
  • 1
    @chm part of the social compact in asking a question is that you'll accept an answer. If the world changes, and the context of the answers changes with it, you can always come back later, unaccept an accepted answer, and accept a better one. But once you've asked a question, and got answers, you are rather morally obligated to accept one pro tem, even if you've since decided that your question is a bit unanswerable.
    – MadHatter
    Apr 5, 2023 at 12:04

3 Answers 3


I'm not sure anything needs to be done. Historically, the creation of a translation of a copyrighted work required the permission of the rightsholder. Others have argued that a machine translation of a specific work is very likely just another form of translation, and very likely to be similarly-regulated:

While an argument can be made that, theoretically, MT is not "translation" [...] a plain language reading suggests that machine translation performs what it says: translation. As such, machine translation of a text creates derivative work under the Copyright Act and [an MT service provider] may be liable for copyright infringement if that translation is unauthorized.

(From this paper, via this article.) The question of how to treat services like GitHub's Copilot, which make code suggestions based on an AI model trained on large numbers of freely-licensed codebases, is currently before the courts.

Existing free licences rest heavily on rightsholders' control of derivative works. As long as the courts continue to find machine translations to be derivative works, the existing well-established rules around free licensing and derivative works will provide a clear licensing path for translations, and publishers of unlicensed translations can be dealt with through the existing methods for dealing with free-software licence violations.

If the courts start to hold otherwise, it will put machine translations beyond the reach of copyright, and since free software licences are primarily copyright licences, there may not be much that can be done to them to fix the problem.

  • It might also be worth noting that there can be copyright in the overall structure of the code, and not just in the expression of one particular line.
    – Daniel
    Mar 23, 2023 at 15:35
  • 2
    I think there's an important point made here implicitly. There have not yet been cases where these concepts (AI and software licensing) have been tested by a court. Until that happens, the best we can do is speculate and there's no guaranteed solution to the problem. The law has to catch up with the technology.
    – bta
    Mar 23, 2023 at 19:21
  • 1
    I can't quite tell whether you intend to clearly distinguish between an AI that merely performs machine translation vs something like Copilot, which (up for debate) typically produces new, uncopied code from a learned model. I suspect they will be treated differently by courts - in particular, some products of generative AI have been found to be uncopyrightable. Mar 26, 2023 at 22:30
  • 5
    @preferred_anon I do so intend, which is why I point out that the latter are before the courts right now. I am grateful for the pointer you provide to Thaler's case, but I also note that the image has not been "found to be uncopyrightable". No court has yet (afaict) ruled on the issue; it's merely that the US Copyright Office refused to register the work, which is not a requirement for copyright protection, even in the US (see Berne Convention). It will be interesting to see what the courts do with the case, though.
    – MadHatter
    Mar 27, 2023 at 6:20
  • 1
    @MadHatter You're right - I misread the article. It says Thaler has filed a motion, and that registration was denied. I thought it said the motion was denied. Mar 27, 2023 at 9:45

I do not think that AI tools are used in the way you anticipate (to create 'translations' for the purpose to avoid copyright implications). AI learning usually happens by consuming code or language or pictures and extracting patterns and characteristics of that original source without saving a copy of that source. Due to the fact that the original sources are not stored by the AI, outputs are created by applying the patterns and characteristics of many sources, and therefore these outputs are not considered a derivative work of any specific input file.

The underlying legal concept for open source licenses is copyright. The owners of copyright in the code decide what may or may not be done with the code. Any permissions and restrictions by an OSS license can only cover the areas that would otherwise be forbidden under copyright law in the absence of a license.

What does copyright law say? Europe: DSM Directive Article 4: Exception or limitation for text and data mining

  1. Member States shall provide for an exception or limitation to the rights provided for in Article 5(a) and Article 7(1) of Directive 96/9/EC, Article 2 of Directive 2001/29/EC, Article 4(1)(a) and (b) of Directive 2009/24/EC and Article 15(1) of this Directive for reproductions and extractions of lawfully accessible works and other subject matter for the purposes of text and data mining.

  2. Reproductions and extractions made pursuant to paragraph 1 may be retained for as long as is necessary for the purposes of text and data mining.

  3. The exception or limitation provided for in paragraph 1 shall apply on condition that the use of works and other subject matter referred to in that paragraph has not been expressly reserved by their rightholders in an appropriate manner, such as machine-readable means in the case of content made publicly available online.

In summary this means that in Europe publicly accessible content is free to use for AI-learning unless there is a machine-readable ban on the website.

USA: Collecting data from 3rd party websites (so-called screen scraping) is legal but the Supreme Court still has to decide on some AI specific cases

Now what is allowed by the open source licenses? Here a few examples:

MIT License gives a broad blank check for any use. I don't see how AI learning would be excluded "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software ..."

2-clause BSD License provides a very broad license "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ..." where the word 'use' can easily be interpreted to allow the use as input for AI learning.

Apache2 License "Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form." The Apache license does not seem to specifically allow or disallow the use of code for AI learning.

GPLv3 is very specific "You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force." The term 'propagate' in this sentence has a very wide definition: "To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy." I think that would include AI learning. In addition, Section 7 of the GPLv3 license limits the types of restrictions that may be applied.

OSS licenses have been written at times when AI and ML were far away. Would it be possible to add an anti-AI-learning clause to OSS licenses?

If you are the sole copyright holder of code you may set up any license with any restriction, but this would no longer be the MIT license or the BSD license, and others would often refrain from re-using your code due to the fact that it is a crayon license (How can a "crayon" license be a problem?). Existing code (with other copyright holders) cannot easily be re-licensed unless you have the consent of every copyright holder. GPL licensed code more or less excludes any such restrictions.

Is there an SPDX indicator or any other agreed way to disagree with AI-learning?
I am not aware if specific SPDX ID that would be a machine-readable bar against AI, but there is a SPDX community talking about AI.
robots.txt : You can prevent crawlers from searching your own website, and if the AI engine is friendly it will respect your wish. Obviously that will only work for your own website where you control the robots.txt and would not work for 3rd party websites where code is shared (such as GitHub).
website T&Cs: same as robots.txt

GitHub T&Cs: GitHub is owned by Microsoft, and offers its own AI solution for code, Github Copilot. Therefore GitHub has T&Cs which allow for sharing, and you agree to these before you upload any code. In Section D.4 'License Grant to Us' you can find the words "This license includes the right to do things like copy it to our database and make backups; show it to you and other users; parse it into a search index or otherwise analyze it on our servers;..." which sounds like a blank check for AI learning.

So in summary: Yes, you can protect your own code from being used in AI-learning, but current developments in copyright law, the lack of specific OSS licenses for that purpose, and the T&Cs of code sharing websites such as GitHub make it incredibly difficult for you.

  • Great answers in many ways, it just seems to be missing the question a bit, which seems to be rather about use of an already trained model for translating a specific piece of code to another form, rather than training a model on the code. But even for that case, I'm not convinced by the first paragraph: “extracting patterns and characteristics of that original source without saving a copy of that source”. Gradient descent can imprint copies of training data in the model's weights, at least in a sense similar to photocopying a drawing, which certainly does fall under “derivative work”. Mar 29, 2023 at 13:15
  • @BenVoigt, let us continue this discussion in chat. Mar 30, 2023 at 5:46
  • 1
    "The owners of copyright in the code decide what may or may not be done with the code. " - this is an overgeneralization. Copyright owners may decide what may be done in cases where the law reserves that right for the copyright owner. But fair use, for instance, is outside that right.
    – MSalters
    Apr 24, 2023 at 7:48

Assuming OP's concerns are a real possibility, and disregarding the good answer about legal approach by @MadHatter, an alternative for preemptive defense could be to use those same AI tools to create many translations of the open source code and publish them all under the same license before private agents can do it.

  • Great idea. Bingo.
    – Marco
    Mar 30, 2023 at 15:28
  • Using AI to create a large number of derivatives of your own code will just add to confusion and lead to a huge amount of untested code. I don't think this is a good idea. And if you can create 20 derivatives of your own code, why do you believe that AI tools would be not be able to also create the 21st version? Mar 31, 2023 at 6:55
  • @Martin_in_AUT Right, one should do all the versions that the "stealers" could do too. But I hope one could do some kind of automation of the process with the right prompts, asking the LLM to produce all set big enough to cover all possibilities. Regarding the confusing part, the idea is not to publish equally all versions, but to include with the tested version all the variations with the warning of them being there just to fight license-violation by rephrasing.
    – Lucas
    Mar 31, 2023 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.