Rounding

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Rounding

Post by lkaufman »

Some top programs round off the score to achieve greater speed at some cost in quality, namely Rybka, SF, and Komodo. Others do not, namely (I believe) Ivanhoe, Critter, and (probably) Houdini.
The question is, once you have decided on the scoring resolution you actually want the search to use, is it better to have the eval also use that resolution or should it use finer resolution and round off? In other words, which is more logical:
1.Rybka - eval terms in millipawns, final score for search rounded to centipawns.
or
2. Ivanhoe - eval terms in centipawns, no rounding.

Any opinions?
mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: Rounding

Post by mjlef »

I suppose this could be tested. Using finer granularity in the eval then rounding does allow many very small eval changes to add up and effect the final rounded score. If I was starting fom scratch I would probably use 1 pawn=1000. Sometimes adding 1/100th is just too much with things like mobility. Allows better tuning.

Some programs even have gone to something like 1/32 a pawn in the final rounding...that might be too far.
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: Rounding

Post by rbarreira »

Unless that final division by 10 (to convert to centi-pawns) is having any effect on NPS, logically it would seem that using millipawns and then rounding can't hurt. But it probably requires a very significant amount of tuning to make millipawns matter...
User avatar
marcelk
Posts: 348
Joined: Sat Feb 27, 2010 12:21 am

Re: Rounding

Post by marcelk »

lkaufman wrote:Some top programs round off the score to achieve greater speed at some cost in quality, namely Rybka, SF, and Komodo. Others do not, namely (I believe) Ivanhoe, Critter, and (probably) Houdini.
The question is, once you have decided on the scoring resolution you actually want the search to use, is it better to have the eval also use that resolution or should it use finer resolution and round off? In other words, which is more logical:
1.Rybka - eval terms in millipawns, final score for search rounded to centipawns.
or
2. Ivanhoe - eval terms in centipawns, no rounding.

Any opinions?
This is simple to test, so opinions are not needed.
That said, my opinion is that engines do it because other engines do it.

Marcel

PS: There is a 3rd alternative that does something similar: no rounding but offsetting the scout value by some amount.
lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Re: Rounding

Post by lkaufman »

marcelk wrote:
lkaufman wrote:Some top programs round off the score to achieve greater speed at some cost in quality, namely Rybka, SF, and Komodo. Others do not, namely (I believe) Ivanhoe, Critter, and (probably) Houdini.
The question is, once you have decided on the scoring resolution you actually want the search to use, is it better to have the eval also use that resolution or should it use finer resolution and round off? In other words, which is more logical:
1.Rybka - eval terms in millipawns, final score for search rounded to centipawns.
or
2. Ivanhoe - eval terms in centipawns, no rounding.

Any opinions?
This is simple to test, so opinions are not needed.
That said, my opinion is that engines do it because other engines do it.

Marcel

PS: There is a 3rd alternative that does something similar: no rounding but offsetting the scout value by some amount.
It is not at all simple to test. You have to write two distinct evaluation functions, one using millipawns (to be rounded to centipawns), the other using centipawns directly. That's a huge project. Furthermore the results would depend on the quality of the centipawn eval.

Saying that engines do it because other do doesn't help, because about half (of the top ones) round and the other half don't.

I'm not sure about the consequences of your third alternative.
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Rounding

Post by rvida »

lkaufman wrote:Others do not, namely (I believe) Ivanhoe, Critter, and (probably) Houdini.
Houdini uses 1/3200 pawn unit in eval, 1/200 in search.
lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Re: Rounding

Post by lkaufman »

rvida wrote:
lkaufman wrote:Others do not, namely (I believe) Ivanhoe, Critter, and (probably) Houdini.
Houdini uses 1/3200 pawn unit in eval, 1/200 in search.
Thanks, so that is presumably one of the changes between Houdini 1.0 and 1.5, since 1.0 was basically Ivanhoe. Since we all know that this was a big jump for Houdini, this strongly suggests that rounding is a good idea. Of course it's possible that this was one bad idea among other good ones, but this seems unlikely.
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Rounding

Post by rvida »

lkaufman wrote:
rvida wrote:
lkaufman wrote:Others do not, namely (I believe) Ivanhoe, Critter, and (probably) Houdini.
Houdini uses 1/3200 pawn unit in eval, 1/200 in search.
Thanks, so that is presumably one of the changes between Houdini 1.0 and 1.5, since 1.0 was basically Ivanhoe. Since we all know that this was a big jump for Houdini, this strongly suggests that rounding is a good idea. Of course it's possible that this was one bad idea among other good ones, but this seems unlikely.
No, that change was between 1.5 and 2.0.
Houdini 1.5 used 1/200 pawn unit in both eval and search.
User avatar
marcelk
Posts: 348
Joined: Sat Feb 27, 2010 12:21 am

Re: Rounding

Post by marcelk »

lkaufman wrote: It is not at all simple to test. You have to write two distinct evaluation functions, one using millipawns (to be rounded to centipawns), the other using centipawns directly. That's a huge project.
Not sure what you mean there. The second is simple in case you have the first already. Rounding just adds discretization errors to eval (=bad) in return for fewer nodes spent on meaningless researches (=good).
lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Re: Rounding

Post by lkaufman »

marcelk wrote:
lkaufman wrote: It is not at all simple to test. You have to write two distinct evaluation functions, one using millipawns (to be rounded to centipawns), the other using centipawns directly. That's a huge project.
Not sure what you mean there. The second is simple in case you have the first already. Rounding just adds discretization errors to eval (=bad) in return for fewer nodes spent on meaningless researches (=good).
You are talking about rounding a given eval function. My question is whether having more accurate, refined eval does any good if you round it off to the same ultimate resolution (before search) anyway. Both Rybka and Ippolit use 1 cp resolution for search, but Ippolit also uses 1 cp for eval while Rybka3 used 1 mp for eval. The question is, does the more precise Rybka eval serve any purpose if it is rounded to 1 cp anyway? My opinion is that it does, but since both Critter and Ivanhoe don't use more refined eval than the search uses, their authors presumably hold a different opinion. If so I would like to know why they do it the way that they do. I guess there is no one here who can answer for Ivanhoe though.