Are neural nets (the weights file) copyrightable?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

dkappe
Posts: 1632
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: Are neural nets (the weights file) copyrightable?

Post by dkappe »

daniel71 wrote: Mon Feb 22, 2021 1:41 pm I think because they used the Stockfish tools to create the data files and those tools are part of the Stockfish software with the GPLv3 license they cannot claim copyright. They need to write their own NNUE tools to create proprietary data for NNUE. They already gave credit to the Stockfish team in the rewritten product description as of 02/22/2021 it would be difficult to argue now they totally rewrote the NNUE tools to produce node data or weights. Stockfish please setup a legal fund where people can help with the legal costs, make sure PayPal can be used as thats easy for me to donate.
The GPL FAQ is your friend. https://www.gnu.org/licenses/gpl-faq.html
Is there some way that I can GPL the output people get from use of my program? For example, if my program is used to develop hardware designs, can I require that these designs must be free?

In general this is legally impossible; copyright law does not give you any say in the use of the output people make from their data using your program. If the user uses your program to enter or convert her own data, the copyright on the output belongs to her, not you. More generally, when a program translates its input into some other form, the copyright status of the output inherits that of the input it was generated from.

So the only way you have a say in the use of the output is if substantial parts of the output are copied (more or less) from text in your program. For instance, part of the output of Bison (see above) would be covered by the GNU GPL, if we had not made an exception in this specific case.

You could artificially make a program copy certain text into its output even if there is no technical reason to do so. But if that copied text serves no practical purpose, the user could simply delete that text from the output and use only the rest. Then he would not have to obey the conditions on redistribution of the copied text.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
daniel71
Posts: 146
Joined: Wed Aug 27, 2008 3:48 am

Re: Are neural nets (the weights file) copyrightable?

Post by daniel71 »

Thanks for pointing this out to me! This clears this up for me.
Michel
Posts: 2273
Joined: Mon Sep 29, 2008 1:50 am

Re: Are neural nets (the weights file) copyrightable?

Post by Michel »

hgm wrote: Mon Feb 22, 2021 10:29 am I agree that a NN is code of some sort. (It is in fact a program for a data-flow computer, a concept that is as old as computers themselves.)

But it is a program at another 'level', for which the code that uses the weights to calculate the output of the virtual NN is the interpreter. And the license of interpreters (or in any case the GPL) does not extend to the code you make them interpret.
I am not sure I buy this. As a thought experiment assume that SF uses an embedded Python interpreter and part of its code is written in Python. Do you believe that the Python part would not be covered by the GPL?
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
dkappe
Posts: 1632
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: Are neural nets (the weights file) copyrightable?

Post by dkappe »

Michel wrote: Mon Feb 22, 2021 4:34 pm
hgm wrote: Mon Feb 22, 2021 10:29 am I agree that a NN is code of some sort. (It is in fact a program for a data-flow computer, a concept that is as old as computers themselves.)

But it is a program at another 'level', for which the code that uses the weights to calculate the output of the virtual NN is the interpreter. And the license of interpreters (or in any case the GPL) does not extend to the code you make them interpret.
I am not sure I buy this. As a thought experiment assume that SF uses an embedded Python interpreter and part of its code is written in Python. Do you believe that the Python part would not be covered by the GPL?
The GPL FAQ is your friend. https://www.gnu.org/licenses/gpl-faq.html
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.

However, when the interpreter is extended to provide “bindings” to other facilities (often, but not necessarily, libraries), the interpreted program is effectively linked to the facilities it uses through these bindings. So if these facilities are released under the GPL, the interpreted program that uses them must be released in a GPL-compatible way. The JNI or Java Native Interface is an example of such a binding mechanism; libraries that are accessed in this way are linked dynamically with the Java programs that call them. These libraries are also linked with the interpreter. If the interpreter is linked statically with these libraries, or if it is designed to link dynamically with these specific libraries, then it too needs to be released in a GPL-compatible way.

Another similar and very common case is to provide libraries with the interpreter which are themselves interpreted. For instance, Perl comes with many Perl modules, and a Java implementation comes with many Java classes. These libraries and the programs that call them are always dynamically linked together.

A consequence is that if you choose to use GPLed Perl modules or Java classes in your program, you must release the program in a GPL-compatible way, regardless of the license used in the Perl or Java interpreter that the combined Perl or Java program will run on.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
Michel
Posts: 2273
Joined: Mon Sep 29, 2008 1:50 am

Re: Are neural nets (the weights file) copyrightable?

Post by Michel »

dkappe wrote: Mon Feb 22, 2021 4:42 pm
Michel wrote: Mon Feb 22, 2021 4:34 pm
hgm wrote: Mon Feb 22, 2021 10:29 am I agree that a NN is code of some sort. (It is in fact a program for a data-flow computer, a concept that is as old as computers themselves.)

But it is a program at another 'level', for which the code that uses the weights to calculate the output of the virtual NN is the interpreter. And the license of interpreters (or in any case the GPL) does not extend to the code you make them interpret.
I am not sure I buy this. As a thought experiment assume that SF uses an embedded Python interpreter and part of its code is written in Python. Do you believe that the Python part would not be covered by the GPL?
The GPL FAQ is your friend. https://www.gnu.org/licenses/gpl-faq.html
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.

However, when the interpreter is extended to provide “bindings” to other facilities (often, but not necessarily, libraries), the interpreted program is effectively linked to the facilities it uses through these bindings. So if these facilities are released under the GPL, the interpreted program that uses them must be released in a GPL-compatible way. The JNI or Java Native Interface is an example of such a binding mechanism; libraries that are accessed in this way are linked dynamically with the Java programs that call them. These libraries are also linked with the interpreter. If the interpreter is linked statically with these libraries, or if it is designed to link dynamically with these specific libraries, then it too needs to be released in a GPL-compatible way.

Another similar and very common case is to provide libraries with the interpreter which are themselves interpreted. For instance, Perl comes with many Perl modules, and a Java implementation comes with many Java classes. These libraries and the programs that call them are always dynamically linked together.

A consequence is that if you choose to use GPLed Perl modules or Java classes in your program, you must release the program in a GPL-compatible way, regardless of the license used in the Perl or Java interpreter that the combined Perl or Java program will run on.
You are completely missing the point. The issue I am raising is not about interpreting but about linking through an interpreter.

Assuming that SF is partially written in C++ and partially in Python and that SF uses the Python code through an embedded Python interpreter, I contend that if the C++ code is GPL then the Python code would also be GPL.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
gonzochess75
Posts: 208
Joined: Mon Dec 10, 2018 3:29 pm
Full name: Adam Treat

Re: Are neural nets (the weights file) copyrightable?

Post by gonzochess75 »

The NN weights are not a 'program' and the NNUE backend is not an 'interpreter' in any actual sense other than the fevered imaginations of those looking to find loopholes to violate other people's copyright. The NN weights do not form any sort of program in any theory of computation. They certainly are not Turing complete. And the NNUE backend does not provide an abstract computational model.

Regardless, it would be irrelevant. The combination of an engine (search) and and NN backend (eval) + NN weights is a whole program and a single complete work. If you take the engine away the weights are useless. If you take the eval away and don't load weights for the NN eval the program, then the eval is useless.

If you want to create an NN set of weights and use them in a proprietary program, then don't use GPL'd software to do it. Try actually writing your own engine with your own work. But of course people don't do that because of how difficult it is and what an investment it is. But isn't that what you should expect from someone claiming to provide lots of money in value?
User avatar
hgm
Posts: 27855
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Are neural nets (the weights file) copyrightable?

Post by hgm »

Michel wrote: Mon Feb 22, 2021 4:34 pmI am not sure I buy this. As a thought experiment assume that SF uses an embedded Python interpreter and part of its code is written in Python. Do you believe that the Python part would not be covered by the GPL?
Whether it is legal to do this in the first place depends on the license of the Python interpreter. If that is GPL, then the Python part would obviously be covered by the GPL. If it is another license, which allows embedding, it would keep its own license; a non-copyrightholder cannot change the license.

I am not sure what this thought experiment is supposed to prove. To be able to do this the Python interpreter obviously has to be available separately. So even if the Python part in Stockfish would get a more restrictive license, it has zero consequences, because it is still available separately, under its own license.

In addition, this seems the opposit issue of the relevant one: what is of interest here is whether the SF part would inherit the license from the Python part. I would also say no to that, again, because a non-copyrightholder can never change the license. If the license of the Python part allows embedding, but only under conditions that violate the license of SF, the embedding is illegal. GPL might very well require that anything embedded with the Python interpreter is also GPL.

But embedding is not the same as bundling. I don't think it is automatically illegal to distribute software of incompatible license in the same archive, or on the same floppy disk, when the licenses allow distribution. The archive is just a vehicle.
gonzochess75
Posts: 208
Joined: Mon Dec 10, 2018 3:29 pm
Full name: Adam Treat

Re: Are neural nets (the weights file) copyrightable?

Post by gonzochess75 »

hgm wrote: Mon Feb 22, 2021 4:59 pm Whether it is legal to do this in the first place depends on the license of the Python interpreter. If that is GPL, then the Python part would obviously be covered by the GPL. If it is another license, which allows embedding, it would keep its own license; a non-copyrightholder cannot change the license.
This whole thought experiment is formed from people tying themselves in knots to find a loophole allowing them to violate other people's copyrights, but let's take it apart to be very complete.

In the case above where SF has an embedded python interpreter the python program itself would be essentially be a *plugin* to SF. If the python program communicated in a non-trivial way with the *non-interpreter* parts of SF and caused SF to modify its search or eval and is loaded into SF's memory space, then it is a plugin. In such a case, the python program would of course need to be compatibly licensed under the GPL as this case is expressly handled by the license.

Read all about it: https://www.gnu.org/licenses/gpl-faq.html#GPLPlugins
User avatar
hgm
Posts: 27855
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Are neural nets (the weights file) copyrightable?

Post by hgm »

gonzochess75 wrote: Mon Feb 22, 2021 4:56 pm The NN weights are not a 'program' and the NNUE backend is not an 'interpreter' in any actual sense other than the fevered imaginations of those looking to find loopholes to violate other people's copyright. The NN weights do not form any sort of program in any theory of computation.
You obviously have never heard of data-flow computers.
They certainly are not Turing complete.
Since when is that relevant?
And the NNUE backend does not provide an abstract computational model.
Actually conventional boolean logic on which digital computer hardware is based (gates and flipflops and such) are special cases of neural networks. (Depending on the threshold and activation funtion single neurons can perform the function of AND and OR gates, and negative weights can emulate inverters. So neural nets in general are as Turing-complete as our PCs. (Which is only nearly so, as memory is finite in all cases.)

That an NNUE doesn't need a Turing-complete interpreter to run it seems irrelevant. There are also computer programs (such as "hello world") which do not need recursion. That doesn't disqualify them as computer programs.
Regardless, it would be irrelevant. The combination of an engine (search) and and NN backend (eval) + NN weights is a whole program and a single complete work. If you take the engine away the weights are useless. If you take the eval away and don't load weights for the NN eval the program, then the eval is useless.
If you take the interpreter away, the JavaScript file becomes useless. If you take all JavaScript files away, the interpreter becomes useless...
If you want to create an NN set of weights and use them in a proprietary program, then don't use GPL'd software to do it. Try actually writing your own engine with your own work. But of course people don't do that because of how difficult it is and what an investment it is. But isn't that what you should expect from someone claiming to provide lots of money in value?
This might be an ethical code by which you could live. But there is no law that enforces it.
gonzochess75 wrote: Mon Feb 22, 2021 5:11 pmIn the case above where SF has an embedded python interpreter the python program itself would be essentially be a *plugin* to SF.
I think you got that the wrong way around. SF would be a plugin to the Python interpreter.
dkappe
Posts: 1632
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: Are neural nets (the weights file) copyrightable?

Post by dkappe »

gonzochess75 wrote: Mon Feb 22, 2021 4:56 pm If you want to create an NN set of weights and use them in a proprietary program, then don't use GPL'd software to do it. Try actually writing your own engine with your own work. But of course people don't do that because of how difficult it is and what an investment it is. But isn't that what you should expect from someone claiming to provide lots of money in value?
Ah, programmers and the law. :)

Leaving aside the question of copyrighting neural networks, if I understand your argument, you are claiming that ChessBase is distributing a proprietary program? Or that because stockfish can be used with a net, that net falls under the GPLv3? Or both?

My understanding is that ChessBase is distributing a slightly modified stockfish and providing the source code. Is that not the case? (We return for the 500th time to the same place.)

You are no doubt aware that there are by now other implementations of NNUE under other licenses? I just ripped out and replaced nnue in a0lite with a MIT licensed version. So now the SF nets, because they can be run in a0lite, fall under the MIT license? That doesn’t seem right. Please explain.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".