united-states intellectual-property software licensing
Who owns the right to the code generated by GitHub Copilot?
<blockquote>
<p>This question was somewhat inspired by <a href="https://meta.stackoverflow.com/q/412696/16886597">this Meta SO question</a></p>
</blockquote>
<p>I found <a href="https://law.stackexchange.com/q/24467">this other question</a>... but that is more general.</p>
<p>When someone uses <a href="https://copilot.github.com/" rel="noreferrer">GitHub Copilot</a> does the person that is using the tool own the rights to the code generated by it?</p>
<p><a href="https://copilot.github.com/#faq-who-owns-the-code-github-copilot-helps-me-write" rel="noreferrer">GitHub claims yes</a>:</p>
<blockquote>
<h2>Who owns the code GitHub Copilot helps me write?</h2>
<p>GitHub Copilot is a tool, like a compiler or a pen. The suggestions GitHub Copilot generates, and the code you write with its help, belong to you, and you are responsible for it. We recommend that you carefully test, review, and vet the code, as you would with any code you write yourself.</p>
</blockquote>
<p><em>But</em>, <a href="https://twitter.com/mitsuhiko/status/1410886329924194309" rel="noreferrer">people have shown that GitHub Copilot can write code that is very much not original</a>*. In this example, it was the <code>Q_rsqrt</code> from Quake Arena, with comments, profanity and all (<a href="https://github.com/id-Software/Quake-III-Arena/blob/dbe4ddb10315479fc00086f08e25d968b4b43c49/code/game/q_math.c#L552" rel="noreferrer">here</a> is the original function from the source code, for comparison). So... despite that GitHub claims that you own the rights to the written code, that example makes me think that maybe GitHub's statement isn't true. In that example, IANAL, but I do not think you would own that code.</p>
<p>A general answer is fine, but I'm specifically interested in the United States.</p>
<p>Who owns the rights to the code that GitHub Copilot produces? Does this change if the code produced was taken verbatim from an existing codebase, as was the case for <code>Q_rsqrt</code>?</p>
<p>*I'm aware that GitHub added <code>Q_rsqrt</code> to the list of banned words, but I would be very surprised if other examples of this didn't exist</p>

<p><strong>You Own The Code</strong></p>
<p>To answer your question on whether or not it is copyright infringement:</p>
<p>Yes, you do own the rights to the written code but posting it on Github gives Github the</p>
<blockquote>
<p>right to store, archive, parse, and display Your Content, and make incidental copies, as necessary to provide the Service, including improving the Service over time. 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; share it with other users; and perform it.</p>
</blockquote>
<p>To simply put it, no matter what license you use, you give GitHub the right to host your code and to use your code to improve their products and features.</p>
<p>This license does not grant GitHub the right to sell Your Content. It also does not grant GitHub the right to otherwise distribute or use Your Content outside of our provision of the Service, except that as part of the right to archive your Content.</p>
<p>So with respect to code that’s already on GitHub, I think the answer to the question of copyright infringement is fairly straightforward.</p>
<p>Things aren’t quite as clear-cut in a scenario where Copilot is trained on code that is hosted outside of GitHub. In that situation, the copyright infringement question would hinge largely on the concept of fair use. If Copilot is being trained on code outside of GitHub, we accept that at least some of what they’re looking at is copyrightable work. So, the question then becomes if it’s fair use. Now, you ultimately can’t conclude definitively that something is fair use until you go to court and a judge agrees with your assessment. But I think there’s a strong case to be made that Copilot’s use of code is very transformative, a point which would favor the fair use argument.</p>
<p>There is precedent for this sort of situation. Take the case of Google Books, for example. Google scanned millions of books, provided people who were doing research with the ability to search the book, and provided the user a small snippet of the text that the user was searching for in the book itself. The court did in fact find that was fair use. The use was very transformative. It allowed people to search millions of books. It didn’t substitute for the book itself. It didn’t really take away anything from the copyright holders; in fact, it made it easier for readers to access the work and actually opened a broader market for book authors. And, it was a huge value add on top of the copyrighted corpus.</p>
<p>In the latter scenario, a lot depends on the thoroughness and the length of Copilot’s suggestions. The more complex and lengthy the suggestion, the more likely it has some sort of copyrightable expression. If a suggestion is short enough, the fact that it repeats something in someone else’s code may not make it copyrightable expression.</p>
<p>There’s also the question of whether what’s being produced is actually a copy of what’s in the corpus. That’s a little unclear right now. GitHub reports that Copilot is mostly producing brand-new material, only regurgitating copies of learned code 0.1% of the time. But, we have seen certain examples online of the suggestions and those suggestions include fairly large amounts of code and code that clearly is being copied because it even includes comments from the original source <a href="https://fossa.com/blog/analyzing-legal-implications-github-copilot/" rel="nofollow noreferrer">code.</a></p>
