Suppose you are working on a mobile application. Because the application contains GPL licensed code, the mobile application will be licensed under GPL too. The mobile application also uses a pretrained neural network model. (For simplicity, assume you used MIT licensed code that is not used in the mobile application and a set of copyrighted images to generate and train the neural network model.)

In short:

At development time: Neural network training code and training data make a neural network model.

The final product: Mobile application code and the neural network model are in the final release binary. The training code and training data are NOT included.

  1. Does this neural network model have to be licensed under GPL?
  2. Does the code used to train the neural network model have to be made available? If so, does it have to be licensed under GPL?
  3. Does the training data used to train the neural network model have to be made available? If so, does it have to be licensed under GPL?

One could make the argument GPL dictates the distribution of the sources of a system be in the preferred form of the work for making changes in it. Nearly all neural networks are created by the use of training code and a training set of data. Because nobody develops a neural network model by editing its weights one by one, what should be redistributed in this case is the code that allows automatic adjustment of the weights based on training data, not the resulting weights.

However, one could argue since the model itself can be parsed and loaded using only a few lines of code (with the appropriate machine learning library) the model itself is already in the preferred form. The training code is useful for creating a model from scratch but is not necessary for modifying the model.

[Question reposted from https://softwareengineering.stackexchange.com/questions/372548/for-gpl-do-trained-neural-network-models-count-as-source-code?noredirect=1#comment818262_372548 since it was marked off-topic]

  • 4
    Whether or not this is allowed on SoftwareEngineering.SE, it is certainly on-topic here. Welcome to OpenSource.SE, and thanks for the interesting first question! – apsillers Jun 14 '18 at 16:10

Two critical questions are:

  1. Are neural network models code? Importantly, are they code that directly combines with the GPL-licensed code under copyright? It is instead possible that they are data. If they are data, it is unlikely that they form a combined work with the GPL-licensed code that process them. There is a related GPL FAQ item about GPL code processing non-GPL data:

    If a programming language interpreter is released under the GPL, does that mean programs written to be interpreted by it must be under GPL-compatible licenses?

    When the interpreter just interprets a language, the answer is no. The interpreted program, to the interpreter, is just data; a free software license like the GPL, based on copyright law, cannot limit what data you use the interpreter on. You can run it on any data (interpreted program), any way you like, and there are no requirements about licensing that data to anyone.

  1. Are neural network models even copyrightable? If neural networks are created in such a way that it does not require a "modicum of creativity" from a human (in the United States -- other jurisdictions likely have similar rules) to create any particular neural network, they are not copyrightable. In general, the choice of mathematical parameters (or selection of input training sources) for a mathematical, automated process does not satisfy this criterion for copyrightability. If neural networks are not copyrightable, I would not expect that they form a combined work with the program under copyright. (Note they a neural network model could still be covered by sui generis database rights in some jurisdictions, without changing the impact of this consideration.)

If the answer to either of these is negative, then the GPL requirements do not apply.

  • 1
    Neural network models certainly seem like data. Tensorflow saves models as protocol buffers: "Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler." (developers.google.com/protocol-buffers/?hl=en) But programming language interpreters are very different from mobile applications since the mobile application is meant read a specific neural network model (and maybe future updated versions of the model). – emettomet Jun 14 '18 at 19:25
  • 1
    I am 99% certain neural network models are NOT copyrightable. If neural network models were copyrightable, then someone would have copyrighted one. But a search of "neural networks" on the US Copyright Office website turns up research papers, books, and images about neural networks but no neural network models. – emettomet Jun 15 '18 at 0:01
  • If I understand the OP correctly, the model seems to be an essential part of the system, not just arbitrarily exchangeable like an interpreted program for an interpreter. So are you really sure it is "unlikely that they form a combined work"? – Doc Brown Jun 15 '18 at 22:50
  • @DocBrown I agree it's counterintuitive, and maybe I'm wrong (I framed my answer as questions instead of statements, after all!). My argument goes something like this: consider an AGPL web app that uses a config file with server-specific secret keys. Insofar as those keys are just data, they don't need to be made available to users as part of the corresponding source (but the config file in general does, with meaningful if different values). I'm arguing that a NN model is a massively scaled-up version of that, but which has the same copyright consequences. Again, I might be wrong. – apsillers Jun 16 '18 at 1:13
  • In other words, my thesis here is that two versions of the same app that are identical except containing different NN models have identical copyrighted content. I realize my answer doesn't make that terribly clear, and perhaps I ought to add a bit more uncertainty on that score. – apsillers Jun 16 '18 at 1:16

So you have an application that uses GPL code, even if part of the project can be separated and used under different terms (MIT), the project as a whole needs to comply with the GPL.

Note that the overall project design can also impact on what you can do. If the neural network is a library that links with the main program it can fall into GPL but if it is a separate program that supplies data to the main program it would not.

While data output from a GPL program is not covered by the GPL terms, Section 1 of the GPL states -

The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities.

So if your training data files are stored or converted to C/C++ code that gets compiled into the final app, then the training data will fall into the GPL.

Even if the data is stored as separate files that are only read at runtime, you may need to supply at least a basic subset of data that allows the user to "compile, install and run" the project you are sharing, while your paid application gets bundled with more useful data files. Offering your advanced data set as an optional download available once the app is installed could be another way to separate it from the open project.

Note that you are under no obligation to make the open version of the program run "really well" or to any extent of usefulness on its own, consider that the linux kernel has a very limited use without other supporting projects to make a complete system distribution. You also don't have to make the project publicly available, you only have to make the code available to users of your binary program.

  • I should have been more clear the neural network model is made during development and is not made at runtime. No training code or training data is included in the released binary. Only the mobile application code and the neural network model (which is data and not code) is. – emettomet Jun 15 '18 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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