Can somebody explain what makes Leela as strong as Komodo?

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

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by smatovic »

chrisw wrote: Thu Jan 17, 2019 12:54 pm
smatovic wrote: Thu Jan 17, 2019 12:17 pm
chrisw wrote: Thu Jan 17, 2019 11:10 am
corres wrote: Thu Jan 17, 2019 10:37 am
chrisw wrote: Thu Jan 17, 2019 9:51 am
lkaufman wrote: Thu Jan 17, 2019 6:28 am
Chessqueen wrote: Wed Jan 16, 2019 5:41 pm Is it the Hardware speed or some breakthrough programming innovation?
So far what is the score between Komodo and Leela ?
https://www.youtube.com/watch?v=ymDA7-hdkKA
My answer is a bit different than others. Leela (following AlphaZero) has found a way to use a powerful GPU for chess, which is itself composed of hundreds or even thousands of cores. So far the only method that has made use of the GPU for chess is Neural Network. If we (Komodo or any other non-NN engine) could find a way to make use of these thousands of cores for chess other than NN we would probably have clearly the top engine, but it's not easy because these GPU cores are not able to do all the things a CPU can do. If Leela (or AlphaZero) runs on a CPU, it's rather pathetic.
There’s a chess engine reported a few years ago that runs on gpu. Gpu has enough instructions to also operate as a “computer” and, as you presumably know, one can use logic operations as a alternative to branching (branching instructions exist I think, but are not so easy as with cpu.)
The main issue is the cores of GPUs used in parallel to get higher effectiveness.
But a classical AB chess engine works such a way that it can not exploit well the parallel computation.
This is true for a PC with many cores and a GPU what has much more cores.
Moreover cores of GPUs are specialized for image representation and not for common logical and numerical computations.
I think one of the most effective usage of many cores for developing chess engines is the using of NN technique.
AB programmer just has to change his mindset and he can write perfectly fine AB program on GPU.
GPU as it’s name suggests was developed to enable throwing around lots of screen memory, but it’s actually a general purpose computer with memory and instruction set. If programmer adopts appropriate mind set everything and anything is possible.
It is possible to port an simple AB engine to gpu...

https://zeta-chess.app26.de/post/zeta-v099/

and i am not the only one who worked on it...

https://zeta-chess.app26.de/post/papers ... ee-search/
https://zeta-chess.app26.de/post/other- ... -projects/

But NN just seem to be an "natural" fit for gpus.

--
Srdja
Can GPUs do integer shift and logic operations? If so you can generate all pseudo legal at once in a few instructions (using logic and unrolling the usual loops), all attacks in a few instructions. Which implies evaluate N positions all at once, N subject to GPU RAM size. Knowing all children evals at once at each node would massively increase AB performance, or MCTS performance for that matter. Same operations across parallel threads and you’ld be evaluating and exploiting N nodes across the tree all at once. The limit on N is GPU RAM.
Bingo, stronger, much faster variant of AB. Just needs a new mind set. ducks behind sandbags as waves of negativity ensues .....
Yes, they can do shifts and logic operations, and Ankan showed with his gpu perft how fast a move generator can be on gpu,
but to implement a whole AB search on gpu someone has really to wrap his mind around the architecture,
there are several limitations compared to CPU...

https://www.chessprogramming.org/GPU
https://zeta-chess.app26.de/post/why-co ... n-on-gpus/

--
Srdja
corres
Posts: 3657
Joined: Wed Nov 18, 2015 11:41 am
Location: hungary

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by corres »

smatovic wrote: Thu Jan 17, 2019 12:17 pm ...
But NN just seem to be an "natural" fit for gpus.
Srdja
Right and this is the essence.
grahamj
Posts: 43
Joined: Thu Oct 11, 2018 2:26 pm
Full name: Graham Jones

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by grahamj »

corres wrote: Thu Jan 17, 2019 1:26 pm
smatovic wrote: Thu Jan 17, 2019 12:17 pm ...
But NN just seem to be an "natural" fit for gpus.
Srdja
Right and this is the essence.
If NNs are such a natural fit for GPUs, why is NVIDIA's NN library so big? The Windows DLL is 280Mb, about 100x the size of the SF and LC0 binaries put together. It appears that NVIDIA have spent a huge amount of developer time making NNs work fast on their GPUs. This would not be necessary if there was a natural fit between the computation and the hardware.
Graham Jones, www.indriid.com
corres
Posts: 3657
Joined: Wed Nov 18, 2015 11:41 am
Location: hungary

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by corres »

grahamj wrote: Thu Jan 17, 2019 3:01 pm
corres wrote: Thu Jan 17, 2019 1:26 pm
smatovic wrote: Thu Jan 17, 2019 12:17 pm ...
But NN just seem to be an "natural" fit for gpus.
Srdja
Right and this is the essence.
If NNs are such a natural fit for GPUs, why is NVIDIA's NN library so big? The Windows DLL is 280Mb, about 100x the size of the SF and LC0 binaries put together. It appears that NVIDIA have spent a huge amount of developer time making NNs work fast on their GPUs. This would not be necessary if there was a natural fit between the computation and the hardware.
These .dll drastically enhance the effectiveness of GPUs for NN.
Moreover these are the universal connection not for chess engine but a lot of other using.
smatovic
Posts: 2639
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by smatovic »

grahamj wrote: Thu Jan 17, 2019 3:01 pm
corres wrote: Thu Jan 17, 2019 1:26 pm
smatovic wrote: Thu Jan 17, 2019 12:17 pm ...
But NN just seem to be an "natural" fit for gpus.
Srdja
Right and this is the essence.
If NNs are such a natural fit for GPUs, why is NVIDIA's NN library so big? The Windows DLL is 280Mb, about 100x the size of the SF and LC0 binaries put together. It appears that NVIDIA have spent a huge amount of developer time making NNs work fast on their GPUs. This would not be necessary if there was a natural fit between the computation and the hardware.
I am just a layman in NN,
but as you know, there are plenty ways to implement a NN,
so i guess that is what Nvidia did, they offer highly optimized code for different kinds of NN,
for about 10 different GPU architectures.

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

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by smatovic »

grahamj wrote: Thu Jan 17, 2019 3:01 pm
corres wrote: Thu Jan 17, 2019 1:26 pm
smatovic wrote: Thu Jan 17, 2019 12:17 pm ...
But NN just seem to be an "natural" fit for gpus.
Srdja
Right and this is the essence.
If NNs are such a natural fit for GPUs, why is NVIDIA's NN library so big? The Windows DLL is 280Mb, about 100x the size of the SF and LC0 binaries put together. It appears that NVIDIA have spent a huge amount of developer time making NNs work fast on their GPUs. This would not be necessary if there was a natural fit between the computation and the hardware.
...if you take a broad look at GPUs,
they offer massive parallel fp32 operations and a bunch of memory bandwidth,
what fits better to implement, a classic chess engine or a neural network?

--
Srdja
grahamj
Posts: 43
Joined: Thu Oct 11, 2018 2:26 pm
Full name: Graham Jones

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by grahamj »

smatovic wrote: Thu Jan 17, 2019 3:40 pm
grahamj wrote: Thu Jan 17, 2019 3:01 pm
corres wrote: Thu Jan 17, 2019 1:26 pm
smatovic wrote: Thu Jan 17, 2019 12:17 pm ...
But NN just seem to be an "natural" fit for gpus.
Srdja
Right and this is the essence.
If NNs are such a natural fit for GPUs, why is NVIDIA's NN library so big? The Windows DLL is 280Mb, about 100x the size of the SF and LC0 binaries put together. It appears that NVIDIA have spent a huge amount of developer time making NNs work fast on their GPUs. This would not be necessary if there was a natural fit between the computation and the hardware.
...if you take a broad look at GPUs,
they offer massive parallel fp32 operations and a bunch of memory bandwidth,
what fits better to implement, a classic chess engine or a neural network?

--
Srdja
I don't think we know yet. It required a massive implementation effort by NVIDIA to get NNs to work fast enough. By comparison, very little effort has been put into implementing classic chess engines on GPUs. Not your fault of course, just everyone else's :)
Graham Jones, www.indriid.com
smatovic
Posts: 2639
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by smatovic »

grahamj wrote: Thu Jan 17, 2019 5:21 pm
smatovic wrote: Thu Jan 17, 2019 3:40 pm
grahamj wrote: Thu Jan 17, 2019 3:01 pm
corres wrote: Thu Jan 17, 2019 1:26 pm
smatovic wrote: Thu Jan 17, 2019 12:17 pm ...
But NN just seem to be an "natural" fit for gpus.
Srdja
Right and this is the essence.
If NNs are such a natural fit for GPUs, why is NVIDIA's NN library so big? The Windows DLL is 280Mb, about 100x the size of the SF and LC0 binaries put together. It appears that NVIDIA have spent a huge amount of developer time making NNs work fast on their GPUs. This would not be necessary if there was a natural fit between the computation and the hardware.
...if you take a broad look at GPUs,
they offer massive parallel fp32 operations and a bunch of memory bandwidth,
what fits better to implement, a classic chess engine or a neural network?

--
Srdja
I don't think we know yet. It required a massive implementation effort by NVIDIA to get NNs to work fast enough. By comparison, very little effort has been put into implementing classic chess engines on GPUs. Not your fault of course, just everyone else's :)
:) i can only agree

--
Srdja
User avatar
mclane
Posts: 18748
Joined: Thu Mar 09, 2006 6:40 pm
Location: US of Europe, germany
Full name: Thorsten Czub

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by mclane »

Leela, lcz wins because it has no AB search.

It uses a different search and a different evaluation. That makes it difficult for AB programs to find out what it is planning.

It's like chess in a parallel universe.
It's very difficult to find out for the AB animal.

You can call it paradigm change

But the true next step in computer chess development is the moment when the machine is planning something.
So far the machines find a bunch of good moves by chance. The AB programs do not really play chess. They solve test suites.
The next step is that the engine defines a plan and tries to make this plan work. By using moves.
What seems like a fairy tale today may be reality tomorrow.
Here we have a fairy tale of the day after tomorrow....
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Can somebody explain what makes Leela as strong as Komodo?

Post by Dann Corbit »

Javier Ros wrote: Thu Jan 17, 2019 10:09 am
chrisw wrote: Thu Jan 17, 2019 9:51 am
lkaufman wrote: Thu Jan 17, 2019 6:28 am
Chessqueen wrote: Wed Jan 16, 2019 5:41 pm Is it the Hardware speed or some breakthrough programming innovation?
So far what is the score between Komodo and Leela ?
https://www.youtube.com/watch?v=ymDA7-hdkKA
My answer is a bit different than others. Leela (following AlphaZero) has found a way to use a powerful GPU for chess, which is itself composed of hundreds or even thousands of cores. So far the only method that has made use of the GPU for chess is Neural Network. If we (Komodo or any other non-NN engine) could find a way to make use of these thousands of cores for chess other than NN we would probably have clearly the top engine, but it's not easy because these GPU cores are not able to do all the things a CPU can do. If Leela (or AlphaZero) runs on a CPU, it's rather pathetic.
There’s a chess engine reported a few years ago that runs on gpu. Gpu has enough instructions to also operate as a “computer” and, as you presumably know, one can use logic operations as a alternative to branching (branching instructions exist I think, but are not so easy as with cpu.)

See

http://chessgpgpu.blogspot.com/

and

http://nikolachess.com/

It is a pity that the links of the videos don't work, only the donation button works! :D :D
I think those were bogus, but Zeta OpenCL was the real deal. Not a powerhouse, because it was not a NN design, but it played decent chess.
I think GPUs will be a natural for mate proof search because you only need win/loss/draw information and the fastest move generator in the world runs on GPUs.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.