Suggesting newer Neural Networks

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Look
Posts: 366
Joined: Thu Jun 05, 2014 2:14 pm
Location: Iran
Full name: Mehdi Amini

Suggesting newer Neural Networks

Post by Look »

In addition to currently used Neural Network (NN) , there could be more NN in chess engines. The current one AFAIK is KPST. I can call it a tactical NN.

Positional NN is the one with Piece being able to move to an empty square. Considering that the empty "to" square gains no material; I expect Static exchange evaluation (SEE) to be zero on "to" square. Since it should be safe to place Piece into "to" square. Couples are "from" square containing Piece and empty "to" square. Consider this example:

[d]2r1r1k1/1p2qpp1/p2p1b2/3P4/n1P4p/1N3P2/PPRQB1PP/1R5K w - - 0 23

white's B on e2 has possible safe moves Be2-d1 Be2-f1 Be2-d3. After move Bf1 he has: Bf1-e2 Bf1-d3. In case of f4 it in addition to three previous moves of Be2 it has: Be2-f3 Be2-g4 Be2-h5.

Suppose f4 g6 is played (Note: better responses could exist for black).

[d]2r1r1k1/1p2qp2/p2p1bp1/3P4/n1P2P1p/1N6/PPRQB1PP/1R5K w - - 0 24

White has previously said moves for his Be2 now except Be2-h5. White will lose his B on h5 (SEE<0). Now Be2-h5 has to be excluded from said couples.

Another possible NN is "king safety" NN. In middle games specially (not endgames) king better has the cover of surrounding pawns. One may consider pawns in front of king or besides of the king. Consider these examples:

[d]8/2pk2p1/3bp3/p5Nr/P3R3/5P1P/2PB2n1/2K5 w - - 0 29

For white king , Kc1-Pc2 for black Kd7-Pe6 and Kd7-Pc7 couples exist.

[d]2rq1rk1/p2bppb1/1p1p2pp/8/1PPP4/1QN5/P3BPPP/2RR2K1 b - - 0 19

White has Kg1-Pf2 Kg1-Pg2 Kg1-Ph2. black has: Kg8-Pf7.

Examples taken from Stockfish 11 games in CCRL.
Farewell.
OfekShochat
Posts: 50
Joined: Thu Oct 15, 2020 10:19 am
Full name: ghostway

Re: Suggesting newer Neural Networks

Post by OfekShochat »

That's really cool! Maybe harder to implement but really cool. Specially the tactical one because it is an original idea (not offensive here just king safety nns were already an idea but maybe not implemented because they figured it was hard because for training it you would need to make like a genetic algorithm because there are no real targets for it)
Pi4Chess
Posts: 253
Joined: Mon Nov 16, 2020 12:13 pm
Full name: Manuel Rivera

Re: Suggesting newer Neural Networks

Post by Pi4Chess »

I think the first team that will be able to train and use multiple specialized nets in relevant way within an engine will lead the computer chess for many years.
Pio
Posts: 334
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: Suggesting newer Neural Networks

Post by Pio »

Pi4Chess wrote: Mon Dec 28, 2020 7:31 pm I think the first team that will be able to train and use multiple specialized nets in relevant way within an engine will lead the computer chess for many years.
I don’t think that is the way to go at all. Why using many specialised nets when a bigger net can learn everything. The only thing you might gain is speed and not a lot of it anyway.

It is a simple task to combine different networks (specialised or not) by just combining the last layer/layers of the networks, fixate the base layers so they won’t change during training and train the last layer/layers combination.

I have an idea (actually I have several) of how to make a really small but yet very capable net completely different from what I have seen people talking about. The beauty with my idea is that it will be able to evaluate positions in a way people do it and that is it will be able to search both ways from start to end and end to start so it will work a little bit like a retrograde analyser. The net will mainly consist of 64 cells where each cell represents a square. Each cell has an inner state consisting of information it has learnt. From start each cell/square will only have bits set to say what piece and colour is present. The cells communicate only with cells that could be reached from the cell by all of the chess pieces. Some of the inner state of the cell will have to go through an identity mapping so that vital information won’t get destroyed. For example will the starting state representation have to be identity mapped. When we run through the cells we will first start by communicating the forward moves and the net will be able to learn things like SEE and stuff like that. When we have done the first iteration we will iterate the net backward in a retrograde way so we for example learn that some squares are weak or some squares attack the king and so on. We continue this process going forward and backward as long as we see it necessary. My guess is that 20 iterations will do quite well but of course the stopping criteria does not have to be fixed. Since all cells are equal the training will become faster and the net will be a lot less prone to overfitting. Lastly you will have to have a way to see how good the position is and you can do it by having a small neural network combining the cells (or part of the cells) together to output a win and draw probability.
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: Suggesting newer Neural Networks

Post by Joerg Oster »

Pio wrote: Tue Dec 29, 2020 12:12 am
Pi4Chess wrote: Mon Dec 28, 2020 7:31 pm I think the first team that will be able to train and use multiple specialized nets in relevant way within an engine will lead the computer chess for many years.
I don’t think that is the way to go at all. Why using many specialised nets when a bigger net can learn everything. The only thing you might gain is speed and not a lot of it anyway.

It is a simple task to combine different networks (specialised or not) by just combining the last layer/layers of the networks, fixate the base layers so they won’t change during training and train the last layer/layers combination.

I have an idea (actually I have several) of how to make a really small but yet very capable net completely different from what I have seen people talking about. The beauty with my idea is that it will be able to evaluate positions in a way people do it and that is it will be able to search both ways from start to end and end to start so it will work a little bit like a retrograde analyser. The net will mainly consist of 64 cells where each cell represents a square. Each cell has an inner state consisting of information it has learnt. From start each cell/square will only have bits set to say what piece and colour is present. The cells communicate only with cells that could be reached from the cell by all of the chess pieces. Some of the inner state of the cell will have to go through an identity mapping so that vital information won’t get destroyed. For example will the starting state representation have to be identity mapped. When we run through the cells we will first start by communicating the forward moves and the net will be able to learn things like SEE and stuff like that. When we have done the first iteration we will iterate the net backward in a retrograde way so we for example learn that some squares are weak or some squares attack the king and so on. We continue this process going forward and backward as long as we see it necessary. My guess is that 20 iterations will do quite well but of course the stopping criteria does not have to be fixed. Since all cells are equal the training will become faster and the net will be a lot less prone to overfitting. Lastly you will have to have a way to see how good the position is and you can do it by having a small neural network combining the cells (or part of the cells) together to output a win and draw probability.
Now, this sounds really cool!
Jörg Oster
Pio
Posts: 334
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: Suggesting newer Neural Networks

Post by Pio »

Joerg Oster wrote: Tue Dec 29, 2020 4:18 am
Pio wrote: Tue Dec 29, 2020 12:12 am
Pi4Chess wrote: Mon Dec 28, 2020 7:31 pm I think the first team that will be able to train and use multiple specialized nets in relevant way within an engine will lead the computer chess for many years.
I don’t think that is the way to go at all. Why using many specialised nets when a bigger net can learn everything. The only thing you might gain is speed and not a lot of it anyway.

It is a simple task to combine different networks (specialised or not) by just combining the last layer/layers of the networks, fixate the base layers so they won’t change during training and train the last layer/layers combination.

I have an idea (actually I have several) of how to make a really small but yet very capable net completely different from what I have seen people talking about. The beauty with my idea is that it will be able to evaluate positions in a way people do it and that is it will be able to search both ways from start to end and end to start so it will work a little bit like a retrograde analyser. The net will mainly consist of 64 cells where each cell represents a square. Each cell has an inner state consisting of information it has learnt. From start each cell/square will only have bits set to say what piece and colour is present. The cells communicate only with cells that could be reached from the cell by all of the chess pieces. Some of the inner state of the cell will have to go through an identity mapping so that vital information won’t get destroyed. For example will the starting state representation have to be identity mapped. When we run through the cells we will first start by communicating the forward moves and the net will be able to learn things like SEE and stuff like that. When we have done the first iteration we will iterate the net backward in a retrograde way so we for example learn that some squares are weak or some squares attack the king and so on. We continue this process going forward and backward as long as we see it necessary. My guess is that 20 iterations will do quite well but of course the stopping criteria does not have to be fixed. Since all cells are equal the training will become faster and the net will be a lot less prone to overfitting. Lastly you will have to have a way to see how good the position is and you can do it by having a small neural network combining the cells (or part of the cells) together to output a win and draw probability.
Now, this sounds really cool!
Thank you Joerg!

I am glad that someone sees the potential 😀

After I thought up this scheme (which is a type of cellular automaton) I wondered if something similar had been thought of before and I found a similar idea from the 1980:s and it is called cellular neural networks. I have never seen it implemented in any game though. I think this type of architecture will be very good for almost every task since the ability to search both ways is extremely useful in complex problems since the higher dimensionality the greater gain you can get. In a two dimensional problem you save a factor two when doubling the problem size and for a problem of dimensionality 10 you save a factor 1028. Let us say that chess has the dimensionality of two since it is a two dimensional board and let us say a deep neural network can find search related things to a depth of 32 that is 5 doublings. With my cellular network idea the cellular network should be able to do the same task 32 times faster and if given the same time reach a depth of 64, i.e it should be able to find things double as deep (times some constant) as a traditional neural network.

Since the scaling of my method is so much better than traditional networks I think it has huge potential.

The potential is not worth anything if it doesn’t work so time will tell