AlphaZero

Discussion of chess software programming and technical issues.

Moderator: Ras

thomasahle
Posts: 94
Joined: Thu Feb 27, 2014 8:19 pm

Re: AlphaZero

Post by thomasahle »

Check outthe Fastchess of you're interested: https://github.com/thomasahle/fastchess . It's a python implementation of the MCTS approach in the Alpha Zero papers, and it uses the simplest "Neural" network architecture possible: A linear function from the current boolean board to the next move. (A 1895 x 4095 matrix.)

If all you want is 2000 ELO this should be more than enough. Fastchess is 1700-1800 ELO and it is written in Python.

You need some data to train on. The best, easily accessible data is the cclr-v3 data from http://data.lczero.org/files/
brianr
Posts: 541
Joined: Thu Mar 09, 2006 3:01 pm
Full name: Brian Richardson

Re: AlphaZero

Post by brianr »

A couple of things. The CCRL Standard Dataset is quite valuable as it provides a trained net benchmark to compare against a net you have trained from the same data. However, as mentioned earlier, the Bad Gyal data will produce stronger nets having more Policy information. And, of course, the actual Lc0 data has full Policy info and will produce even better nets.

In terms of pre-processing the data, be aware that Windows struggles with directories that have a large number of files (more than about 30,000). So, I try to limit the number of games/chunk files (if one game per chunk, some datasets have more than one game, like I think Bad Gyal data) to about 30,000 in a multi-level directory structure. If you try to open a directory with the 2 million files from the CCRL Standard dataset, it will appear as if your system is hanging for a very long time (even with fast SSD disk). There may be some Windows tools to help with this, but I used Ubuntu to split the large directory into many smaller sub-directories, which only has to be done one time.
Milos
Posts: 4190
Joined: Wed Nov 25, 2009 1:47 am

Re: AlphaZero

Post by Milos »

Fafkorn wrote: Wed Apr 29, 2020 5:53 pm Thank you very much. I couldn't find this in any paper.
Using softmax after fully connected layer does what you need automatically. It's a basic CNN stuff pretty much a norm in any classification task.
Fafkorn
Posts: 16
Joined: Tue Apr 14, 2020 1:15 pm
Full name: Pawel Wojcik

Re: AlphaZero

Post by Fafkorn »

Yes, but softmax doesn't know how to prevent from giving non zero values to illegal moves
Fafkorn
Posts: 16
Joined: Tue Apr 14, 2020 1:15 pm
Full name: Pawel Wojcik

Re: AlphaZero

Post by Fafkorn »

Due to fast chess comment
I think that I have MCTS implementation and NN model build already behind me. I've started to train my model with some engine games data. I don't know how to use lczero data for my own purpose. I guess that my policy size (4096 possible moves) is different from their.
User avatar
maksimKorzh
Posts: 776
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: AlphaZero

Post by maksimKorzh »

thomasahle wrote: Tue May 05, 2020 10:51 am Check outthe Fastchess of you're interested: https://github.com/thomasahle/fastchess . It's a python implementation of the MCTS approach in the Alpha Zero papers, and it uses the simplest "Neural" network architecture possible: A linear function from the current boolean board to the next move. (A 1895 x 4095 matrix.)

If all you want is 2000 ELO this should be more than enough. Fastchess is 1700-1800 ELO and it is written in Python.

You need some data to train on. The best, easily accessible data is the cclr-v3 data from http://data.lczero.org/files/
Hi Thomas, I was searching for the simplest "Neural" network architecture possible and came across your fastchess repo on github. It claims: "Predicts the best chess move with 27.5% accuracy by a single matrix multiplication" - does single matrix multiplication mean that the NN is essentially a single layer perceptron without hidden layers at all? And another question is how to build the model without involving fasttext library? Did you use it just to avoid converting board to input vectors?
thomasahle
Posts: 94
Joined: Thu Feb 27, 2014 8:19 pm

Re: AlphaZero

Post by thomasahle »

Hi Maksim,

Your assertion is correct: Logistic regression is just like a neural network/perceptron with no hidden layers.

I used FastText because it is a very fast logistic regression algorithm on sparse inputs. You could use something else too if you'd like.