Questions for BB about Rybka PST = Fruit PST

Code, algorithms, languages, construction...
Post Reply
User avatar
Rebel
Posts: 515
Joined: Wed Jun 09, 2010 7:45 pm
Real Name: Ed Schroder

Questions for BB about Rybka PST = Fruit PST

Post by Rebel » Thu Aug 04, 2011 11:35 am

BB,

Is it possible for you to list the contents of all PST's in both Fruit & Rybka ?

You have done so in your document for the white knight (see below), can I have the values for the white PAWN, BISHOP, ROOK, QUEEN, KING as well ?

Code: Select all

-135 -25 -15 -10 -10 -15 -25 -135           -5618 -1724 -1030 -683 -683 -1030 -1724 -5618
-20 -10 0 5 5 0 -10 -20                     -1366 -672 22 369 369 22 -672 -1366
-5 5 15 20 20 15 5 -5                       -314 380 1074 1421 1421 1074 380 -314
-5 5 15 20 20 15 5 -5                       -325 369 1063 1410 1410 1063 369 -325
-10 0 10 15 15 10 0 -10                     -683 11 705 1052 1052 705 11 -683
-20 -10 0 5 5 0 -10 -20                     -1388 -694 0 347 347 0 -694 -1388
-35 -25 -15 -5 -5 -15 -25 -35               -2440 -1746 -1052 -705 -705 -1052 -1746 -2440
-50 -40 -30 -25 -25 -30 -40 -50             -3492 -2798 -2104 -1757 -1757 -2104 -2798 -3492
Thanks so much.

User avatar
Chris Whittington
Posts: 437
Joined: Wed Jun 09, 2010 6:25 pm

Re: Questions for BB about Rybka PST = Fruit PST

Post by Chris Whittington » Thu Aug 04, 2011 1:58 pm

the complete list of (I believe) ten matching PST tables would be even better, there are 10 and not 6 because some of the tables are split into two, one for opening and one for endgame phases

also a thank you in advance

Rebel wrote:BB,

Is it possible for you to list the contents of all PST's in both Fruit & Rybka ?

You have done so in your document for the white knight (see below), can I have the values for the white PAWN, BISHOP, ROOK, QUEEN, KING as well ?

Code: Select all

-135 -25 -15 -10 -10 -15 -25 -135           -5618 -1724 -1030 -683 -683 -1030 -1724 -5618
-20 -10 0 5 5 0 -10 -20                     -1366 -672 22 369 369 22 -672 -1366
-5 5 15 20 20 15 5 -5                       -314 380 1074 1421 1421 1074 380 -314
-5 5 15 20 20 15 5 -5                       -325 369 1063 1410 1410 1063 369 -325
-10 0 10 15 15 10 0 -10                     -683 11 705 1052 1052 705 11 -683
-20 -10 0 5 5 0 -10 -20                     -1388 -694 0 347 347 0 -694 -1388
-35 -25 -15 -5 -5 -15 -25 -35               -2440 -1746 -1052 -705 -705 -1052 -1746 -2440
-50 -40 -30 -25 -25 -30 -40 -50             -3492 -2798 -2104 -1757 -1757 -2104 -2798 -3492
Thanks so much.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: Questions for BB about Rybka PST = Fruit PST

Post by BB+ » Fri Aug 05, 2011 11:25 am

The relevant information can be determined the values in RYBKA_FRUIT; in my opinion, the schematics are more important than the actual end values. Indeed, I'd say that ignoring the "schematic" evidence is throwing away much of the value of this exercise. [In this vein, computer programs are considered "literary works" from the standpoint of copyright, and thus any "functional equivalence" of outputs is not the overriding consideration].

Which leaves me to figure out how to format the answer to your question in a nice way for this forum, but I'll try to do so, mostly copying the material from the above source. As noted in the above source, these appear in the Rybka 1.0 Beta 64-bit executable loaded at 0x64b4f0, corresponding to 0x249cf0 in the executable (search for 0xe1 0xfd 0x23 0x01 0x4b 0xff 0x61 0x00, noting that each is a 16-bit entry, intertwining opening/endgame -- just as with Fruit, but also just to annoy my attempts to format it here :mrgreen:).

WhiteKnightOpening
For WhiteKnightOpening, we have the common schematic:

Code: Select all

  -4x-4x+ y-z  -4x-2x+ y  -4x+0+ y  -4x+x+ y
  -2x-4x+2y    -2x-2x+ y  -2x+0+2y  -2x+x+2y
    0-4x+3y      0-2x+3y    0+0+3y    0+x+3y
    x-4x+2y      x-2x+2y    x+0+2y    x+x+2y
    x-4x+ y      x-2x+ y    x+0+ y    x+x+ y
    0-4x+ 0      0-2x+ 0    0+0+ 0    0+x+ 0
  -2x-4x- y    -2x-2x- y  -2x+0- y  -2x+x- y
  -4x-4x-2y    -4x-2x-2y  -4x+0-2y  -4x+x-2y
where Fruit 2.1 has (x,y,z)=(5,5,100) and Rybka 1.0 Beta has (347,358,2000)

This leads to final values of (and more formatting...)

Code: Select all

  -135   -25   -15   -10      -5618  -1724  -1030   -683
   -20   -10     0     5      -1366   -672     22    369
    -5     5    15    20       -314    380   1074   1421
    -5     5    15    20       -325    369   1063   1410
   -10     0    10    15       -683     11    705   1052
   -20   -10     0     5      -1388   -694      0    347
   -35   -25   -15   -10      -2440  -1746  -1052   -705
   -50   -40   -30   -25      -3492  -2798  -2104  -1757
WhiteKnightEndgame
This is essentially the same schematic as the knights in the opening, except that the rank bonus (y-variable of before) is absent, as is the a8/h8 penalty. Fruit has x=5, and Rybka has x=56.

Code: Select all

  -4x-4x  -4x-2x  -4x+0  -4x+x
  -2x-4x  -2x-2x  -2x+0  -2x+x
    0-4x    0-2x    0+0    0+x
    x-4x    x-2x    x+0    x+x
    x-4x    x-2x    x+0    x+x
    0-4x    0-2x    0+0    0+x
  -2x-4x  -2x-2x  -2x+0  -2x+x
  -4x-4x  -4x-2x  -4x+0  -4x+x
Via plugging in the above values, one obtains the final formatting:

Code: Select all

  -40  -30  -20  -15      -448  -336  -224  -168
  -30  -20  -10   -5      -336  -224  -112   -56
  -20  -10    0    5      -224  -112     0    56
  -15   -5    5   10      -168   -56    56   112
  -15   -5    5   10      -168   -56    56   112
  -20  -10    0    5      -224  -112     0    56
  -30  -20  -10   -5      -336  -224  -112   -56
  -40  -30  -20  -15      -448  -336  -224  -168
WhitePawnOpening
Here is an attempt to get a common schematic. For each rank we have

Code: Select all

-3x -x 0 x
and for central squares, additional bonuses are added.
For Fruit we have x=5 and Rybka has x=181.
Fruit adds 10 to d3/d5/e3/e5
and 20 to d4/e4. Rybka adds 74 to d5/e5.

Via plugging in the above values, one obtains the final formatting:

Code: Select all

  -15   -5   0    5        -543  -181    0  181
  -15   -5   0    5        -543  -181    0  181
  -15   -5   0    5        -543  -181    0  181
  -15   -5   0   15        -543  -181    0  181
  -15   -5   0   25        -543  -181    0  255
  -15   -5   0   15        -543  -181    0  181
  -15   -5   0    5        -543  -181    0  181
  -15   -5   0    5        -543  -181    0  181
WhitePawnEndgame
Fruit has zero values everywhere here. Rybka uses the same array as above, with x=-97.

Code: Select all

-3x -x 0 x
Via plugging in the above values, one obtains the final formatting:

Code: Select all

0  0  0  0       291  97   0  -97
WhiteBishopOpening
Here is the common schematic, involving centralisation, back rank, and diagonal bonuses:

Code: Select all

  -3x-3x+ y    -3x-x      -3x+0     -3x+x
   -x-3x        -x-x+y     -x+0      -x+x
    0-3x         0-x        0+0+y     0+x
    x-3x         x-x        x+0       x+x+y
    x-3x         x-x        x+0       x+x+y
    0-3x         0-x        0+0+y     0+x
   -x-3x        -x-x+y     -x+0      -x+x
  -3x-3x+ y-z  -3x-x  -z   -3x+0 -z  -3x+x  -z
Fruit has (x,y,z)=(2,4,10) and Rybka has (x,y,z)=(147,378,251)

Via plugging in the above values, one obtains the final formatting:

Code: Select all

   -8   -8   -6   -4      -504  -588  -441  -294
   -8    0   -2    0      -588    84  -147     0
   -6   -2    4    2      -441  -147   378   147
   -4    0    2    8      -294     0   147   672
   -4    0    2    8      -294     0   147   672
   -6   -2    4    2      -441  -147   378   147
   -8    0   -2    0      -588    84  -147     0
  -18  -18  -16  -14      -755  -839  -692  -545
WhiteBishopEnding
Here is the common schematic, involving only centralisation.

Code: Select all

  -3x-3x  -3x-x  -3x+0  -3x+x
   -x-3x   -x-x   -x+0   -x+x
    0-3x    0-x    0+0    0+x
    x-3x    x-x    x+0    x+x
    x-3x    x-x    x+0    x+x
    0-3x    0-x    0+0    0+x
   -x-3x   -x-x   -x+0   -x+x
  -3x-3x  -3x-x  -3x+0  -3x+x
Fruit has x=3 and Rybka has x=49 to give

Code: Select all

  -18  -12   -9   -6      -294  -196  -147  -98
  -12   -6   -3    0      -196   -98   -49    0
   -9   -3    0    3      -147   -49     0   49
   -6    0    3    6       -98     0    49   98
   -6    0    3    6       -98     0    49   98
   -9   -3    0    3      -147   -49     0   49
  -12   -6   -3    0      -196   -98   -49    0
  -18  -12   -9   -6      -294  -196  -147  -98
WhiteRooksOpening
Here is the common file-schematic; both ignore ranks. Furthermore, both have no endgame PST (all values are 0).

Code: Select all

-2x -x 0 x
Fruit has x=3 and Rybka has x=104.

Via plugging in the above values, one obtains the final formatting:

Code: Select all

-6 -3   0  3      -208 -104    0  104
WhiteQueenOpening
Here is the common schematic, involving centralisation, back rank.

Code: Select all

  -3x-3x    -3x-x    -3x+0    -3x+x
   -x-3x     -x-x     -x+0     -x+x
    0-3x      0-x      0+0      0+x
    x-3x      x-x      x+0      x+x
    x-3x      x-x      x+0      x+x
    0-3x      0-x      0+0      0+x
   -x-3x     -x-x     -x+0     -x+x
  -3x-3x-z  -3x-x-z  -3x+0-z  -3x+x-z
Fruit has (x,z)=(0,5) [the zero value is directly in the code], while Rybka has (x,z)=(98,201). The final values are

Code: Select all

    0   0   0   0      -588  -392  -294  -196
    0   0   0   0      -392  -196   -98     0
    0   0   0   0      -294   -98     0    98
    0   0   0   0      -196     0    98   196
    0   0   0   0      -196     0    98   196
    0   0   0   0      -294   -98     0    98
    0   0   0   0      -392  -196   -98     0
   -5  -5  -5  -5      -789  -593  -495  -397
WhiteQueenEnding
Here is the common schematic, involving only centralisation.

Code: Select all

  -3x-3x  -3x-x  -3x+0  -3x+x
   -x-3x   -x-x   -x+0   -x+x
    0-3x    0-x    0+0    0+x
    x-3x    x-x    x+0    x+x
    x-3x    x-x    x+0    x+x
    0-3x    0-x    0+0    0+x
   -x-3x   -x-x   -x+0   -x+x
  -3x-3x  -3x-x  -3x+0  -3x+x
Fruit has x=4 and Rybka has x=108 to give

Code: Select all

  -24  -16  -12   -8       -648  -432  -324  -216
  -16   -8   -4    0       -432  -216  -108     0
  -12   -4    0    4       -324  -108     0   108
   -8    0    4    8       -216     0   108   216
   -8    0    4    8       -216     0   108   216
  -12   -4    0    4       -324  -108     0   108
  -16   -8   -4    0       -432  -216  -108     0
  -24  -16  -12   -8       -648  -432  -324  -216
WhiteKingOpening
Here is an attempt at a common heuristic, where Rybka lacks any rank adjustment (y=0).

Code: Select all

  3x-7y  4x-7y  2x-7y  0-7y
  3x-6y  4x-6y  2x-6y  0-6y
  3x-5y  4x-5y  2x-5y  0-5y
  3x-4y  4x-4y  2x-4y  0-4y
  3x-3y  4x-3y  2x-3y  0-3y
  3x-2y  4x-2y  2x-2y  0-2y
  3x+0   4x+0   2x+0   0+0
  3x+y   4x+y   2x+y   0+y
Fruit has (x,y)=(10,10) and Rybka has (x,y)=(469,0) to give

Code: Select all

  -40  -30  -50  -70         1407 1876  938    0
  -30  -20  -40  -60         1407 1876  938    0
  -20  -10  -30  -50         1407 1876  938    0
  -10    0  -20  -40         1407 1876  938    0
    0   10  -10  -30         1407 1876  938    0
   10   20    0  -20         1407 1876  938    0
   30   40   20    0         1407 1876  938    0
   40   50   30   10         1407 1876  938    0
WhiteKingEnding
Here is the common schematic, involving only centralisation.

Code: Select all

  -3x-3x  -3x-x  -3x+0  -3x+x
   -x-3x   -x-x   -x+0   -x+x
    0-3x    0-x    0+0    0+x
    x-3x    x-x    x+0    x+x
    x-3x    x-x    x+0    x+x
    0-3x    0-x    0+0    0+x
   -x-3x   -x-x   -x+0   -x+x
  -3x-3x  -3x-x  -3x+0  -3x+x
Fruit has x=12 and Rybka has x=401 to give

Code: Select all

  -72  -48  -36  -24        -2406  -1604  -1203  -802
  -48  -24  -12    0        -1604   -802   -401     0
  -36  -12    0   12        -1203   -401      0   401
  -24    0   12   24         -802      0    401   802
  -24    0   12   24         -802      0    401   802
  -36  -12    0   12        -1203   -401      0   401
  -48  -24  -12    0        -1604   -802   -401     0
  -72  -48  -36  -24        -2406  -1604  -1203  -802

mjlef
Posts: 43
Joined: Thu Jun 10, 2010 6:51 pm
Real Name: Mark Lefler

Re: Questions for BB about Rybka PST = Fruit PST

Post by mjlef » Fri Aug 05, 2011 7:50 pm

For those comparing values, Fruit 2.1 uses 100 for a pawn (well this varies by stage but is an average value). Rybka 1. used 3399 for a pawn value. SO you can divide the Rybka values by 33.99 for a rough comparison in centipawns.

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: Questions for BB about Rybka PST = Fruit PST

Post by hyatt » Fri Aug 05, 2011 10:08 pm

mjlef wrote:For those comparing values, Fruit 2.1 uses 100 for a pawn (well this varies by stage but is an average value). Rybka 1. used 3399 for a pawn value. SO you can divide the Rybka values by 33.99 for a rough comparison in centipawns.
Here's a puzzle for you, just for fun. You probably saw my "multiplier" post where I just computed a constant multiplier to be used in the fruit PST calculations to produce Rybka PST values. A different constant (69.4 for example) for each "piece" of the initialization since there are 4 steps in the knights, for example. What would be a reasonable explanation of using 69.4 in one of the knight pst calculations, and then 71.6 (I am not certain I remember the constant correctly as I also did it for bishops). Obviously Vas would not use a 69.4 floating point number, so it has to be some sort of multiply/divide. 347 * v / 5 would do the trick. But 347 and 5 don't seem to strike a chord for me mentally. What is his scaling factor and why? 1x would make sense. Even 2x if he though fruit's numbers were too small (which they likely are). But 2.1 x and such??? There must be some rational explanation, it just doesn't jump out at me after looking at all the numbers the last few days in the discussions (if you can call 'em that) on the Rybka forum...

I dislike "magic numbers" that one pulls out of thin air. I believe there must be some logic behind them.

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: Questions for BB about Rybka PST = Fruit PST

Post by hyatt » Fri Aug 05, 2011 10:11 pm

More thinking. 3399 or 33.99 as the scale factor between fruit pawn value and rybka pawn value. Double that would be 67.98. I wonder if it was a rounding mechanism he used. Something like R = (F * 67.96 + 0.5) or something similar? Will have to investigate that further...

wgarvin
Posts: 47
Joined: Thu Jul 01, 2010 3:51 pm
Real Name: Wylie Garvin

Re: Questions for BB about Rybka PST = Fruit PST

Post by wgarvin » Fri Aug 05, 2011 11:04 pm

bob wrote: I dislike "magic numbers" that one pulls out of thin air. I believe there must be some logic behind them.
One possibility is that the 3399 was chosen to hide the origin of the table data from casual scrutiny.

I really hope that wasn't the reason...

Its too bad he didn't join the panel, we could have asked him that question (among others).

zwegner
Posts: 57
Joined: Thu Jun 10, 2010 5:38 am

Re: Questions for BB about Rybka PST = Fruit PST

Post by zwegner » Sat Aug 06, 2011 12:09 am

mjlef wrote:For those comparing values, Fruit 2.1 uses 100 for a pawn (well this varies by stage but is an average value). Rybka 1. used 3399 for a pawn value. SO you can divide the Rybka values by 33.99 for a rough comparison in centipawns.
It's a bit fuzzy, but I claim that Rybka 1's pawn value was 3200. Might as well copy from my still-incomplete rewrite of my report:

Code: Select all

2.8.1. Base evaluation unit in Rybka

There are actually three different units used throughout Rybka's evaluation:

    1/100ths of a pawn. This is the value returned by the evaluation after normalizing and used throughout the search. This is likely so that the search uses the units specified in the UCI protocol, but having decreased granularity also increases search efficiency.
    1/3399ths of a pawn. This is the value used for material (at the beginning of the evaluation, Rybka scales the material sum, in terms of 1-3-3-5-10 piece values, by 3399 to get the base material value.
    1/3200ths of a pawn. At the end of the evaluation, the value after scaling by the phase table is divided by 256*32, as discussed in the phase section. The sum of the entries in the phase table is roughly 256. Similarly, when using lazy eval, it takes the material difference multiplied by 3399, adds the material table offset, and divides by 32. The value for KnightTrapped in Rybka's PSTs is 3200, while Fruit's is 100 (one pawn in Fruit's evaluation units, centipawns). Finally, the value for UnstoppablePasser is 800 in Fruit and is 25600 (800*32) in Rybka. 

Based on this evidence, I believe that 3200 is the base value, and that the value 3399 is a value obtained through tuning, hence the "unnatural" value.

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: Questions for BB about Rybka PST = Fruit PST

Post by hyatt » Sat Aug 06, 2011 3:17 am

Do you think, then, that the base factor would be 64 (2x the fruit numbers) but that the PST values were inflated a bit (or deflated in places) to sort of "correct" that 3399 back toward 3200? There are many different ideas here, such as Stockfish that has the material + positional value stuck in the PST, so that the score gets updated with material and PST value with one operation. Others (Crafty as an example) keep 'em separate and simple.

The constants are so strange. And then there is the issue that if you use a FP number for a multiplier, and then store the final result in an integer variable, FIST rounds unless one intentionally modifies the control word to force truncation. A compiler could also use the truncate version of the FP to integer instructions. And I have no idea what the C standard demands (truncation or rounding, or most likely "up to the implementation."

I think the answer to the multiplier might reveal something significant, somehow. I don't quite get the p=3200 (or 3399) if scores get normalized to 1/100ths. That seems outright bizarre thinking to me...

This is one of those "brain twister" puzzles that will worry me until a solution pops into my head... I hope it is soon as I am tired of thinking about Rybka, period...

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: Questions for BB about Rybka PST = Fruit PST

Post by BB+ » Sat Aug 06, 2011 6:12 am

Rybka 2.2n2 (Dec 2006) uses a scale of 3717 instead, which seems to slightly pre-date Larry's involvement (who seems to have reduced it to millipawns for most purposes in R3, though many things are really centipawns with an extra zero).

One random explanation might be that odd numbers were preferred (for whatever reason), and 3400 was one or two "increments" [from tuning?] above 3200, and then there's a 50% chance of 3399 versus 3401. :) Not even this level of "reasoning" can work for 3717, so that indeed may be simply tuning (as well could be for all the "scaling" factors like 69.4).

Incidentally, the RybkaEvalCompare PDF between Rybka 1.0 Beta and Rybka 2.3.2a has tables of PST for each.

Post Reply