LC0 vs. NNUE - some tech details...

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

Moderators: hgm, Rebel, chrisw

smatovic
Posts: 2639
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

LC0 vs. NNUE - some tech details...

Post by smatovic »

I am a noob in neural networks and implementation, so others wish to correct me
or add something, anyway, cos it may come up repeatedly...

- LC0 uses CNNs, Convolutional Neural Networks, for position evaluation
- NNUE is currently a kind of MLP, Multi-Layer-Perceptron, with incremental updates for the first layer

- A0 used originally about 50 million neural network weights
- NNUE uses currently about 10 million weights? Or more, depending on net size

- LC0 uses a MCTS-PUCT search
- NNUE uses the Alpha-Beta search of its "host" engine

- LC0 uses the Zero approach with Reinforcement Learning on a GPU-Cloud-Cluster
- NNUE uses initial RL with addition of SL, Supervised Learning, with engine-engine games

- LC0 runs the NN part well on GPU (up to hundreds of Vector-Units) via batches
- NNUE runs on the Vector-Unit of the CPU (SSE, AVX, NEO), no batches in need

Cos NNUE runs a smaller kind of NN on a CPU efficient it gains more NPS in an
AB search than previous approaches like Giraffe, you can view it in a way that
it can combine both worlds, the LC0 NN part and the SF AB search part, on a CPU.

--
Srdja
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: LC0 vs. NNUE - some tech details...

Post by Joerg Oster »

smatovic wrote: Wed Jul 29, 2020 9:33 am I am a noob in neural networks and implementation, so others wish to correct me
or add something, anyway, cos it may come up repeatedly...

- LC0 uses CNNs, Convolutional Neural Networks, for position evaluation
- NNUE is currently a kind of MLP, Multi-Layer-Perceptron, with incremental updates for the first layer

- A0 used originally about 50 million neural network weights
- NNUE uses currently about 10 million weights? Or more, depending on net size

- LC0 uses a MCTS-PUCT search
- NNUE uses the Alpha-Beta search of its "host" engine

- LC0 uses the Zero approach with Reinforcement Learning on a GPU-Cloud-Cluster
- NNUE uses initial RL with addition of SL, Supervised Learning, with engine-engine games

- LC0 runs the NN part well on GPU (up to hundreds of Vector-Units) via batches
- NNUE runs on the Vector-Unit of the CPU (SSE, AVX, NEO), no batches in need

Cos NNUE runs a smaller kind of NN on a CPU efficient it gains more NPS in an
AB search than previous approaches like Giraffe, you can view it in a way that
it can combine both worlds, the LC0 NN part and the SF AB search part, on a CPU.

--
Srdja
I wonder when we will see the first MCTS-like searchers using a NNUE.
Probably the Komodo guys are already working on it ... :)
Jörg Oster
peter
Posts: 3185
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: LC0 vs. NNUE - some tech details...

Post by peter »

Joerg Oster wrote: Wed Jul 29, 2020 11:11 am I wonder when we will see the first MCTS-like searchers using a NNUE.
Probably the Komodo guys are already working on it ... :)
Am I right that "real" MCTS- search would work better on CPU too? I mean unlike the kind of search LC0 does?
Peter.
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: LC0 vs. NNUE - some tech details...

Post by Joerg Oster »

peter wrote: Wed Jul 29, 2020 11:40 am
Joerg Oster wrote: Wed Jul 29, 2020 11:11 am I wonder when we will see the first MCTS-like searchers using a NNUE.
Probably the Komodo guys are already working on it ... :)
Am I right that "real" MCTS- search would work better on CPU too? I mean unlike the kind of search LC0 does?
Lc0's search IS running on CPU, so not sure what you mean exactly.
Jörg Oster
peter
Posts: 3185
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: LC0 vs. NNUE - some tech details...

Post by peter »

Joerg Oster wrote: Wed Jul 29, 2020 12:24 pm
peter wrote: Wed Jul 29, 2020 11:40 am
Joerg Oster wrote: Wed Jul 29, 2020 11:11 am I wonder when we will see the first MCTS-like searchers using a NNUE.
Probably the Komodo guys are already working on it ... :)
Am I right that "real" MCTS- search would work better on CPU too? I mean unlike the kind of search LC0 does?
Lc0's search IS running on CPU, so not sure what you mean exactly.
LC0's search ist puct, as far as I know, komodo's MCTS is quite different, isn't it?
And I always thought the part of LC0 needing GPU was mainly the one dealing with the nets, wasn't it?
Peter.
smatovic
Posts: 2639
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: LC0 vs. NNUE - some tech details...

Post by smatovic »

peter wrote: Wed Jul 29, 2020 1:24 pm
Joerg Oster wrote: Wed Jul 29, 2020 12:24 pm
peter wrote: Wed Jul 29, 2020 11:40 am
Joerg Oster wrote: Wed Jul 29, 2020 11:11 am I wonder when we will see the first MCTS-like searchers using a NNUE.
Probably the Komodo guys are already working on it ... :)
Am I right that "real" MCTS- search would work better on CPU too? I mean unlike the kind of search LC0 does?
Lc0's search IS running on CPU, so not sure what you mean exactly.
LC0's search ist puct, as far as I know, komodo's MCTS is quite different, isn't it?
And I always thought the part of LC0 needing GPU was mainly the one dealing with the nets, wasn't it?
From my own experiments I can tell that chess is too tactical for plain MCTS
with UCT, you have to guide the selection of nodes somehow, LC0 does this via
the P in PUCT, Predicator, therefore the NN is twofolded, Value and Policy head,
there are other techniques similar to PUCT, like Best-First-MiniMax-Search.

I do not know what technique Komodo MCTS uses, but they have for sure somehow
to enhance the plain MCTS-UCT approach.

Of course, with NNUE as efficient NN implementation on CPU, there are now
several combinations of different techniques with and without NN possible:

tree search + tree pruning + move selection/move order + position evaluation

We have for sure some movement over the next years in pipe.

--
Srdja
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: LC0 vs. NNUE - some tech details...

Post by Joerg Oster »

peter wrote: Wed Jul 29, 2020 1:24 pm
Joerg Oster wrote: Wed Jul 29, 2020 12:24 pm
peter wrote: Wed Jul 29, 2020 11:40 am
Joerg Oster wrote: Wed Jul 29, 2020 11:11 am I wonder when we will see the first MCTS-like searchers using a NNUE.
Probably the Komodo guys are already working on it ... :)
Am I right that "real" MCTS- search would work better on CPU too? I mean unlike the kind of search LC0 does?
Lc0's search IS running on CPU, so not sure what you mean exactly.
LC0's search ist puct, as far as I know, komodo's MCTS is quite different, isn't it?
How can I know? Komodo is closed-source so I don't know what they're doing.

P-UCT is only an enhancement to UCT (Upper Confidence Bounds for Trees), which itself still belongs in the family of MCTS.
Just like one might say Stockfish is PVS (Principal Variation Search), yet it's still Alpha-Beta.

If you are intersted in more details, I can recommend you this paper: https://www.researchgate.net/publicatio ... s/download

Edit: This https://medium.com/oracledevs/lessons-f ... 36e9054191 might also be of some interest.
Jörg Oster
peter
Posts: 3185
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: LC0 vs. NNUE - some tech details...

Post by peter »

Joerg Oster wrote: Wed Jul 29, 2020 2:56 pm How can I know? Komodo is closed-source so I don't know what they're doing.
Thanks for the links, Jörg, all I know about komodo only of course too it that it runs on CPU and there were many attempts of MCTS for chess without usage of GPU before A0 and LC0, so I thought the GPU- bound part of A0 and LC0 would be the usage of the NN.

And NNUE doesn't seem to need GPU neither, so I was pondering about komodo MCTS and komodo NNUE and if GPU- usage would be to be expected for komodo NNUE or not.
Maybe Larry or Mark could share some thoughts...
Peter.
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: LC0 vs. NNUE - some tech details...

Post by Ovyron »

Finally they'll be able to release a Komodo with NNUE technology that is stronger than Stockfish dev. But too little too late as Komodo NNUE's search will not keep up with Stockfish NNUE's search...
Milos
Posts: 4190
Joined: Wed Nov 25, 2009 1:47 am

Re: LC0 vs. NNUE - some tech details...

Post by Milos »

Ovyron wrote: Thu Jul 30, 2020 12:41 am Finally they'll be able to release a Komodo with NNUE technology that is stronger than Stockfish dev. But too little too late as Komodo NNUE's search will not keep up with Stockfish NNUE's search...
Lol at that. Most of SF strength still comes from its search that is so much ahead of Komodo's. OTOH it is unrealistic to expect any noticeable strength difference between SF NNUE eval and Komodo NNUE eval. Since hand-crafted Komodo eval was better than SF eval the only thing one can expect is that Komod NNUE will not benefit as much from NNUE eval as Stockfish does, yielding even larger gap between SF NNUE and Komodo NNUE than between SF and K.