Page 1 of 7

Announcing lczero

Posted: Tue Jan 09, 2018 6:55 am
by gladius
https://github.com/glinscott/leela-chess

It's a port of GCP's Leela Zero (https://github.com/gcp/leela-zero) to chess. GCP and the community have really done a wonderful job on the project.

The goal of the project is a distributed training project for the network weights, hopefully building a strong chess AI from scratch. I haven't had time to set up the training server yet. It's getting close though :). If anyone wants to work on it as well, please let me know! It's exciting to see a totally different method of search/evaluation be competitive, and we need a public version of this.

Interestingly for chess, it appears that you need a really fast GPU to match the speed of evaluating the NN using the CPU! I get about 1,200 nodes/sec, running on 2 threads using CPU on my macbook pro. The GPU gives only 120 nodes/sec! My desktop with a Titan X gets about 2000 nodes/sec. This is also using a 5x64 net, instead of the AlphaZero 20x256 net, which would probably only be feasible on GPU.

There is incredibly basic UCI support (plays out a fixed 800 nodes) included.

Here is a game generated using the initial (completely random) weights:
[pgn]
1. b4 h5 2. h4 d5 3. Nh3 Nd7 4. Na3 Rh7 5. f4 e5 6. c4 exf4 7. Nf2 Ke7 8. cxd5 g5
9. Qc2 g4 10. Qb1 Kf6 11. Qe4 Qe8 12. e3 Qe6 13. Bc4 Be7 14. Ke2 Rb8 15. Qd4+ Ne5
16. Ne4+ Kg7 17. Rd1 Bxb4 18. Rg1 Bd6 19. Bb3 Qg6 20. Qa4 Qg5 21. Qc4 Bf5 22. Qd4
Be7 23. Qa4 Bf6 24. Qe8 Bd8 25. Qe7 Bxe7 26. d6 Re8 27. dxe7 Bg6 28. hxg5 g3 29. Nf6
Nxe7 30. Ng8 N7c6 31. Ne7 Nd8 32. Nxg6 R8h8 33. Ne7 Rf8 34. Ng6 R8h8 35. Ne7 Rf8
36. Ng6 R8h8
[/pgn]

Re: Announcing lczero

Posted: Tue Jan 09, 2018 6:59 am
by CMCanavessi
Interesting!!

Re: Announcing lczero

Posted: Tue Jan 09, 2018 7:24 am
by jd1
Very interesting project!

Re: Announcing lczero

Posted: Tue Jan 09, 2018 4:24 pm
by Joerg Oster
gladius wrote:https://github.com/glinscott/leela-chess

It's a port of GCP's Leela Zero (https://github.com/gcp/leela-zero) to chess. GCP and the community have really done a wonderful job on the project.

The goal of the project is a distributed training project for the network weights, hopefully building a strong chess AI from scratch. I haven't had time to set up the training server yet. It's getting close though :). If anyone wants to work on it as well, please let me know! It's exciting to see a totally different method of search/evaluation be competitive, and we need a public version of this.
Wow! This looks like another great project!

I predict Fishtest will stall for a while once the distributed training will be online.

Re: Announcing lczero

Posted: Wed Jan 10, 2018 1:23 am
by gladius
Overnight, I did the first training run, which consists of generating self-play games with noise enabled, in this case only 160 games. Then, ran the tensorflow training script, which optimizes the net for those 160 games. This resulted in a new network, which I then pitted in a 100 game match against the old network.

The result was 31-3-66, or 100 ELO improvement. So it is proving that the network can learn, and the code is not too buggy!

There are a few things left to do before kicking off the distributed work. The positions are not sent to the network relative to the player to move, which is something AlphaZero did.

Re: Announcing lczero

Posted: Wed Jan 10, 2018 1:34 am
by CMCanavessi
That is really awesome news! I'll follow this project closely.

I predict Fishtest will stall for a while once the distributed training will be online.
I predict that sooner or later Stockfish will have to change and adopt NN one way or another, and fishtest will be migrated to make Stockfish learn playing itself.

Re: Announcing lczero

Posted: Wed Jan 10, 2018 6:11 am
by gladius
A pretty amusing training game :).

[pgn]
1. f3 d5 2. b3 c6 3. d3 Qd6 4. Bh6 Qxh6 5. Nh3 Qe6 6. Kf2 Qf5 7. Kg3 h5 8. Nf2
h4# {Black mates} 0-1
[/pgn]

Re: Announcing lczero

Posted: Wed Jan 10, 2018 7:36 am
by Jhoravi
Hi, Does the playing engine require GPU or just during training?

Re: Announcing lczero

Posted: Wed Jan 10, 2018 7:54 am
by gladius
Jhoravi wrote:Hi, Does the playing engine require GPU or just during training?
GPU is not required for playing games currently (although a fast GPU will be faster than a CPU).

Re: Announcing lczero

Posted: Wed Jan 10, 2018 3:14 pm
by cdani
Nice! Congratulations!