Neural networks for chess position evaluation- request

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Neural networks for chess position evaluation- request

Post by Daniel Shawul »

Final game result is fine as it is. It is already successfully used for training hand-crafted evaluation functions which are simply a single layer neural network.
For evaluation tuning we use "quiet positions" with no hidden tactics (forks, pins etc), so will you be looking for such position or are you going to try to solve tactics with the NN as well ?

I am sure you are aware of Giraffe chess engine which already tried the NN approach for chess evaluation. How do you say your approach is different and an improvement on that work ? There are optimisists like me that a NN evaluation would result in a very strong chess engine, given that the slow network evaluation time is solved with a hardware+software approach.

Good luck and keep us updated.

Daniel
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Neural networks for chess position evaluation- request

Post by jdart »

I can give you a file of about 5 million positions with game results. These are non-quiescent: if you want only quiescent positions you would have to filter.

--Jon
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Neural networks for chess position evaluation- request

Post by Michel »

I'd like to try to implement AlphaGo's algorithm for chess. I wonder if anyone is trying. That sounds like a very interesting project, and I would not be surprised if it could produce a very strong chess program.
That would be quite exciting!
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
Rein Halbersma
Posts: 741
Joined: Tue May 22, 2007 11:13 am

Re: Neural networks for chess position evaluation- request

Post by Rein Halbersma »

Rémi Coulom wrote:My advice:

1. Using the final result of the game is fine. This is what we do in Go. You'll need really many games, but it is easy to generate many.

2. I took a quick look at your NN architecture. My advice is:
- Use a separate channel for black and white pieces
- Instead of black/white, encode input as "my color"/"opponent's color" from the point of view of the player to move.
- You'll also have to encode castling availability. This can be done with a channel that indicates which rook can castle.

I'd like to try to implement AlphaGo's algorithm for chess. I wonder if anyone is trying. That sounds like a very interesting project, and I would not be surprised if it could produce a very strong chess program.
Re: the number of input channels, why not have a channel for every bitboard in your position? So 8x8 2D inputs for black pawns through king, same for white, plus one empty (so 13 input channels in all). If you then do 3x3x13 convolutions on the input layer, and go up 4+ layers (so that effective receptive field in the final layer is larger than 8x8), the model should be able to learn piece interactions across the entire board.

Another question that I have: can heavy multi-layer neural nets overcome the much shorter computation time of a linear eval with pure alpha-beta? Maybe if enough GPU power is crammed into a pc, but the Giraffe program still had plenty of room to improve in order to catch up to the state-of-the-art.
Rémi Coulom
Posts: 438
Joined: Mon Apr 24, 2006 8:06 pm

Re: Neural networks for chess position evaluation- request

Post by Rémi Coulom »

I am convinced that a convolutional neural network should be able to learn an evaluation function that is considerably better than any hand-made evaluation. But it will be much slower.

Whether it can be competitive with traditional engines is difficult to predict.

It is fun and exciting to try, anyway.

I believe the best approach is to learn value + policy, like in alphago, and use the policy to grow a very selective MCTS tree. It may be better than alpha-beta.

Also, good efficiency might require chess-specific layers. I am thinking about knight-jump convolution, diagonal convolution, rook-move convolution, etc.

Modern deep-learning hardware will help to close the gap, too. A 8xV100 machine is really tremendous in terms of computing power.
Rémi Coulom
Posts: 438
Joined: Mon Apr 24, 2006 8:06 pm

Re: Neural networks for chess position evaluation- request

Post by Rémi Coulom »

Another funny idea: it might be possible to make a neural network using bitboards in a binarized neural network: https://arxiv.org/abs/1602.02830
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Neural networks for chess position evaluation- request

Post by Michel »

coulom wrote:I believe the best approach is to learn value + policy, like in alphago, and use the policy to grow a very selective MCTS tree. It may be better than alpha-beta.
One can argue that current state of the art chess engines are already using a form of Monte Carlo search. Trees are very narrow and the "policy" is generated dynamically using an assortment of history mechanisms.

Where alpha-beta search really shines is in its ability to resolve tactics quickly. In the past I think tactics were the achilles heel of traditional MCTS attempts in chess. It would be interesting to see if things have changed.

Giraffe uses a NN for evaluation but alpha beta for search (albeit node based instead of depth based).
Last edited by Michel on Tue Nov 14, 2017 2:38 pm, edited 2 times in total.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
Rein Halbersma
Posts: 741
Joined: Tue May 22, 2007 11:13 am

Re: Neural networks for chess position evaluation- request

Post by Rein Halbersma »

Michel wrote: One can argue that current state of the art chess engines are already using a form of Monte Carlo search. Trees are very narrow and the "policy" is generated dynamically using an assortment of history mechanisms.

Where alpha-beta search really shines in its ability to resolve tactics quickly. In the past I think tactics were the achilles heel of traditional MCTS attempts in chess. It would be interesting to see if things have changed.

Giraffe uses a NN for evaluation but alpha beta for search (albeit node based instead of depth based).
It would be quite something if a NN would be able to spot mate-in-N (for small N) without look-ahead and with high accuracy.
Rémi Coulom
Posts: 438
Joined: Mon Apr 24, 2006 8:06 pm

Re: Neural networks for chess position evaluation- request

Post by Rémi Coulom »

By MCTS, I mean the AlphaGo zero approach, where there is no random playouts. Playouts are completely replaced by neural-network evaluation.

I believe a large network can read a lot of tactics. The raw neural-network of AlphaGo is (weak) pro strength by itself, with no search at all.

Of course, convolutional neural networks fit the game of Go much more than the game of Chess. That's why I am thinking about chess-specific NN architectures.

Maybe working in the 8x8x8x8 space of piece movements might be better than the 8x8 board. I guess the policy would have to be of size 8x8x8x8, anyways. 8x8 and 8x8x8x8 units may have to be combined, somehow.

It's interesting to think about it. I'll certainly give it a try some day.
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Neural networks for chess position evaluation- request

Post by Michel »

By MCTS, I mean the AlphaGo zero approach, where there is no random playouts. Playouts are completely replaced by neural-network evaluation.
I had understood that. So roughly speaking the point is to replace alpha beta search with UCT search (both can be combined with NN leaf node evaluation).

I think in the past UCT combined with a heuristic evaluation has not worked well in chess (tactics...). But perhaps it would be different with a high quality NN evaluation. It is certainly an exciting thought.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.