Centipawns and Millipawns

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Centipawns and Millipawns

Post by Don »

It does matter. I use 1 pawn = 1000 in my evaluation, and I round to 1/100 of a pawn for the search.

At one point I used 1/1000 in the search too. When I changed over the program got a bit faster, but it also got a bit weaker.

The key thing to understand is that chess programs compare positions better than they evaluate them. Since most of the positions you compare are very similar (most of the pieces are sitting on the same squares) even a tiny difference can distinguish one similar position from another and even do it correctly. Even though neither position may have a very accurate evaluation, your evaluations function is more likely than not to pick the best one of the two given a choice as it will likely have more of something "good" in one of them, or less of something "bad".

rjgibert wrote:I can't imagine what a centipawn means. What is the reason for using such a fine grained evaluation unit? Is there really any benefit? I understand mate-in-N evaluations and maybe what a decipawn means, but that is as far as I can go with my 2234 rating.

The only other thing I can relate to is a judgement call that position X appears to be better than position Y even though I might quantify them as having the same evaluation.

So my question is, do centipawns evaluations really help chess engines and why? What would you lose by using say 1/20th of a pawn as the finest grain for your evaluations as opposed to the finer grained evaluations? It appears to me that chess programmers are doing something akin to measuring something to the nearest hundredths, while having a standard deviation of as much as a quarter of a pawn.

In engineering, 1.234 +/- 0.1 is just silly. Why isn't it just as silly in computer chess?

And then there even are engines that use millipawns. What's that about?
User avatar
Bo Persson
Posts: 243
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: Centipawns and Millipawns

Post by Bo Persson »

rjgibert wrote:
Uri Blass wrote:
rjgibert wrote:I can't imagine what a centipawn means. What is the reason for using such a fine grained evaluation unit? Is there really any benefit? I understand mate-in-N evaluations and maybe what a decipawn means, but that is as far as I can go with my 2234 rating.

The only other thing I can relate to is a judgement call that position X appears to be better than position Y even though I might quantify them as having the same evaluation.

So my question is, do centipawns evaluations really help chess engines and why? What would you lose by using say 1/20th of a pawn as the finest grain for your evaluations as opposed to the finer grained evaluations? It appears to me that chess programmers are doing something akin to measuring something to the nearest hundredths, while having a standard deviation of as much as a quarter of a pawn.

In engineering, 1.234 +/- 0.1 is just silly. Why isn't it just as silly in computer chess?

And then there even are engines that use millipawns. What's that about?
1)I think that most programmers did not really test it.

2)The error in evaluation may be more than 0.1 pawn but the error in the difference between evaluation of different moves is smaller.

I suspect that the program is going to play inferior positional moves if you use 0.1 pawns units

I think that
"position X appears to be better than position Y even though I might quantify them as having the same evaluation." is not something that programs have in their evaluation so they need to have 0.01 units.

Uri
This argument is why I suggested 1/20th of a pawn and perhaps 1/32nd of pawn is easier for a program, but 1/100th of a pawn is stretching this argument pretty thin. There must be some better reason for this.
I believe some of us are decimal guys, who just don't like fractions. We have no idea about how much 7/32 actually is. :-)

Having a pawn be worth either 10, 100, or 1000 units is just obvious and natural.

If the base score is 100, you don't have to use 1 point, but scores of 25, 33, and 50 is very useful.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Centipawns and Millipawns

Post by Sven »

rjgibert wrote:I can't imagine what a centipawn means. What is the reason for using such a fine grained evaluation unit? Is there really any benefit? I understand mate-in-N evaluations and maybe what a decipawn means, but that is as far as I can go with my 2234 rating.

The only other thing I can relate to is a judgement call that position X appears to be better than position Y even though I might quantify them as having the same evaluation.

So my question is, do centipawns evaluations really help chess engines and why? What would you lose by using say 1/20th of a pawn as the finest grain for your evaluations as opposed to the finer grained evaluations? It appears to me that chess programmers are doing something akin to measuring something to the nearest hundredths, while having a standard deviation of as much as a quarter of a pawn.

In engineering, 1.234 +/- 0.1 is just silly. Why isn't it just as silly in computer chess?

And then there even are engines that use millipawns. What's that about?
Based on the current centipawn system, your eval might define some positional properties that are worth 4/100 pawn units each. Now what would you do with a decipawn approach? Would you round them all down to zero? Then you are off by some decipawns when combining these single properties into a total evaluation. Round each up to 1/10 pawn? Off by even more, again. So you would have to decide which of the properties you consider "unimportant" and drop, and which you consider important enough to assign 1/10 pawn unit instead of 4/100.

You may argue that you would never run into this when starting directly with a decipawn system instead of converting from centipawns. But then you'll hit the same questions as above: how much worth are your single eval properties? 1/10 pawn is already quite a lot, and if you don't want to drop some of the properties completely then you'll get many 1/10 pawn values adding up, impacting accuracy.

Engines play better if they are able to tell which position is better, A or B. If they frequently give the answer "A and B are equal" due to lower granularity of evaluation then they might play the wrong move too often. And evaluating A and B as equal, or A as 1/10 pawn better than B, makes a huge difference IMO.

Sven
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: Centipawns and Millipawns

Post by Zach Wegner »

Bo Persson wrote:I believe some of us are decimal guys, who just don't like fractions. We have no idea about how much 7/32 actually is. :-)
.00111

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

Re: Centipawns and Millipawns

Post by bob »

rjgibert wrote:I can't imagine what a centipawn means. What is the reason for using such a fine grained evaluation unit? Is there really any benefit? I understand mate-in-N evaluations and maybe what a decipawn means, but that is as far as I can go with my 2234 rating.

The only other thing I can relate to is a judgement call that position X appears to be better than position Y even though I might quantify them as having the same evaluation.

So my question is, do centipawns evaluations really help chess engines and why? What would you lose by using say 1/20th of a pawn as the finest grain for your evaluations as opposed to the finer grained evaluations? It appears to me that chess programmers are doing something akin to measuring something to the nearest hundredths, while having a standard deviation of as much as a quarter of a pawn.

In engineering, 1.234 +/- 0.1 is just silly. Why isn't it just as silly in computer chess?

And then there even are engines that use millipawns. What's that about?
Having done all three, my take on the issue is this:

(1) decipawns (0.1) is too coarse. Not every positional consideration is worth 0.1 pawns, so you either have to round the score up to 0.1, or else throw it out since it would be zero.

(2) millipawns (0.001) is too fine. I do not believe that my evaluation has any .001 accuracy ideas in it. As you spread the evaluation scores out, your tree search becomes less efficient (for example, compare a program with no positional scoring to one with, with respect to tree size).

(3) centipawns (0.01) is reasonable. One could make the argument that maybe .05 is better (1/20th of a pawn). Or some other number. But my intuition after trying all three during the development of Crafty is that the right value lies in the interval {0.01, 0.1}. Whether it is on one end or the other, or somewhere in the middle, is a point for conjecture. It is too hard to test the idea, although I suppose I could just do a normal eval and then at the end, reduce it to the accuracy needed. But it is not easy to test for smaller than .01 increments since no increments in crafty would be smaller than .01...
rjgibert
Posts: 317
Joined: Mon Jun 26, 2006 9:44 am

Re: Centipawns and Millipawns

Post by rjgibert »

bob wrote:
rjgibert wrote:I can't imagine what a centipawn means. What is the reason for using such a fine grained evaluation unit? Is there really any benefit? I understand mate-in-N evaluations and maybe what a decipawn means, but that is as far as I can go with my 2234 rating.

The only other thing I can relate to is a judgement call that position X appears to be better than position Y even though I might quantify them as having the same evaluation.

So my question is, do centipawns evaluations really help chess engines and why? What would you lose by using say 1/20th of a pawn as the finest grain for your evaluations as opposed to the finer grained evaluations? It appears to me that chess programmers are doing something akin to measuring something to the nearest hundredths, while having a standard deviation of as much as a quarter of a pawn.

In engineering, 1.234 +/- 0.1 is just silly. Why isn't it just as silly in computer chess?

And then there even are engines that use millipawns. What's that about?
Having done all three, my take on the issue is this:

(1) decipawns (0.1) is too coarse. Not every positional consideration is worth 0.1 pawns, so you either have to round the score up to 0.1, or else throw it out since it would be zero.

(2) millipawns (0.001) is too fine. I do not believe that my evaluation has any .001 accuracy ideas in it. As you spread the evaluation scores out, your tree search becomes less efficient (for example, compare a program with no positional scoring to one with, with respect to tree size).

(3) centipawns (0.01) is reasonable. One could make the argument that maybe .05 is better (1/20th of a pawn). Or some other number. But my intuition after trying all three during the development of Crafty is that the right value lies in the interval {0.01, 0.1}. Whether it is on one end or the other, or somewhere in the middle, is a point for conjecture. It is too hard to test the idea, although I suppose I could just do a normal eval and then at the end, reduce it to the accuracy needed. But it is not easy to test for smaller than .01 increments since no increments in crafty would be smaller than .01...
1/10th of a pawn is about what my brain can process, so I suggested 1/20th just as you suggested might be right. So it looks like my intuition may not be far off on this issue. Thanks.
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: Centipawns and Millipawns

Post by BubbaTough »

How much would a queen being able to move to 1 square be worth? My guess is its above 0...and its below 1/10 of a pawn....and its probably below 1/20th of a pawn....hmmmm...perhaps centipawns are a good thing. Of course I use 1/1000 of a pawn scale, but mostly because its really fun.

-Sam
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: Centipawns and Millipawns

Post by Edsel Apostol »

I have tried this idea just recently. I'm still using my old scoring of centipawns but at the end of the eval I use something like:

Code: Select all

return score &= ~(&#40;1<<grain&#41;-1&#41;;
where grain is a number 0 to 4.

Grain with 0 value means no change in the score, 1 will make it round to 2, 2 to 4 and 3 to 8, and 4 to 16.

I only have tried grain values 0, 2, 3. 0 still gives the best result, though my number of games is only 1200 each and the difference in elo between 0 and 2,3 is only 10. I will test with 1 to see if it performs better.

Using eval grain in Stockfish works because it uses 256 as Pawn value and it is too coarse for the search so it scales it by 4, meaning the finest unit for its search is 1/64. I think this is the optimal value.
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: Centipawns and Millipawns

Post by BubbaTough »

Edsel Apostol wrote:I have tried this idea just recently. I'm still using my old scoring of centipawns but at the end of the eval I use something like:

Code: Select all

return score &= ~(&#40;1<<grain&#41;-1&#41;;
where grain is a number 0 to 4.

Grain with 0 value means no change in the score, 1 will make it round to 2, 2 to 4 and 3 to 8, and 4 to 16.

I only have tried grain values 0, 2, 3. 0 still gives the best result, though my number of games is only 1200 each and the difference in elo between 0 and 2,3 is only 10. I will test with 1 to see if it performs better.

Using eval grain in Stockfish works because it uses 256 as Pawn value and it is too coarse for the search so it scales it by 4, meaning the finest unit for its search is 1/64. I think this is the optimal value.
I tried variations of that, and for me...even with a scale of 1/1000...it hurt performance.

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

Re: Centipawns and Millipawns

Post by bob »

rjgibert wrote:
bob wrote:
rjgibert wrote:I can't imagine what a centipawn means. What is the reason for using such a fine grained evaluation unit? Is there really any benefit? I understand mate-in-N evaluations and maybe what a decipawn means, but that is as far as I can go with my 2234 rating.

The only other thing I can relate to is a judgement call that position X appears to be better than position Y even though I might quantify them as having the same evaluation.

So my question is, do centipawns evaluations really help chess engines and why? What would you lose by using say 1/20th of a pawn as the finest grain for your evaluations as opposed to the finer grained evaluations? It appears to me that chess programmers are doing something akin to measuring something to the nearest hundredths, while having a standard deviation of as much as a quarter of a pawn.

In engineering, 1.234 +/- 0.1 is just silly. Why isn't it just as silly in computer chess?

And then there even are engines that use millipawns. What's that about?
Having done all three, my take on the issue is this:

(1) decipawns (0.1) is too coarse. Not every positional consideration is worth 0.1 pawns, so you either have to round the score up to 0.1, or else throw it out since it would be zero.

(2) millipawns (0.001) is too fine. I do not believe that my evaluation has any .001 accuracy ideas in it. As you spread the evaluation scores out, your tree search becomes less efficient (for example, compare a program with no positional scoring to one with, with respect to tree size).

(3) centipawns (0.01) is reasonable. One could make the argument that maybe .05 is better (1/20th of a pawn). Or some other number. But my intuition after trying all three during the development of Crafty is that the right value lies in the interval {0.01, 0.1}. Whether it is on one end or the other, or somewhere in the middle, is a point for conjecture. It is too hard to test the idea, although I suppose I could just do a normal eval and then at the end, reduce it to the accuracy needed. But it is not easy to test for smaller than .01 increments since no increments in crafty would be smaller than .01...
1/10th of a pawn is about what my brain can process, so I suggested 1/20th just as you suggested might be right. So it looks like my intuition may not be far off on this issue. Thanks.
I have a hard time with very small or very large numbers. It is hard to comprehend the idea of a billion somethings. or one-billionth of a something. :)

I might well try your test of rounding to .02, .04, .05, even all the way to .1 just for fun to see what it does... I'll post the numbers. Might be tomorrow before I can do this as Tracy just sent three new king safety versions to test (I hope to get a 23.1 released soon, but new ideas keep slipping in. :) )