Disclaimer: I am not a lawyer. Please consult with a lawyer if you have any doubts regarding licensing and copyright.

With the advent of AI code generators, the question of copyright and ownership has arisen. AI generates new code based on what it was trained on, but there have been cases of it outputting exact matches of code available online. This poses a problem. How will a human user ever know whether the output is legally allowed to be used? It has been shown that ChatGPT (not sure which version) was able to output code licensed under GPL, which could be devastating if included in a proprietary codebase. The responsibility should lie on the AI developers to only use data that will not cause any legal issues. If they are offering a service that could potentially output copyrighted/licensed code it should have a clear disclaimer and could never be used for business or open-source purposes. However, it is still fine for personal use.

Permissively licensed code can technically be used freely, but there is still the issue of preserving the copyright and license for that code. An AI will likely lose that information when it “generates” the code. The code available for training a “business-grade AI” would have to be anything in the public domain (for those who want to license code to the public domain there is the CC0 license).

Even when the code is generated by the AI (i.e. not a direct copy of code found elsewhere), who can claim copyright? David Gewirtz did some digging into this and the copyright likely falls into the public domain for the same reason that any work produced by nature, animals, or plants does. An AI is not a legal entity and can therefore not hold any copyright. Though there have yet to be any big lawsuits around AI-generated code.

There was one case regarding a graphic novel created with the help of the AI Midjourney. The conclusion from The U.S. Copyright Office was that, while the work itself was copyrightable because it required human work to add text and put it all together, the images generated by Midjourney were not subject to copyright.

How the licensing issues play out we will probably see in the coming years. I’m very wary of using any AI-generated code and will likely avoid it in the foreseeable future.