Are neural nets (the weights file) copyrightable?

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

Moderators: hgm, Rebel, chrisw

Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

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

Post by Michel »

If interpreting was linking, it would never be allowed to bundle a GPL-incompatible Python program with a GPL'ed interpreter. But the GPL FAQ explicitly says you can.
It is not the interpreter that is the issue but whether you use the output of the interpreted program in a GPL'ed program. I.e. the fact that you are using the Python program as a library to a GPL'ed program (this is the dynamic linking). The interpreter has nothing to do with it.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
User avatar
towforce
Posts: 11587
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

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

Post by towforce »

hgm wrote: Mon Mar 01, 2021 10:48 am In your dreams anything is possible indeed...

I know that nobody is actually going to go to court to force FF2's NN weights to be GPL licensed: in terms of a response, the SF team releasing SF13, putting clear blue water between themselves and FF2 in terms of playing strength, was a good one. If you buy FF2, you get much more than a file of weights + SF: I'd say the file of weights is a relatively small part of what you get. I don't think there are many people who are desperate to have just the file of weights - testers might, but they've been offered it for free anyway.

I am impartial about this: I joined these threads to learn and (hopefully) to contribute. Having read what everyone has to say, here's what I have concluded:

1. An NN can be copyrighted. There have been no test cases about copyright on computer generated work, but the legal opinion in the article I linked about the "new Rembrandt" is that ING, the company that commissioned it, would be able to claim the copyright on it. I haven't seen any better evidence than that.

2. This section of the GPL FAQ, link, makes it unambiguous that what FF2 has amended (or "recreated") should be covered by the GPL license. There's a theoretical possibility that it might not be legally watertight, but it's very clear, and again it's the best information on the subject I am aware of.

3. Stretched definitions (e.g. calling the NN weights "interpreted code" and SF an "interpreter of NN weight code") would be seen for what they are in a court of law: attempts to find loopholes. This is not like the big and expensive Oracle v Google case about whether open source code interfaces could be copyrighted - this case would be clear cut.

I think that this discussion is probably reaching its end, but I might be wrong - someone might introduce something new which we had all overlooked.
Writing is the antidote to confusion.
It's not "how smart you are", it's "how are you smart".
Your brain doesn't work the way you want, so train it!
User avatar
towforce
Posts: 11587
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

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

Post by towforce »

Michel wrote: Mon Mar 01, 2021 12:23 pmIt is not the interpreter that is the issue but whether you use the output of the interpreted program in a GPL'ed program. I.e. the fact that you are using the Python program as a library to a GPL'ed program (this is the dynamic linking). The interpreter has nothing to do with it.

+1 good point.
Writing is the antidote to confusion.
It's not "how smart you are", it's "how are you smart".
Your brain doesn't work the way you want, so train it!
chrisw
Posts: 4319
Joined: Tue Apr 03, 2012 4:28 pm

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

Post by chrisw »

syzygy wrote: Mon Mar 01, 2021 1:04 am
hgm wrote: Mon Mar 01, 2021 12:00 am Which side you prefer to argue can hardly be called relevant. That there were previous Stockfish versions that did not have a NNUE interpreter in them is not relevant: it has one now, and we are arguing about this version, not the previous one (which is not included as a copy). That it does more than just interpreting the NNUE also doesn't seem very relevant: many interpreters have done that as well. They were part of a larger programming environment, that included for example a text editor, with which you could enter the program that was interpreted. They could even do some pre-compilation of the code, suchs as Java, to transform the Java source to 'byte code', and interpret that. (And a disassembler for the byte code. And a run-time debugger...) I am very confident the case mentioned in the GPL FAQ is intended to cover exactly that situation, when I would package it with nonGPL'ed byte code.
The point of the FAQ is that the interpreted code is just data to the interpreter.
It is clear that NNUE nets are just data to the NNUE evaluation function.
This is true, but it’s also true in logical-philosophical la-la land that code can be data and data can be code.
But there’s an important missed attribute here. If human created code (thus carrying the copyright attribute) becomes “data” for whatever reason, the copyright attribute remains attached to the data.
Whereas, machine generated data, which can be seen as “code” in some circumstances does NOT carry the copyright attribute, and nor does any “code” it could be seen as.
The NNUE weights data is machine generated and there’s no copyright on them. Calling them “code” is logically possible, but that inversion-of-point-of-view can’t magically add any copyright attribute.

So whether or not the authors of the FAQ would regard the NNUE evaluation function as an interpreter, it seems they would agree that NNUE nets need not be released under the GPL.

FF2 SF/NNUE SF is a chess engine with a programmable evaluation function. That someone has actually programmed it by specifying a bunch of values does not mean that those values become an integral part of FF2 SF.
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

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

Post by Fulvio »

hgm wrote: Mon Mar 01, 2021 9:41 am Interpreting is not dynamic linking. Stockfish links to the NNUE interpreter (statically, I guess). Not to the interpreted code. If interpreting was linking, it would never be allowed to bundle a GPL-incompatible Python program with a GPL'ed interpreter. But the GPL FAQ explicitly says you can.

The Stockfish NNUE weight file of course is a part of Stockfish. (Although it seems the Stockfish developers have released in with a different license, albeit a GPL-compatible one.) But that doesn't matter when you don't copy it, but provide your own. Only the copyrights on the part of Stockfish that you want to distribute matters.
Why?
Can you post just one, even the tiniest and most stupid example, of one real case to support this absurd theory?

All these syllogisms which are based on nothing only create paradoxes (I'm still not sure if someone previously in this thread really tried to claim that you can take some GPL source code, change an image, and redistribuite it with a different license).

Let me apply your faulty logic to SCID.
The executable scid.exe contains a TCL interpreter (which you can link statically or dynamically).
When you start scid.exe it read and interpret the TCL files to create the SCID program.
But you can replace a file of interpreted TCL code and then you can distribute SCID with a different license (come on judge, only the copyrights on the part that I want to distribute matters).

But this creates an opportunity.
Instead of pretending that Stockfish is a NNUE intepreter, you can really create one.
Let's call it NetFight and it is invoked like:
./NetFight net1.nnue net2.nnue START_FEN
It just feed the starting position to net1.nnue and immediately play the suggested move: no UCI, no search, no hash table, etc...
Then it feeds the resulting position to net2.nnue and make its move ... and so on.

That would be fun to watch: like a PogChamps for engine chess.
User avatar
hgm
Posts: 27808
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 »

Fulvio wrote: Mon Mar 01, 2021 2:28 pm Why?
Can you post just one, even the tiniest and most stupid example, of one real case to support this absurd theory?
It is not a 'theory', it is the law. The burden of proof is on you. Can you even name one example where someone was convicted for copyright infringement of something he did not copy?
User avatar
hgm
Posts: 27808
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 »

chrisw wrote: Mon Mar 01, 2021 2:03 pmThe NNUE weights data is machine generated and there’s no copyright on them. Calling them “code” is logically possible, but that inversion-of-point-of-view can’t magically add any copyright attribute.
That is your assumption. Fact is that we don't know exactly how the NNUE weights were generated. It seems likely a machine was involved, but a compiler also qualifies as such, and most of us think that object code does carry the same copyright attribute as the corresponding source file. So it depends on whether what went into the machine carried any copyrights, for how much the creative expression embodied in that shines through in the weights. We are not in a position to judge that, as we haven't seen what went in.
User avatar
towforce
Posts: 11587
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

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

Post by towforce »

@HGM Why are you strongly motivated to assert the right to change the NN in GPL code and allow the copyright on the new NN to belong to the new author, even though they're bundling it with the GPL code?

This question is obviously not about license, copyright or any other aspect of law - it's about motivation.
Writing is the antidote to confusion.
It's not "how smart you are", it's "how are you smart".
Your brain doesn't work the way you want, so train it!
User avatar
hgm
Posts: 27808
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 »

I just share my interpretation of the law. What makes you think I have any 'motivation'? I have absolutely no beef in this. I have never read the Stockfish code (it seems to be C++...), I have no intention to use it. I have never made a NNUE. Perhaps I will be doing that for the Janggi engine I am currently developing. But I will certainly not use any Stockfish NNUE code for that, or other public NNUE code; I am perfectly capable of writing my own code, thank you! The net would need a completely different topology from that for Chess anyway, as the board is 90 squares, not 64, and the King is confined to the 3x3 Palace. A good approach seems to be to use the entire Palace constellation (King + Advisors) as substitute for the King dependence. There are 333 different Palace constellations, though (including those with a single Advisor, or none). Which is quite a step up from the 64 in Chess. But perhaps an input layer of 333x90x5x2 instead of 64x64x5x2 is still doable, if I economize on the cells in the first hidden layer (e.g. 128 instead of 256).

Why do you think I have any motivation one way or the other in making Stockfish derivatives?
User avatar
towforce
Posts: 11587
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

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

Post by towforce »

hgm wrote: Mon Mar 01, 2021 3:42 pmWhy do you think I have any motivation one way or the other in making Stockfish derivatives?

I fully accept that, regarding the two main issues under dispute..

1. Can an NN be copyrighted?

2. Does SF's GPL license oblige CB to publish FF2's NN weights file?

..there are no precedents to my knowledge that have been decided in a court.

However, it seems to me that you're producing arguments in favour of (1) yes (2) no which are somewhat stretched and convoluted, implying that your heart lies in allowing bundling of new NNs with GPL software while holding the copyright on the NN.

I also claim impartiality, and my view is (1) yes (2) yes.
Writing is the antidote to confusion.
It's not "how smart you are", it's "how are you smart".
Your brain doesn't work the way you want, so train it!