SlowChess Blitz Classic 2.0

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

Moderators: hgm, Rebel, chrisw

jonkr
Posts: 178
Joined: Wed Nov 13, 2019 1:36 am
Full name: Jonathan Kreuzer

Re: SlowChess Blitz Classic 2.0

Post by jonkr »

I have released a SlowChess 2.4 on the SlowChess webpage.
It scored +20 elo in the 8-moves book versus SlowChess 2.3.
From the update notes:

Version 2.4 (+20 elo)
- Endgame neural nets for one piece endgames (King/Rook/pawns, KQps, KBps, KNps, KBps v KNps, KRps v KBps, KRps v KNps)
- A general endgame network for up to 2 pieces.
- Some general eval tuning
Notes :
The rook one the most trained, the least trained is probably the general but it was still a bit better than the handcrafted eval.
The material hash stores the index of which neural net if any to use when evaluating.
All the data files are in same directory as the exe now, and the nets/bitbases are packed into single files.
slow64 is AVX, there is noAvx, and noPop(/noAvx)

This is the first version with endgame neural nets. They can can provide pretty impressive play sometimes, but don't expect crazy strong endgame yet. I didn't finish training, it was still -37 elo to Stockfish 11 in the overall endgame test. I think up to -10 elo with only more training and bit more experimenting for how to arrange/generalize the nets would be easily possible (based on results of smaller subsets that I spent more time on.) However the computer time taken to train/test eventually started to seem less exciting since I don't have much resources and I stopped trying to keep my second computer running chess all the time, so after a while I figured should release what I have.

I do see some human-like qualities in the late endgame play and eval with neural nets now that I've been watching. How it will confidently keep a sure win, press its advantage and trade down when needed. Or recognize some sure draws to save itself that I expected would be too complicated for just board input. Also noticed connected passed pawns esp. with friendly king are even more important in rook + pawns endgames than I expected. One downside is sometimes might take a few more moves to win. I think I've mostly avoided endgame trolling that I really don't care for, but if I had time would try harder to make sure eval always a clear progression to win.

Anyway, the main reason releasing the moderate improvement is while I'm not abandoning chess or anything, working on something else sounds more interesting at this point. With the neural nets I wanted to experiment with a repeatable process that while not strictly "from zero", since it uses skilled opponents to reduce training time, was close enough that I could apply the same technique (and some of my same code) to other things. As I was figuring it out and just slowly training, trying out machine learning in other areas started to seem a more interesting experiment, since chess already has the NNUE code and nets for evaluating and learning and would take a long time for me to even start to get competitive with that. (Also eval I think is probably biggest and most chess specific part of strength and style, and it's possible that chess engines start to become all NNUE engines, and then maybe some search code starts to be considered as plugin library, since that's the other main part after eval, and I think I read here that in Shogi they use the SF search. It's not a big deal or unexpected, but is another reminder that at this point I'm making slow progress for relatively a lot of effort.) I do still want to try out stuff like adding midgame pawn structure NN and king safety related NN sometime.
User avatar
CMCanavessi
Posts: 1142
Joined: Thu Dec 28, 2017 4:06 pm
Location: Argentina

Re: SlowChess Blitz Classic 2.0

Post by CMCanavessi »

Nice !!! Awesome job!
Follow my tournament and some Leela gauntlets live at http://twitch.tv/ccls
AndrewGrant
Posts: 1769
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: SlowChess Blitz Classic 2.0

Post by AndrewGrant »

jonkr wrote: Mon Nov 02, 2020 7:26 pm Version 2.4 (+20 elo)
- Endgame neural nets for one piece endgames (King/Rook/pawns, KQps, KBps, KNps, KBps v KNps, KRps v KBps, KRps v KNps)
What exactly was the structure of these Networks?

I tried very hard to do King+Rooks+Pawns, and found _maybe_ 2 elo.
I tried very hard to do King+Knight+Pawns, and found 0 elo.
I tried very hard to do King+Bishop+Pawns, and found 0 elo.
I tried very hard to do King+Queen+Pawns, and found 0 elo.

I had planned on doing a small NN for all of these endgames, but gave up in the end.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
jonkr
Posts: 178
Joined: Wed Nov 13, 2019 1:36 am
Full name: Jonathan Kreuzer

Re: SlowChess Blitz Classic 2.0

Post by jonkr »

AndrewGrant wrote: Mon Nov 02, 2020 11:44 pm What exactly was the structure of these Networks?
For the one piece :

Code: Select all

	whiteInputCount = 64 + 48 + 32;// white uses horizontal symettry for king, 48 pawn squares, 64 squares for piece type
	blackInputCount = 64 + 48 + 64;

	network.SetInputCount(whiteInputCount + blackInputCount + 1); // +1 for side-to-move
	network.AddLayer(192, AT_RELU, LT_INPUT_TO_OUTPUTS);
	network.AddLayer(32, AT_RELU);
	network.AddLayer(32, AT_RELU);
	network.AddLayer(1, AT_LINEAR);
	network.Build();
The inputs are all 0 or 1 for PieceType on Square. The weights are all converted to int16 fixed point after training.
They are trained on the results of games played from endgame start positions that fit the type of endgame and positions from those games.
Rook endgames are by far the most common I found (even more so than I thought) and found the most elo there.
The general endgame is 224 first layer and for inputs has 64 squares for ROOK, 64 for BISHOP, and 64 for KNIGHT, in addition to King and Pawns. (But doesn't include queens.)
I just posted some more info in the technical discussion forum too.
AndrewGrant
Posts: 1769
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: SlowChess Blitz Classic 2.0

Post by AndrewGrant »

jonkr wrote: Mon Nov 02, 2020 11:56 pm
AndrewGrant wrote: Mon Nov 02, 2020 11:44 pm What exactly was the structure of these Networks?
For the one piece :

Code: Select all

	whiteInputCount = 64 + 48 + 32;// white uses horizontal symettry for king, 48 pawn squares, 64 squares for piece type
	blackInputCount = 64 + 48 + 64;

	network.SetInputCount(whiteInputCount + blackInputCount + 1); // +1 for side-to-move
	network.AddLayer(192, AT_RELU, LT_INPUT_TO_OUTPUTS);
	network.AddLayer(32, AT_RELU);
	network.AddLayer(32, AT_RELU);
	network.AddLayer(1, AT_LINEAR);
	network.Build();
The inputs are all 0 or 1 for PieceType on Square. The weights are all converted to int16 fixed point after training.
They are trained on the results of games played from endgame start positions that fit the type of endgame and positions from those games.
Rook endgames are by far the most common I found (even more so than I thought) and found the most elo there.
The general endgame is 224 first layer and for inputs has 64 squares for ROOK, 64 for BISHOP, and 64 for KNIGHT, in addition to King and Pawns. (But doesn't include queens.)
I just posted some more info in the technical discussion forum too.
We both did the same thing then, mirroring in the dataset as well, except I never converted to int16_ts.
Would you be willing to run a test with all NNs enabled vs all NNs disabled, to get the cumulative impact?

I _had_ planned to go down this route exhaustively, but gave up, and then quite chess altogether.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
jonkr
Posts: 178
Joined: Wed Nov 13, 2019 1:36 am
Full name: Jonathan Kreuzer

Re: SlowChess Blitz Classic 2.0

Post by jonkr »

AndrewGrant wrote: Tue Nov 03, 2020 1:08 am Would you be willing to run a test with all NNs enabled vs all NNs disabled, to get the cumulative impact?
I'll run an overnight test. I'm assuming you mean normal start positions, so : 8-moves book, 15s + .15, 2.4 with nets vs 2.4 no nets. I'll post results tomorrow.

I think almost all the elo gain is in the endgame nets but haven't verified that. Probably something like 8-moves book self-play is one of the best cases for showing late endgame improvements. Even if it is near +20, that still amounts to less than half an elo gained per day overall, and probably less than 1 elo per day even in the general endgames.epd starting positions. If I hadn't broken it down into the individual small endgame suites in the beginning I wouldn't have known it was working, except to go from very bad to passable after some training. So I decided to take a break even though it was working since it would take quite some time (in my initial excitement I had ideas of reaching the limits of training the endgame nets and finding optimal structures and processes, then working my way back toward the midgame then opening, but the space grows much bigger quickly.)
AndrewGrant
Posts: 1769
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: SlowChess Blitz Classic 2.0

Post by AndrewGrant »

jonkr wrote: Tue Nov 03, 2020 2:18 am
AndrewGrant wrote: Tue Nov 03, 2020 1:08 am Would you be willing to run a test with all NNs enabled vs all NNs disabled, to get the cumulative impact?
I'll run an overnight test. I'm assuming you mean normal start positions, so : 8-moves book, 15s + .15, 2.4 with nets vs 2.4 no nets. I'll post results tomorrow.

I think almost all the elo gain is in the endgame nets but haven't verified that. Probably something like 8-moves book self-play is one of the best cases for showing late endgame improvements. Even if it is near +20, that still amounts to less than half an elo gained per day overall, and probably less than 1 elo per day even in the general endgames.epd starting positions. If I hadn't broken it down into the individual small endgame suites in the beginning I wouldn't have known it was working, except to go from very bad to passable after some training. So I decided to take a break even though it was working since it would take quite some time (in my initial excitement I had ideas of reaching the limits of training the endgame nets and finding optimal structures and processes, then working my way back toward the midgame then opening, but the space grows much bigger quickly.)
The other question is how are you training them? Some dirty Pytorch script? I have a tool I could offer you (privately) that might let you train nets quite a bit faster than Pytorch, maybe 8x to 16x Faster, which could help you get a few more elo out of it.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
jonkr
Posts: 178
Joined: Wed Nov 13, 2019 1:36 am
Full name: Jonathan Kreuzer

Re: SlowChess Blitz Classic 2.0

Post by jonkr »

The test results :
7000 games 15s + .15 EndgameNets (+20.4 elo) 1370-957-4673

It's enough to say that the gain was mainly the nets, since this was same .exe with nets vs without. (The error bar still pretty high, 2.4 vs 2.3 exact score was +20.8 elo, and I had already run a another endgame net re-tuning since that one, so not an exact comparison.)

I'm using a tensorflow script to train the weights. Probably 98% of the time is running the matches to generate the scored positions (and test for progress), so I didn't bother setting up the GPU support even. Also I'm already out of chess mode now. So it's probably not worth any bother, although the vagueness of the statement makes it sound interesting to see what it is :)

If I decide I want to try to gain elo I probably should look at how NNUE is trained to figure out why people can do it quicker, I'm guessing there's some large file(s) people download with lots of varied positions, and if the initial eval is good enough doing searches to score ends up much quicker at refining/passing evaluations around than playing new games and using results, and starting with everything covered by a general net is best to pickup most important features for elo (although the specific smaller endgame nets I'm pretty sure should have some gain over 1 general net, since with good data they can put the same or more info into a faster calculation when covering a smaller gamespace.) When I was doing the endgame nets I wanted specifically to test learning starting from no data and no evaluation. Having skilled opponents maybe pretty big shortcut, but being able to beat an opponent trained against shows the learning is pretty decent.
ThatsIt
Posts: 991
Joined: Thu Mar 09, 2006 2:11 pm

Re: SlowChess Blitz Classic 2.0

Post by ThatsIt »

Hi,

SlowChess 2.4 always disconnects under cutechess-cli100, under the Shredder Classic GUI Slow Chess does nothing. I've tried several things, for example BookEnabled=0, no success.
Any ideas?

Best wishes,
G.S.
(CEGT team)
Krzysztof Grzelak
Posts: 1530
Joined: Tue Jul 15, 2014 12:47 pm

Re: SlowChess Blitz Classic 2.0

Post by Krzysztof Grzelak »

Under Shredder Classic 5 the engine is working fine.