Is there place for neural networks in chess engines?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
pocopito
Posts: 238
Joined: Tue Jul 12, 2011 1:31 pm

Is there place for neural networks in chess engines?

Post by pocopito »

In the last times I've done some work on ANN and I wonder if they can be (or actually are being) used in chess engines. I'm not refering here to an ANN that plays chess, but more like using the characteristics of the ANN for recognizing patterns as part(s) of a "normal" engine. For example:

-Can an ANN be trained to:
- evaluate pawn structures? (passed, doubled, etc. pawns)
- decide we're either in the opening, middle game or endgame?
- detect weak-strong squares?
- evaluate the king safety?
- ...

Of course, these ideas (or any others) only make sense if these tasks can be achieved accurately and fastly.

(Go first place that I don't mean to invent any new about this stuff, but rather I'm curious about it and this time google hasn't provided me many info about this topic)

Regards

E Diaz
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: Is there place for neural networks in chess engines?

Post by rbarreira »

You could probably train a neural network to output heuristic values for those things, but I'm 99.99% sure they would have worse performance than existing hand-coded heuristics already in use in chess engines. For anything complex with ANN you need lots of neurons and connections between them which results it high overhead.

How did the saying go? Genetic algorithms are the second worst solution to every problem. Neural networks the worst.
uaf
Posts: 98
Joined: Sat Jul 31, 2010 8:48 pm
Full name: Ubaldo Andrea Farina

Re: Is there place for neural networks in chess engines?

Post by uaf »

IIRC Volker Annuss used ANN for time management in Hermann.
Volker Annuss
Posts: 180
Joined: Mon Sep 03, 2007 9:15 am

Re: Is there place for neural networks in chess engines?

Post by Volker Annuss »

There are two old threads about neural networks here.

http://www.talkchess.com/forum/viewtopi ... _view=flat

http://www.talkchess.com/forum/viewtopi ... _view=flat

Neural networks are slow, so it is difficult to get them working competitively. So you can only use them, where speed does not matter, or where you can hash the result.

My engine Hermann uses neural networks in two places.

Material evaluation

It was very complicated to get this working.
As an extreme example of what can go wrong, imagine an endgame where white has a big material advantage and a passed pawn. The neural network has learned, that the material in this position has a high winning probability. It has also learned, that the winning probability is not much higher, when the pawn is promoted.
There was a test version of Hermann, that sometimes did not promote, because that would mean to give up the positional bonus for the passer.

timing

This works much better. In iterative deepening, Hermann uses the properties of the result of the last iterations and the differences between them to get a probability, if the best move will change when going one ply deeper. Based on this it decides to continue or stop the search.

Look into the linked threads for more details.
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: Is there place for neural networks in chess engines?

Post by stegemma »

rbarreira wrote:...How did the saying go? Genetic algorithms are the second worst solution to every problem. Neural networks the worst.
Wow!!! So i'm doing the second worst thing that i can do with my new engine Satana... and i was thinking even about neural networks (but i know genetical algorithm better, so i choose those ones).
asanjuan
Posts: 214
Joined: Thu Sep 01, 2011 5:38 pm
Location: Seville, Spain

Re: Is there place for neural networks in chess engines?

Post by asanjuan »

There is a place for the neural networks. In fact, each positional table is equivalent to a perceptron with linear activation function from the mathematical point of view.
The set of PST is equivalent to a 2-level neural network with a single output signal.
The only difference is the way that you have programmed them, because the connections between the layers are currently implemented as procedures.
The rest of the positional weights can be mathematicaly modeled as another perceptron, included in your 2-level neural network. Maybe with 3 levels.

So you can for sure implement another procedure to train your "emulated" neural network with back-propagation or other methods to fit what you want.
The only problem is: ¿how to determine the error for back-propagation?