Different eval for white/black

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

matthewlai
Posts: 793
Joined: Sun Aug 03, 2014 4:48 am
Location: London, UK

Different eval for white/black

Post by matthewlai »

Random idea of the day -

Has anyone experimented with using different eval functions for white vs black?

When we use the same eval for both, we are assuming the opponent thinks just like we do. That's not a valid assumption if the opponent has a very different playing style, for example.

What if we can tune an eval function to behave more like the opponent, and use it to decide on moves as the opponent?

One possible way to implement this is to apply 2 eval functions on leaf nodes, and propagate the scores back up as a pair.

On plies where it's the program's move, we take the max of the scores of our own eval, and on plies where it's the opponent's move, we take the max of the scores of the eval that is supposed to model the opponent.

I believe most/all current optimizations should still work correctly.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
elpapa
Posts: 211
Joined: Sun Jan 18, 2009 11:27 pm
Location: Sweden
Full name: Patrik Karlsson

Re: Different eval for white/black

Post by elpapa »

So the goal is to improve the engine vs. one specific opponent?
matthewlai
Posts: 793
Joined: Sun Aug 03, 2014 4:48 am
Location: London, UK

Re: Different eval for white/black

Post by matthewlai »

elpapa wrote:So the goal is to improve the engine vs. one specific opponent?
Yes.

Unless the "opponent eval" can be tuned on the fly based on what the opponent has played so far.

But what I had in mind is tuning against a specific opponent beforehand.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Different eval for white/black

Post by bob »

matthewlai wrote:
elpapa wrote:So the goal is to improve the engine vs. one specific opponent?
Yes.

Unless the "opponent eval" can be tuned on the fly based on what the opponent has played so far.

But what I had in mind is tuning against a specific opponent beforehand.
This should be doable. But it represents a LOT of work for a minimal gain. For example, when you attend the next WCCC with a "tuned program" all you can tune against is existing versions. But most participants will show up with code that has some new ideas included, which means you are now playing against a different opponent than the one you tuned against. Against static programs it would certainly work, but it does represent an enormous computational cost.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Opening preperation

Post by sje »

bob wrote:This should be doable. But it represents a LOT of work for a minimal gain. For example, when you attend the next WCCC with a "tuned program" all you can tune against is existing versions. But most participants will show up with code that has some new ideas included, which means you are now playing against a different opponent than the one you tuned against. Against static programs it would certainly work, but it does represent an enormous computational cost.
GM level human players do this by preparing opening repertoires targeted to opponents based on prior opponent play. This once provided a big tactical advantage in those years long past when most games went twenty to thirty ply deep with prepared opening moves on both sides. Today with huge opening databases which force diverse play, the idea doesn't work so well.

Having different positional evaluations or search customizations based on opponent modeling sounds like a big bug magnet; tough to implement and tougher to debug. Also, it would be very difficult to accurately measure results against human players -- how do you expect any human to play a thousand or more games needed for testing?
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Different eval for white/black

Post by mcostalba »

matthewlai wrote:Random idea of the day -

Has anyone experimented with using different eval functions for white vs black?
Stockfish used two have the famous Aggressiveness and Cowardice UCI parameters, they did exactly this: different king safety evaluation according if you were the side to move (at root) or not. The two parameters were target one at the side to move and the other at the defending side.

They have been removed because testing proved them useless...but a lot of people claimed and still claim because we remove from their hands their preferred toy knob :-)
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Different eval for white/black

Post by Michel »

They have been removed because testing proved them useless...


"Useless" is not an appropriate term for a technical forum. It means completely different things to different people.

In this context it means : "Has not been proven to yield an elo gain when measured from the starting position."

EDIT: Needless to say that I am personally happy that these asymmetric eval terms were removed.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Different eval for white/black

Post by mcostalba »

Michel wrote:
They have been removed because testing proved them useless...


"Useless" is not an appropriate term for a technical forum. It means completely different things to different people.

In this context it means : "Has not been proven to yield an elo gain when measured from the starting position."

EDIT: Needless to say that I am personally happy that these asymmetric eval terms were removed.
I used "useless" like "your post is useless"....
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Different eval for white/black

Post by Michel »

I used "useless" like "your post is useless"....
Can you clarify?
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
User avatar
hgm
Posts: 27811
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Different eval for white/black

Post by hgm »

mcostalba wrote:..., they did exactly this: different king safety evaluation according if you were the side to move (at root) or not.
Unless I misunderstood the OP this is not what he proposed at all. In his idea both evaluations are always made in every leaf, irrespective of who has the move in the root, and both propagated towards the root based on the chosen move. It is the side to move at the current ply level that decides which of the two evaluations will be used to determine which move is best.

I wonder how badly this interferes with alpha-beta pruning, however. If side A takes a beta cutoff, his score would be a lower bound, because there are unsearched moves that might score higher. There is no guarantee at all that the opponent (B)'s score associated with that move is a lower bound. One of the unsearched moves might have a better A-score, but a lower B-score (both from A point of view), so that the true B-score of the node would actually be lower.