stand pat or side to move bonus

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: stand pat or side to move bonus

Post by bob »

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?
I've done this for a long time in Crafty. Current values are 5 and 8 for middle-game and endgame. I tested a bunch of different combinations, but those were best at the time. Not a huge gain anyway, but still, every Elo point counts...

I don't particularly see any difference in any of the above. If you add in the bonus, you may well cause a cutoff anyway. If you just check for the cutoff, you might save a little time.

Doing both seems redundant...
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: Rybka, Stockfish, and Komodo all agree with you on your preference for (A), and for the reasons you give (at least speaking for Rybka and Komodo). I'm sure that the authors of Ippo, Critter, Ivanhoe etc. are aware of this argument. So they must see some compensating advantage in using method (B) or (C). But what could it be?
I don't really see a fundamental difference between (A) and (B). It should not matter if I grant the bonus inside evaluate() or add it after the call.

As for (C), it sounds like adding the bonus 2x which is again same as (A) or (B) just with 2x higher value.
I don't think A and B are the same. (A) changes the value whenever the eval is called, while (B) only affects quiescence decisions. Therefore (C) is also different from both.
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?
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: stand pat or side to move bonus

Post by lech »

rvida wrote: I don't really see a fundamental difference between (A) and (B). It should not matter if I grant the bonus inside evaluate() or add it after the call.
It is possible to skip a static evaluate() after null-move by removing all non-static code. The second way is to mark non-static evaluate()s (1 bit).
E.g. in Stockfish both margins WHITE and BLACK can be saved in 14 bits.
Maybe, I can't be friendly, but let me be useful.
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 »

bob wrote:
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?
I've done this for a long time in Crafty. Current values are 5 and 8 for middle-game and endgame. I tested a bunch of different combinations, but those were best at the time. Not a huge gain anyway, but still, every Elo point counts...

I don't particularly see any difference in any of the above. If you add in the bonus, you may well cause a cutoff anyway. If you just check for the cutoff, you might save a little time.

Doing both seems redundant...
It's odd that you found that the value should go UP in the endgame, while both SF and Komodo found the opposite! I wonder why?
The difference between A and B is in whether the bonus affects only quies decisions (B) or all decisions thruout the search (A), for examply futility.
Uri Blass
Posts: 10267
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: stand pat or side to move bonus

Post by Uri Blass »

lkaufman wrote:
bob wrote:
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?
I've done this for a long time in Crafty. Current values are 5 and 8 for middle-game and endgame. I tested a bunch of different combinations, but those were best at the time. Not a huge gain anyway, but still, every Elo point counts...

I don't particularly see any difference in any of the above. If you add in the bonus, you may well cause a cutoff anyway. If you just check for the cutoff, you might save a little time.

Doing both seems redundant...
It's odd that you found that the value should go UP in the endgame, while both SF and Komodo found the opposite! I wonder why?
The difference between A and B is in whether the bonus affects only quies decisions (B) or all decisions thruout the search (A), for examply futility.
I think that the best bonus should be dependent on the question if the side to move has a piece or a pawn under threat and not only on the stage of the game.

Programs that evaluate the threat in their evaluation function can probably give bigger bonus for the side to move.

If Crafty does not evaluate threats in the evaluation function then it does not seem to me strange to have a smaller bonus in the middle game because in the middle game there are more cases when a piece is under threat.
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 »

Uri Blass wrote:
lkaufman wrote:
bob wrote:
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?
I've done this for a long time in Crafty. Current values are 5 and 8 for middle-game and endgame. I tested a bunch of different combinations, but those were best at the time. Not a huge gain anyway, but still, every Elo point counts...

I don't particularly see any difference in any of the above. If you add in the bonus, you may well cause a cutoff anyway. If you just check for the cutoff, you might save a little time.

Doing both seems redundant...
It's odd that you found that the value should go UP in the endgame, while both SF and Komodo found the opposite! I wonder why?
The difference between A and B is in whether the bonus affects only quies decisions (B) or all decisions thruout the search (A), for examply futility.
I think that the best bonus should be dependent on the question if the side to move has a piece or a pawn under threat and not only on the stage of the game.

Programs that evaluate the threat in their evaluation function can probably give bigger bonus for the side to move.

If Crafty does not evaluate threats in the evaluation function then it does not seem to me strange to have a smaller bonus in the middle game because in the middle game there are more cases when a piece is under threat.
That sounds like an excellent explanation! However it does not explain why Critter (or Ippo or Ivanhoe) did not find it beneficial to use higher middlegame bonuses, since I believe they all reward attacks in eval.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: stand pat or side to move bonus

Post by bob »

lkaufman wrote:
bob wrote:
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?
I've done this for a long time in Crafty. Current values are 5 and 8 for middle-game and endgame. I tested a bunch of different combinations, but those were best at the time. Not a huge gain anyway, but still, every Elo point counts...

I don't particularly see any difference in any of the above. If you add in the bonus, you may well cause a cutoff anyway. If you just check for the cutoff, you might save a little time.

Doing both seems redundant...
It's odd that you found that the value should go UP in the endgame, while both SF and Komodo found the opposite! I wonder why?
The difference between A and B is in whether the bonus affects only quies decisions (B) or all decisions thruout the search (A), for examply futility.
I don't think 5 centipawns is going to affect futility in any measurable way. As far as the difference, it makes sense to me actually. Where is the side to move more important, in the middlegame or when there are just kings on and a single tempo is often critical? I started with just one, and tuned it, then tried MG/EG and tuned each independently. 5/8 was best, but we are not talking 3-4-5 Elo here. This is very small.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: stand pat or side to move bonus

Post by bob »

lkaufman wrote:
Uri Blass wrote:
lkaufman wrote:
bob wrote:
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?
I've done this for a long time in Crafty. Current values are 5 and 8 for middle-game and endgame. I tested a bunch of different combinations, but those were best at the time. Not a huge gain anyway, but still, every Elo point counts...

I don't particularly see any difference in any of the above. If you add in the bonus, you may well cause a cutoff anyway. If you just check for the cutoff, you might save a little time.

Doing both seems redundant...
It's odd that you found that the value should go UP in the endgame, while both SF and Komodo found the opposite! I wonder why?
The difference between A and B is in whether the bonus affects only quies decisions (B) or all decisions thruout the search (A), for examply futility.
I think that the best bonus should be dependent on the question if the side to move has a piece or a pawn under threat and not only on the stage of the game.

Programs that evaluate the threat in their evaluation function can probably give bigger bonus for the side to move.

If Crafty does not evaluate threats in the evaluation function then it does not seem to me strange to have a smaller bonus in the middle game because in the middle game there are more cases when a piece is under threat.
That sounds like an excellent explanation! However it does not explain why Critter (or Ippo or Ivanhoe) did not find it beneficial to use higher middlegame bonuses, since I believe they all reward attacks in eval.
Don't fall into the trap of thinking you are talking about different programs in the above list. They all have a very narrow "family tree" and it is likely that value was never tuned beyond the one that came first...
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 »

bob wrote:
lkaufman wrote:
Uri Blass wrote:
lkaufman wrote:
bob wrote:
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?
I've done this for a long time in Crafty. Current values are 5 and 8 for middle-game and endgame. I tested a bunch of different combinations, but those were best at the time. Not a huge gain anyway, but still, every Elo point counts...

I don't particularly see any difference in any of the above. If you add in the bonus, you may well cause a cutoff anyway. If you just check for the cutoff, you might save a little time.

Doing both seems redundant...
It's odd that you found that the value should go UP in the endgame, while both SF and Komodo found the opposite! I wonder why?
The difference between A and B is in whether the bonus affects only quies decisions (B) or all decisions thruout the search (A), for examply futility.
I think that the best bonus should be dependent on the question if the side to move has a piece or a pawn under threat and not only on the stage of the game.

Programs that evaluate the threat in their evaluation function can probably give bigger bonus for the side to move.

If Crafty does not evaluate threats in the evaluation function then it does not seem to me strange to have a smaller bonus in the middle game because in the middle game there are more cases when a piece is under threat.
That sounds like an excellent explanation! However it does not explain why Critter (or Ippo or Ivanhoe) did not find it beneficial to use higher middlegame bonuses, since I believe they all reward attacks in eval.
Don't fall into the trap of thinking you are talking about different programs in the above list. They all have a very narrow "family tree" and it is likely that value was never tuned beyond the one that came first...
The puzzle for me is that Rybka 3 used a much higher middlegame bonus than endgame bonus (I know because it was my idea), but Ippo (whose author at least knew everything about Rybka 3) rejected this idea, so presumably they had good reason to do so.
Does Crafty give any tactical bonuses in eval (such as penalties for attacked pieces and/or pawns)? If not then this would explain the difference in how the side-to-move bonuses ended up.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: stand pat or side to move bonus

Post by bob »

lkaufman wrote:
bob wrote:
lkaufman wrote:
Uri Blass wrote:
lkaufman wrote:
bob wrote:
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?
I've done this for a long time in Crafty. Current values are 5 and 8 for middle-game and endgame. I tested a bunch of different combinations, but those were best at the time. Not a huge gain anyway, but still, every Elo point counts...

I don't particularly see any difference in any of the above. If you add in the bonus, you may well cause a cutoff anyway. If you just check for the cutoff, you might save a little time.

Doing both seems redundant...
It's odd that you found that the value should go UP in the endgame, while both SF and Komodo found the opposite! I wonder why?
The difference between A and B is in whether the bonus affects only quies decisions (B) or all decisions thruout the search (A), for examply futility.
I think that the best bonus should be dependent on the question if the side to move has a piece or a pawn under threat and not only on the stage of the game.

Programs that evaluate the threat in their evaluation function can probably give bigger bonus for the side to move.

If Crafty does not evaluate threats in the evaluation function then it does not seem to me strange to have a smaller bonus in the middle game because in the middle game there are more cases when a piece is under threat.
That sounds like an excellent explanation! However it does not explain why Critter (or Ippo or Ivanhoe) did not find it beneficial to use higher middlegame bonuses, since I believe they all reward attacks in eval.
Don't fall into the trap of thinking you are talking about different programs in the above list. They all have a very narrow "family tree" and it is likely that value was never tuned beyond the one that came first...
The puzzle for me is that Rybka 3 used a much higher middlegame bonus than endgame bonus (I know because it was my idea), but Ippo (whose author at least knew everything about Rybka 3) rejected this idea, so presumably they had good reason to do so.
Does Crafty give any tactical bonuses in eval (such as penalties for attacked pieces and/or pawns)? If not then this would explain the difference in how the side-to-move bonuses ended up.
The only tactical things I add bonuses for are for things I can prove correct. Square of the king where a pawn can't be caught, resolving mutual-pawn-races using in check and such. 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" (although I obviously violate some of this since pawn races are not necessarily "static ideas" although one might argue either side of that for years...