NNUE

Discussion about development of draughts in the time of computer and Internet.
Post Reply
Sidiki
Posts: 313
Joined: Thu Jan 15, 2015 16:28
Real name: Coulibaly Sidiki

Re: NNUE

Post by Sidiki » Tue Jul 13, 2021 18:00

Joost Buijs wrote:
Tue Jul 13, 2021 06:24
Sidiki wrote:
Mon Jul 12, 2021 19:14

We will be glad to accept all the update, if you give us this chance.
Scan had many versions since 1.0's.

I don't know if you know that Kingsrow latest version it's now 1.63 since 2nd july.

Just to said that we are with all each of you that permit to us to have the update.

A program will never be perfect.

Friendly, Sidiki.

Hi Sidiki,

As soon as I'm satisfied with the performance of the program you will get a copy as promised. The current version is slower than it could be, this is something I want to address first. Another thing is that it needs fast AVX2, not all computers have this or have a slow implementation like the AMD Zen1.

Thanks for noticing me about Kingsrow 1.63, I don't look at this forum very often and missed it completely.

Like you said, a program will never be perfect.
Hi Joost,

Thanks again, we will wait for the release. The last test against Kingsrow 1.62 show that things are in a good way.

Opposing differents playing style of strong programs are very important for players who want to increase they playing knowledge and playing strenght.

Thanks again for all, you, Ed, Bert, Fabien, Rein, Michel, Taille, Jaap and the others for sacrifying your time and sleeping time to giving us these fun moments.

God bless you all.

Friendly, Sidiki.

BertTuyt
Posts: 1573
Joined: Wed Sep 01, 2004 19:42

Re: NNUE

Post by BertTuyt » Wed Jul 14, 2021 12:04

In the meantime I'm retired ( :D ), and spent much time during the last months to relocate from Switzerland back to Holland.
So now i restarted work on the Damage engine.

Yesterday (and tonight) Damage 16.1 (nnue version) played a match (158 games) against Scan 3.1
Match settings 65 moves/1 minute, no book, 6p DB, and both uses 6 cores.

Result, 2 losses (for Damage) and 156 draws.

So nnue (like also Joost mentioned) is getting closer towards the eval pattern-based programs (like Scan and Kingsrow), but you need up-to-date hardware, and to get onto par, most likely another 2 years with new developments related to nnue and next generation processors with improved vector instruction capabilities.

Match played on a computer with the equipment.

Processor - Intel core i7 87000K
Hard disc - Samsung 970 EVO
Memory - 32 GB DDR4 2133
System - Windows 10 64 bit

Bert
Attachments
DXPMatch damageengine161 scan 6c.pdn
(173.15 KiB) Downloaded 273 times

Krzysztof Grzelak
Posts: 1307
Joined: Thu Jun 20, 2013 17:16
Real name: Krzysztof Grzelak

Re: NNUE

Post by Krzysztof Grzelak » Wed Jul 14, 2021 15:50

Good score Bert.

Sidiki
Posts: 313
Joined: Thu Jan 15, 2015 16:28
Real name: Coulibaly Sidiki

Re: NNUE

Post by Sidiki » Wed Jul 14, 2021 22:35

BertTuyt wrote:
Wed Jul 14, 2021 12:04
In the meantime I'm retired ( :D ), and spent much time during the last months to relocate from Switzerland back to Holland.
So now i restarted work on the Damage engine.

Yesterday (and tonight) Damage 16.1 (nnue version) played a match (158 games) against Scan 3.1
Match settings 65 moves/1 minute, no book, 6p DB, and both uses 6 cores.

Result, 2 losses (for Damage) and 156 draws.

So nnue (like also Joost mentioned) is getting closer towards the eval pattern-based programs (like Scan and Kingsrow), but you need up-to-date hardware, and to get onto par, most likely another 2 years with new developments related to nnue and next generation processors with improved vector instruction capabilities.

Match played on a computer with the equipment.

Processor - Intel core i7 87000K
Hard disc - Samsung 970 EVO
Memory - 32 GB DDR4 2133
System - Windows 10 64 bit

Bert
Hi Bert,

Welcome :D
This result it's once again good for "NNUE'S WORLD"

We are discovering little by little the growing of this technology.
Once again WELCOME and God bless you all for all you done, doing and will do for us.

Friendly, Sidiki.

Krzysztof Grzelak
Posts: 1307
Joined: Thu Jun 20, 2013 17:16
Real name: Krzysztof Grzelak

Re: NNUE

Post by Krzysztof Grzelak » Sun Aug 22, 2021 09:13

I am wondering about one question. It is known that NNUE uses a processor. And what would happen to use a better graphics card instead of the processor. Just like chess. Is it possible.

BertTuyt
Posts: 1573
Joined: Wed Sep 01, 2004 19:42

Re: NNUE

Post by BertTuyt » Sun Aug 22, 2021 12:11

Krzysztof,

the advantage of NNUE is that in runs on the processor only, so also in the chess world one use NNUE without graphics card (example Stockfish).
Programs which use far larger neural networks and MCTS (like Leela-zero) use a graphics card.
I expect that due to latency NNUE on a graphics card (GPU) will result in a slower program, but I'm not 100% sure.

As all manufacturers of processors, consider AI (and NN) as the next big thing, one can expect processor architecture improvements related to NN.
An example is the new Sapphire Rapids processor from Intel (introduction Q2 2022) which has AMX (which is far better compared with AVX2 and avx512).
With AMX (Advanced Matrix Extensions) one can calculate one neuron layer in a NNUE with only a limited number of instructions.

This will boost NNUE, and not impossible that in the end NNUE will run as fast (or even faster) as the approach used by programs like Kingsrow and Scan.
Unfortunately the server processors from Intel cost a fortune, so one need to wait for implementation on the desktop (HEDT).

I expect that this will happen end 2022 beginning 2023.

Bert

Sidiki
Posts: 313
Joined: Thu Jan 15, 2015 16:28
Real name: Coulibaly Sidiki

Re: NNUE

Post by Sidiki » Tue Oct 05, 2021 05:39

Hi to all,

As also a chess player, i got an chess engine called Eman 7.40, the latest version , controversed by Stockfish team about GPL right, (this isn't the subject of the post),contains something that retain my attention for the NNUE's world. A kind of self learning as Alphazero.

It's about a kind of saving playing experience by the engine linked to the quality of move encountered, the author Omar Khalid will explain it perfectly to you on this forum.
https://cumnor-chess-server.com/phpbb/v ... p?f=9&t=30

Joost Buijs
Posts: 460
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: NNUE

Post by Joost Buijs » Tue Oct 05, 2021 07:48

Hi Sidiki,

What Eman does looks pretty much like a technique called 'root-learning', this is something that has already been pioneered back in 1959 by Samuel's checkers program. Alpha-Zero makes use of a 'policy network' which is a different technique although the net effect could look similar.

The new version of Ares (v1.5) that I'm working on will start with a completely random neural network and automatically updates the network while playing against itself (or against others). I have the feeling that this will give better results than by playing many games in advance with a 'dumb' version of the program and having the network learn from these.

I will add an EGDB too. The network has difficulties understanding positions with just a few pieces which sometimes makes the program play a wrong move by going for a material win which actually tuns out to be a draw or even a loss. Probably a 6P DB will be sufficient to solve most of these problems.

The problem with Draughts is that on modern hardware with multi-core and longer thinking-times (like in Krzysztof's tournament), 99.9% of the games will be draw. A self learning system won't learn anything from draws so you have to decrease thinking-time to get more decisive games, which in return has the drawback that you will miss out on some tactical patterns, this is IMHO not so easy to solve.

Joost

Sidiki
Posts: 313
Joined: Thu Jan 15, 2015 16:28
Real name: Coulibaly Sidiki

Re: NNUE

Post by Sidiki » Tue Oct 05, 2021 13:41

Joost Buijs wrote:
Tue Oct 05, 2021 07:48
Hi Sidiki,

What Eman does looks pretty much like a technique called 'root-learning', this is something that has already been pioneered back in 1959 by Samuel's checkers program. Alpha-Zero makes use of a 'policy network' which is a different technique although the net effect could look similar.

The new version of Ares (v1.5) that I'm working on will start with a completely random neural network and automatically updates the network while playing against itself (or against others). I have the feeling that this will give better results than by playing many games in advance with a 'dumb' version of the program and having the network learn from these.

I will add an EGDB too. The network has difficulties understanding positions with just a few pieces which sometimes makes the program play a wrong move by going for a material win which actually tuns out to be a draw or even a loss. Probably a 6P DB will be sufficient to solve most of these problems.

The problem with Draughts is that on modern hardware with multi-core and longer thinking-times (like in Krzysztof's tournament), 99.9% of the games will be draw. A self learning system won't learn anything from draws so you have to decrease thinking-time to get more decisive games, which in return has the drawback that you will miss out on some tactical patterns, this is IMHO not so easy to solve.

Joost
Hi Joost,

This it's very nice, this kind of auto skill. The idea is fantastic.

It also clear that with an EGDB any NNUE's engine will have a better result. We saw it with Damage 16.1 NNUE at the last tournament.

Concerning the draw rate, yes, with a long time thinking, almost games will be draw. The genius of each programmer help just to do the difference. We will will be happy to see the NNUE's world grow up and have some most powerful program.

So to get a fun, the next tournament, that with help of you, Bert, Ed and the others, i will run , because i got some powerful latops, will be a blitz.

Thanks for this draughts community and all the participants.

Friendly, Sidiki

Madeleine Birchfield
Posts: 12
Joined: Mon Jun 22, 2020 12:36
Real name: Madeleine Birchfield

Re: NNUE

Post by Madeleine Birchfield » Wed Nov 10, 2021 05:43

I'm wondering, has anybody written an engine that uses NNUE for (10x10) Frisian draughts?

gwiesenekker
Posts: 17
Joined: Sun Feb 20, 2011 21:04
Real name: Gijsbert Wiesenekker

Re: NNUE

Post by gwiesenekker » Mon Feb 07, 2022 21:12

Hi,

I am now also testing NNUE in GWD but my networks seem to converge to a drawish value: if I calculate the average of (evaluation - 0.5)^2 before I train the network I get say 0.02, and when I train the network it converges to this value. Both Mathematica and Tensorflow give similar results. Has anyone seen this before and if so, what have you done about it?

As input I use positions coming from game databases and/or self-play games, encoded as vectors of length 101 (the colour-to-move, the positions of the white and black men, no kings yet). I use WLD or a scaled result as the label.

Regards,
GW

BertTuyt
Posts: 1573
Joined: Wed Sep 01, 2004 19:42

Re: NNUE

Post by BertTuyt » Wed Feb 09, 2022 11:43

Gijsbert, nice to hear that you also started with NNUE.
As you will find out ML (Machine Learning) is not a free lunch.

In my case i struggled quite some time to find (in first instance) the optimal game set (and derived from that the position set).
Next to that as the method we both use is supervised learning, the labels of the positions is crusial.
Although i copied/pasted the pyhon scripts from Jonathan Kreuzer (with small changes like a 191 vector length) i got total non-sense when using W, D, L labels (which seem to work for him). Also the NN is crusial, in my case (think you do the same), a fully connected NN, 4 layers, 191 input and with 256, 32, 32 and 1 neuron.

So i labeled the positions with the evaluation fucntion of a previous Damage version and applied a sigmoid on these values (so all data was in the end between 0.0 and 1.0).
Last but not least the ML algorithms are something of a black box, and with the wrong parameter setting also things can go nuts.

Maybe you want to share the position-set, and i can test here if i might get better results.

Anyway, welcome again in this forum.

Bert

gwiesenekker
Posts: 17
Joined: Sun Feb 20, 2011 21:04
Real name: Gijsbert Wiesenekker

Re: NNUE

Post by gwiesenekker » Thu Feb 10, 2022 11:23

Hi Bert,

Thanks for your response. Meanwhile I have been looking into the positions that were generated. What I have been doing until now is: Play a 'random' game. If I really play randomly without a search the positions quickly become unequal (which is good as I do not only want 'drawish' positions) but also very unrealistic (very 'unequal'). Instead, I shuffle the moves and then do a shallow 4-ply material-only search, the idea being to play random moves that are not 'too random'. The reason for doing a material-only search is that if I would include GWD's patterns all moves would have a unique score, so GWD would play the same move in the same position all the time. I would continue until the game was finished, and then I assigned a weighted score to each intermediate game position based on the outcome of the game: starting at 0.5 and then slowly increasing/decreasing (or staying at 0.5 if the game was a draw) towards the final result, the idea being that the 'intermediate' positions already have some 'unknown signs' that the position is good/bad. However, if you look at the intermediate good/bad positions there are many in which easily a better move could have been played, perhaps even drawing the game. I tried a 6-ply material-only search, but in that case almost all games ended in a draw, leaving me with too many 'drawish' positions.
I am now trying the following: I do a shallow 2-ply material-only search, the idea being to a play random moves that are not 'too random' but also not 'too good/too bad', so hopefully this will give me a reasonable mix of equal but also unequal positons (but not 'too unequal'). The value that I assign to the position however is no longer based on the final result, but on the result of a 'deep' (ideally VERY deep) search, the idea being that you get a 'good' evaluation also for the unequal positions. 'deep' cannot be 'too deep' if you want to generate 100M positions in a reasonable time however, I am now using a 6-ply material-only search.
I will keep you posted on the results and yes, I would be happy to share the training set with you so that at least I know that I am not doing anything wrong on the Keras side when training the network.

Regards,
GW
Last edited by gwiesenekker on Thu Feb 10, 2022 14:59, edited 2 times in total.

gwiesenekker
Posts: 17
Joined: Sun Feb 20, 2011 21:04
Real name: Gijsbert Wiesenekker

Re: NNUE

Post by gwiesenekker » Thu Feb 10, 2022 14:26

Hi,

The first results for 1M positions generated in the above way look promising. BTW, I scale the result of the material-only search back to the interval [0.0, 1.0] using the sigmoid 1.0/(1.0 + 10**(-(search score)/((value of a man) * 2))), so two men ahead gives a 90% probability of winning the game. The distribution of the positions in the training set is roughly 200.000 positions with a man up/down, 200.000 positions with two or more men up/down and 500.000 equal positions.
I start with an RMSE (compared to 0.5) of 0.058 and the network converges to a validation loss of 0.0094 after 100 epochs.

Regards,
GW

BertTuyt
Posts: 1573
Joined: Wed Sep 01, 2004 19:42

Re: NNUE

Post by BertTuyt » Fri Feb 11, 2022 19:20

Gijsbert, what is the network topology you use, the "ususal" 256x32x32x1 ?

Bert

Post Reply