AI-Generated and AI-Assisted Code Under EU Law: Intellectual Property and Compliance Challenges
Part 3: Training data
Av. Mirela Takacs · April 21, 2026 · 9 min read
Regarding computer programs, generative AI models have been trained on vast datasets of source code, much of it publicly available online, in open-source repositories, or in books and technical documentation, most of which may be protected by copyright[1].
The exclusive rights of the rightholders of computer programs, as provided for in Article 4(1) of Directive 2009/24/EC[2], may be infringed if the whole or a part of a protected computer program is reproduced, translated, adapted, arranged, transformed, altered, or distributed without authorization, unless an exception applies, such as those provided for in Articles 5 and 6 of Directive 2009/24/EC or the Text and Data Mining (TDM) exception under Article 4 of Directive (EU) 2019/790[3].
Text and Data Mining (TDM) Exception
While the exceptions from Articles 5 and 6 of Directive 2009/24/EC target legitimate users of a computer program and cover normal running, making backup copies, studying the functioning of the program and decompilation for interoperability purposes, Article 4 of Directive (EU) 2019/790 targets any user for whom the content is legally accessible and who wishes to extract patterns, trends and correlations (without the list being exhaustive) from that content through automated processing, except for cases where use is „expressly reserved” by the right holder in an „appropriate manner” – reservations commonly known as „TDM opt-out”.
Since AI models learn patterns and structures from protected content, the TDM exception is fundamental to the development of these models, as it enables the collection and analysis of content used to train them, unless the user opted-out. So, the TDM exception applies only within its specific legal boundaries.
Legal interpretations and technical perspective
Such a situation, regarding the applicability of the TDM exception, has been recently analyzed by the Munich I Regional Court[4] in GEMA v. OpenAI Group, one of the first cases in European jurisprudence on artificial intelligence. Although the case did not concern computer programs but song lyrics, the court’s interpretation provides one perspective on how the TDM exception might apply.
To establish copyright infringement, the court highlighted the need to distinguish reproductions made for technical conversion or analysis from reproductions retained in the model. It outlined three phases:
- the creation of the training data by extracting and converting the training material into a machine-readable format;
- the training the model by analyzing the data and enriching it with meta-information; and
- the use of the trained model through prompts to generate outputs.
The court ruled that the memorisation of protected works in AI models qualifies as reproduction, relying on the principle that “reproduction” should be interpreted broadly and includes any fixation, even modified or digitised. According to the court, for the purposes of copyright reproduction, technical details of memorisation are irrelevant; what matters is that the lyrics are embedded and reproducible.
It further noted that the TDM exception applies only to Phase 1, which involves converting and storing reproductions solely for analytical purpose, and that memorisation of the song lyrics (the lyrics being fully embedded in the model’s parameters during Phase 2 in court’s opinion) went beyond this scope and that such reproductions were considered not covered by Article 4 of the DSM Directive.
Because the model could made memorised song lyrics accessible to users, the court held that both reproduction and communication to the public had occurred. The developers were held directly liable, rather than intermediaries, as they had selected the lyrics as training data, designed and trained the models, thereby causing the memorisation of the works, and the users could not be held responsible since they only provided simple prompts.
The decision has been appealed[5], so we will see what will happen next and how the European courts will develop their approach on AI and copyright.
However, form a technical perspective, it is widely acknowledged that the GenAI model training does not involve storing the data post-training, only patterns remaining coded into the model’s weights[6]. Still, studies have demonstrated that memorization can occur in exceptional cases and under specific conditions, and that the generative-AI models usually generalize from large amounts of training data and do not memorize individual pieces of it [7].
Empirical studies indicate that verbatim memorization, as in generating long sequences of text that are exact matches of sequences in their training data, is considered to be intertwined with the LM’s general capabilities and is most likely to occur when the model is of a higher quality and more capable, when a sequence appears multiple times in the training data and when the sequence has a clear structure, as sequences without structures are harder to memorize. According to these studies, memorized information is stored in a set of distributed and abstract states[8].
One thing is certain, until legal interpretation and technical perspective of how these systems operate find common ground, although the generation of an output gives the impression that it is obtained through a single, real-time „thinking” process (you ask and it answers) in fact, the output is the result of two major distinct phases:
- a past phase, from the training phase – when the model processed vast amounts of data and encoded the learned parameters, and
- a present phase, the interaction with the AI system during the generation phase – when it creates the output token by token, calculating the most probable next token, based on the input prompt and the patterns learned during training, repeating this loop until an end token is generated[9].
This creates the illusion of an on-the-spot answer from a tool that seems to think and reason like a human in real time, whereas in reality the model is executing an automated, probabilistic process based on past training acts. However, from a legal perspective, according to the current interpretation of an EU court as shown in the case discussed above, such a process does not exclude the possibility of an infringement.
Reproduction of existing protected works and consequences
What such situations might we encounter in the context of AI-generated code? First and most evidently, literal copying. It is possible that models may simply reproduce code almost verbatim. From a legal perspective, if the model generates licensed code, and we are talking about original sequences, not short boilerplate fragments, but without any mention of copyright notices or license terms, users being thus unaware of the legal conditions applicable to that code, when they distribute it, this may constitute an infringement, including the failure to attribute authorship and reproduce license terms, and may even trigger the obligation to disclose the entire source code of their projects if the reproduced part was originally licensed under a copyleft license.
Also, studies have shown that it is also important to distinguish between verbatim and approximate memorisation. In the verbatim case, we have a literal reproduction which can be detected by textual overlap. By contrast, the approximate memorisation is defined using the concept of similarity: the output of a GenAI system strongly resembles the training data, in the sense that a near-exact copy of a substantial portion of that specific part of the training data can be reconstructed from the model. What differentiates approximate memorization from verbatim is that the similarity is not perfect textual identity, but a strong resemblance.[10]
But just as the AI model can reproduce protected content, which is real, it can also hallucinate, inventing information that appears credible. Still, both reproduction and invention come from the same generation process and not from a human reasoning process. Therefore, when generating code using AI, besides the topic of licenses and intellectual property breaches, memorisation or hallucination can be a direct security risk, at which point the discussion becomes technical.
According to OWASP Top 10 for LLM Applications 2025[11], the main risks associated with applications based on LLM models include, among others, prompt injection; sensitive information disclosure which can result in unauthorized data, access, privacy violations; outdated or deprecated components, which attackers can exploit them; overreliance; insecure or non-existent code libraries, which can introduce vulnerabilities when integrated into software systems.
Returning to Chardet, if a similar case were to be resolved under EU law, it could be considered an infringement if there were verbatim copying, meaning code copied literally. But what we know from Blanchard’s explanations is that three independent measures all pointed in the same direction: chardet 7 is not derivative of earlier versions; token-level similarity under 1.5% max, with matches being generic boilerplate; fingerprint similarity hits zero against the original 1.0 release. Moreover, he applied the Abstraction-Filtration-Comparison test for non-literal software copyright infringement (used by US courts) to conclude that none of the old code’s architecture was preserved, and even the few remaining overlaps actually come from the code he wrote himself during his years of maintenance.
How has the CJEU treated the subject of protected expression versus functionality for computer programs in its case law? To be continued in Part 4.
Part 1: A real-world example: the relicensing of Chardet
Part 2: Terms of Service of AI platforms & EU main regulations for computer programs
Part 4: CJEU case law on computer programs
Part 5: Literal Elements vs. Non-Literal Elements in Computer Programs
[1] N. Lucchi, Serra Hunter, Generative AI and Copyright – Training, Creation, Regulation, Section 1.2
[2] Directive 2009/24/EC of the European Parliament and of the Council of 23 April 2009 on the legal protection of computer programs, OJ L 111, 5 May 2009
[3] DIRECTIVE (EU) 2019/790 OF THE EUROPEAN PARLIAMENT AND OF THE COUNCIL of 17 April 2019 on copyright and related rights in the Digital Single Market and amending Directives 96/9/EC and 2001/29/EC, OJ L 130/92, 17 May 2019
[4] https://www.euipo.europa.eu/en/law/recent-case-law/the-higher-regional-court-of-munich-considered-memorization-and-temporary-copies-occurred-in-model-training-as-infringing-reproductions-of-works
[5] https://aifray.com/open-ai-appeals-german-injunction-in-music-copyright-infringement-case-panel-not-too-likely-to-refer-to-european-court-of-justice/
[6] The Development of Generative Artificial Intelligence from a Copyright Perspective (EUIPO, 2025), p. 272
[7] For further details regarding memorisation, see Section 3.2.4 of The Development of Generative Artificial Intelligence from a Copyright Perspective (EUIPO, 2025)
[8] https://ai.stanford.edu/blog/verbatim-memorization/
[9] For further details regarding the technologies and processes on which GenAI are based, see Section 2.1.2 of Development of Generative Artificial Intelligence from a Copyright Perspective (EUIPO, 2025)
[10] Section 3.2.4 of Development of Generative Artificial Intelligence from a Copyright Perspective (EUIPO, 2025), it is also mentioned that in a study focused on Copilot, the BLEU score and the length-normalised character-level Levenshtein similarity were used to detect approximate memorisation.
[11] https://genai.owasp.org/llm-top-10/
The content of this website is provided for informational purposes only and does not constitute legal advice. The law in this area is subject to ongoing developments. Please consult a qualified lawyer for advice specific to your situation.