Deepchess - neural network engine

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Fafkorn
Posts: 16
Joined: Tue Apr 14, 2020 1:15 pm
Full name: Pawel Wojcik

Deepchess - neural network engine

Post by Fafkorn »

I'm trying to develop chess engine basing on this article:
https://www.cs.tau.ac.il/~wolf/papers/deepchess.pdf

I've got some knowledge about classic engines. Some time ago I've build engine that played about 2100 rating. It was my first big application, now I'd do many things better.

I'd like to ask if any of you tried to build an engine based on neural network and I'd like to hear some advices from you. Is it possible to achieve grandmaster level like authors of this article said?

It is my first day on this forum, if question like this appeared before, I appologise in advance.
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Deepchess - neural network engine

Post by brianr »

There have been major advances with NN engine development since this article came out.

Suggest starting here:

http://www.lczero.org/

And follow the links (the Github link to the repos, then Lc0, then to the Wiki), or jump to:

https://github.com/LeelaChessZero/lc0/wiki
Fafkorn
Posts: 16
Joined: Tue Apr 14, 2020 1:15 pm
Full name: Pawel Wojcik

Re: Deepchess - neural network engine

Post by Fafkorn »

Thanks for reply. Building Lc0 seems to be very difficult to me. I'd like to start with something a little less complicated. Grandmaster level as authors say is completely satisfying for me. I'm pretty new with neural network and I can't predict if the approach from this article is worth trying. Previously I created a model and it was a completely disaster. 9 of 10 moves seemed completely random, but authors claimed that it can play on 1400 rating level.
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Deepchess - neural network engine

Post by brianr »

I would skip the old paper until you better understand neural net training generally.

Typically people only build Lc0 if not on Windows.

Yes, Lc0 is quite complicated for chess, but there are some more introductory level options.

For a simpler approach you might start here.
https://github.com/Zeta36/chess-alpha-zero

Another closely related option to Lc0 is here:
https://github.com/dkappe/a0lite

For basic NN training mostly in just Python this blog is quite good (search for the older posts first):
https://machinelearningmastery.com/

And here:
http://cs231n.stanford.edu/

A more self-contained and excellent place to review things is Giraffe (follow the links to source etc):
https://www.chessprogramming.org/Giraffe
Fafkorn
Posts: 16
Joined: Tue Apr 14, 2020 1:15 pm
Full name: Pawel Wojcik

Re: Deepchess - neural network engine

Post by Fafkorn »

Thank you very much, I'll look at links closely. So you think that the approach presented in this paper is a waste of time?
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Deepchess - neural network engine

Post by brianr »

Yes.
I had tried to replicate the results and while I do not recall the details, it was disappointing.
Fafkorn
Posts: 16
Joined: Tue Apr 14, 2020 1:15 pm
Full name: Pawel Wojcik

Re: Deepchess - neural network engine

Post by Fafkorn »

I'm browsing links you've sent me, but I think I need more detailed description how to build such an engine, but thanks anyway :)
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Deepchess - neural network engine

Post by brianr »

See

https://web.stanford.edu/~surag/posts/alphazero.html

and



These are for Go, but the principals are the same.
Fafkorn
Posts: 16
Joined: Tue Apr 14, 2020 1:15 pm
Full name: Pawel Wojcik

Re: Deepchess - neural network engine

Post by Fafkorn »

I don't know if I'm repeating this subject but I have some doubts about neural network structure. My model should have two outputs:

First - continuous value of board state
I should learn model to evaluate postion. How can I learn model to evaluate position?

Second - probability distribution over all possible actions
Summarizing, it's 4096 possible actions in chess (excluding promotion options). This number is indeed that big or people have different approach?

Keras library would be suitable here?
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Deepchess - neural network engine

Post by brianr »

Yup.
I think one of the earlier suggested links (Zeta36) has a Keras implementation.
Lc0 is C++ for speed (playing games) and Python for training nets.

The outputs (or heads) would be Value (result of the game W/D/L mapped to some numerical range), and Policy (which move to make; actually all moves with a probability for each).

If you haven't yet, suggest reading the seminal paper and the magazine piece in the links from here:
https://www.chessprogramming.org/AlphaZero