stand pat or side to move bonus

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: stand pat or side to move bonus

Post by mcostalba »

bob wrote: No attacked pieces and such, I believe that is the task of the search and q-search to resolve, hence the name "static evaluation" which excludes "dynamic considerations"
Threats evaluation is used to avoid erroneously stand pat when some threat could be pending.
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: stand pat or side to move bonus

Post by rvida »

lkaufman wrote: So the question can be re-phrased, do you believe that the decision to stand pat in quies should be based on a different score than is used for various pruning decisions in the main search? Using methods (B) or (C) would imply this. If so, why?
You use the same score everywhere with both methods (A) and (B), you just have to adjust margins. If you include tempo bonus in evaluate(), all your margins (used for 'various' pruning decisions in the main search) are offset by that value.
SuneF
Posts: 127
Joined: Thu Sep 17, 2009 11:19 am

Re: stand pat or side to move bonus

Post by SuneF »

lkaufman wrote:In at least 99% of chess positions, it's better to be on move than not. Therefore all strong programs take this into consideration when evaluating positions or making decisions. There appear to be three possibilities:

A. Simply give the side to move a bonus when doing an evaluation, which can either be a constant or may depend on something else.
B. When reaching quies, if you are below beta but within for example 10 centipawns of beta allow the cutoff.
C. Do both of the above.

What are the pros and cons of the three methods? We currently use method A, but I notice that some strong programs appear to use B or C. Are there any other possibilities in use for handling this issue?
Frenzee uses method A. Originally I used it to make the aspiration a bit more stable. Instead of having scores alternate between 0 and +0,30 at every iteration in the opening, by setting tempo to the mean 0,15 it stabilized around +0,15. This allowed me to tighten the aspiration window a tad. Also given two leaf positions with equal score (not counting a tempo bonus) you'd probably prefer the position with you in the move. So it seems a small bonus is justified.

If you're asking for a heuristic to make the bonus dynamic, I have none... Maybe if we had a measure of the amount of the volatility/tension/complexity of the position we could base it on that...
lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Re: stand pat or side to move bonus

Post by lkaufman »

rvida wrote:
lkaufman wrote: So the question can be re-phrased, do you believe that the decision to stand pat in quies should be based on a different score than is used for various pruning decisions in the main search? Using methods (B) or (C) would imply this. If so, why?
You use the same score everywhere with both methods (A) and (B), you just have to adjust margins. If you include tempo bonus in evaluate(), all your margins (used for 'various' pruning decisions in the main search) are offset by that value.
I notice that Critter evaluates symmetrical positions near the opening as +.05. If you don't give a bonus in evaluate but only use the bonus for stand pat decisions, what accounts for the displayed .05 score? Is it purely something added for display purposes only?
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: stand pat or side to move bonus

Post by diep »

lkaufman wrote:In at least 99% of chess positions, it's better to be on move than not. Therefore all strong programs take this into consideration when evaluating positions or making decisions. There appear to be three possibilities:

A. Simply give the side to move a bonus when doing an evaluation, which can either be a constant or may depend on something else.
B. When reaching quies, if you are below beta but within for example 10 centipawns of beta allow the cutoff.
C. Do both of the above.

What are the pros and cons of the three methods? We currently use method A, but I notice that some strong programs appear to use B or C. Are there any other possibilities in use for handling this issue?
D) Do not give the bonus at all
In Diep i'm not giving a bonus at all. Some 10+ years ago i tested many games with and without, and it didn't help at all, also to my surprise.

Sometimes it takes a year or 10 to understand something. Claim i heard that understanding the years 30 financial crisis took a year or 60.

In 90s there was many programs giving a bonus for having the side to move. Not surprisingly i also extensively experimented with it at different occasions.

In principle you can see having many chess patterns also as a temporarily pattern, as you can escape from this pattern or several patterns. Having the move you're allowed to maximize your position already, trying to get above alpha; not having the move you're not. So implicitly you already give a lot of bonus for having the move by means of how the search tree gets built up.

So whether such bonus for side to move works might depend upon how extensively a programs evaluation function is.

In fact i'm not even gonna experiment with a bonus for side to move anymore - it's been kicked out :)

Now if we assume a program has a decent evaluation function with more than just beancounter patterns, we can also reverse the question;
if in search we already struggle to get to a quiet position to evaluate, doesn't the side to move bonus basically contradict this strategy?

As it basically gives a bonus for having the side to move, you automatically create a random noise of the size of your bonus around the current quietness that might be there in the position;

So from that viewpoint a STM bonus doesn't work at all.

But now the lesson after 10 years:

Note that a STM bonus is a very weak form of a pattern.
If we have a white pawn on d2 and a white bishop on d3, we have a pattern and give a penalty for that.

To get the STM bonus you have a far weaker pattern which requires having the move as only condition. So it's at most a weak heuristic.

Vincent
Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: stand pat or side to move bonus

Post by Uri Blass »

diep wrote:
Now if we assume a program has a decent evaluation function with more than just beancounter patterns, we can also reverse the question;
if in search we already struggle to get to a quiet position to evaluate, doesn't the side to move bonus basically contradict this strategy?
No

The side to move in quiet positions is important otherwise null move could be often the best move in quiet position.

I understand the point of not having side to move bonus in case that the opponent has threats and the position will never be evaluated with opposite sides but if the position can be evaluated as a leaf node also with the opposite side to move then I see no reason not to give bonus for the side to move.
User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Re: stand pat or side to move bonus

Post by Rebel »

diep wrote: D) Do not give the bonus at all
In Diep i'm not giving a bonus at all. Some 10+ years ago i tested many games with and without, and it didn't help at all, also to my surprise.
I have the same experience.

From my (old) to-do-list:

1. King-safety and passed pawn: subtract 10-15-20-25% from the score, often the next ply the opponent can flatten the score.

2. In a quiet position after a series of captures add a penalty. Not seldom trouble starts afterwards.
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: stand pat or side to move bonus

Post by rvida »

lkaufman wrote:
rvida wrote:
lkaufman wrote: So the question can be re-phrased, do you believe that the decision to stand pat in quies should be based on a different score than is used for various pruning decisions in the main search? Using methods (B) or (C) would imply this. If so, why?
You use the same score everywhere with both methods (A) and (B), you just have to adjust margins. If you include tempo bonus in evaluate(), all your margins (used for 'various' pruning decisions in the main search) are offset by that value.
I notice that Critter evaluates symmetrical positions near the opening as +.05. If you don't give a bonus in evaluate but only use the bonus for stand pat decisions, what accounts for the displayed .05 score? Is it purely something added for display purposes only?
Please give a specific example. Without knowing the position I can only say that most probably it is exactly because of the reason you stated. (Tempo bonus is added to the stand pat score).
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: stand pat or side to move bonus

Post by diep »

Uri Blass wrote:
diep wrote:
Now if we assume a program has a decent evaluation function with more than just beancounter patterns, we can also reverse the question;
if in search we already struggle to get to a quiet position to evaluate, doesn't the side to move bonus basically contradict this strategy?
No

The side to move in quiet positions is important otherwise null move could be often the best move in quiet position.

I understand the point of not having side to move bonus in case that the opponent has threats and the position will never be evaluated with opposite sides but if the position can be evaluated as a leaf node also with the opposite side to move then I see no reason not to give bonus for the side to move.
What you're saying once again is that if you'd paint the mirrors red, you can't look in the mirrors, so because the mirrors aren't red, the car isn't red?

Uri, if i say i experimented with it a lot, then you can be sure i tried nearly all combinations, especially to *not* give the STM bonus directly after a qsearch nullmove.

This is the most trivial thing to experiment with. That didn't work either. If you think a tad longer about it you might also figure out why using the above red car not being red logics.

The bonus is a positional bonus - it nearly never can hide/cloak or whatever a tactical threat - so using that as an argument doesn't make sense either.

Furthermore i also experimented with different values for opening end endgame, didn't help either.

Most problems with the bonus are in endgame actually. With todays 30 ply search depths nearly every leaf position you evaluate is in endgame.

So i also tried extensive combinations there. It all just didn't help.

In fact i even tried weirdo ideas as to only give the bonus when you have developed less pieces than the opponent - basically annihilating the bonus for endgame thereby.

As i said, it takes 10 years to really understand what the bonus is.

The bonus is *only* based upon having the side to move. A very weak heuristic simply. If you have little positional patterns in an evaluation function, maybe such weak heuristic works - for Diep it didn't. I doubt it works objectively for beancounters as well. It's such a thing that typical is interesting at superbullet without deep openingsbook, yet not when search lines get a tad deeper than that.

If a bonus is a weak heuristic, it just adds noise to your evaluation, in this case noise the flips either say 0.040-0.100 pawn to above or below your evaluation. That's quite a swing if i may say so.

It's not only a weak heuristic, it also with like 50% odds can give the bonus to the wrong side, making it total contraproductive.

Please note that it doesn't lose that much elopoints giving the bonus. In todays more accurate tuned evaluation functions i guess it loses more elo though than 10 years ago. Yet the fact i could measure it hurting back then obviously means it's more significant than most changes that get discussed here.

With a weak pattern like STM bonus you really need to make a thinking step.

Give a GM a random position from a game (which doesn't make it a random position) and he'll be delighted having the move.

Now make the thinking step that the bonus gets applied AFTER a 30 ply search line, and suddenly it's a lot less interesting huh :)
lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Re: stand pat or side to move bonus

Post by lkaufman »

rvida wrote:
lkaufman wrote:
rvida wrote:
lkaufman wrote: So the question can be re-phrased, do you believe that the decision to stand pat in quies should be based on a different score than is used for various pruning decisions in the main search? Using methods (B) or (C) would imply this. If so, why?
You use the same score everywhere with both methods (A) and (B), you just have to adjust margins. If you include tempo bonus in evaluate(), all your margins (used for 'various' pruning decisions in the main search) are offset by that value.
I notice that Critter evaluates symmetrical positions near the opening as +.05. If you don't give a bonus in evaluate but only use the bonus for stand pat decisions, what accounts for the displayed .05 score? Is it purely something added for display purposes only?
Please give a specific example. Without knowing the position I can only say that most probably it is exactly because of the reason you stated. (Tempo bonus is added to the stand pat score).
I tried symmetrical openings like c4 c5 or d4 d5 Nf3 Nf6 or f4 f5 Nf3 Nf6 on 2 and 3 ply searches. Since you include positional moves in quiesce it's not so simple to get a symmetric pv, but whenever the displayed pv resulted in a symmetrical position, the score was always .05. Now unless you've changed things since you sent me code, your stand pat offset in the qsearch was 26 points out of 256, which is 0.10. It is of course quite logical that the displayed score should be half of the value of a full tempo, but what causes this to happen? What code results in all symmetric positions on a full board showing as +.05?