Announcing lczero

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
gladius
Posts: 535
Joined: Tue Dec 12, 2006 9:10 am

Announcing lczero

Post by gladius » Tue Jan 09, 2018 5:55 am

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]

User avatar
CMCanavessi
Posts: 730
Joined: Thu Dec 28, 2017 3:06 pm
Location: Argentina

Re: Announcing lczero

Post by CMCanavessi » Tue Jan 09, 2018 5:59 am

Interesting!!

jd1
Posts: 263
Joined: Wed Oct 24, 2012 12:07 am

Re: Announcing lczero

Post by jd1 » Tue Jan 09, 2018 6:24 am

Very interesting project!

Joerg Oster
Posts: 640
Joined: Fri Mar 10, 2006 3:29 pm
Location: Germany

Re: Announcing lczero

Post by Joerg Oster » Tue Jan 09, 2018 3:24 pm

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.
Jörg Oster

gladius
Posts: 535
Joined: Tue Dec 12, 2006 9:10 am

Re: Announcing lczero

Post by gladius » Wed Jan 10, 2018 12:23 am

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.

User avatar
CMCanavessi
Posts: 730
Joined: Thu Dec 28, 2017 3:06 pm
Location: Argentina

Re: Announcing lczero

Post by CMCanavessi » Wed Jan 10, 2018 12:34 am

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.

gladius
Posts: 535
Joined: Tue Dec 12, 2006 9:10 am

Re: Announcing lczero

Post by gladius » Wed Jan 10, 2018 5:11 am

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]

Jhoravi
Posts: 243
Joined: Wed May 08, 2013 4:49 am

Re: Announcing lczero

Post by Jhoravi » Wed Jan 10, 2018 6:36 am

Hi, Does the playing engine require GPU or just during training?

gladius
Posts: 535
Joined: Tue Dec 12, 2006 9:10 am

Re: Announcing lczero

Post by gladius » Wed Jan 10, 2018 6:54 am

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).

User avatar
cdani
Posts: 2065
Joined: Sat Jan 18, 2014 9:24 am
Location: Andorra
Contact:

Re: Announcing lczero

Post by cdani » Wed Jan 10, 2018 2:14 pm

Nice! Congratulations!

Post Reply