## Ab-initio evaluation tuning

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Evert
Posts: 2929
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

### Re: Ab-initio evaluation tuning

The tuner now gives me the following set of evaluation parameters:

Code: Select all

``````VALUEL_P_MG          =   0.74 +/-   0.02 &#91;190&#93;
VALUEL_M_MG          =   3.03 +/-   0.09 &#91;776&#93;
VALUEL_R_MG          =   3.90 +/-   0.21 &#91;998&#93;
VALUEL_Q_MG          =   8.59 +/-   0.41 &#91;2200&#93;
VALUEL_P_EG          =   0.93 +/-   0.02 &#91;239&#93;
VALUEL_N_EG          =   3.04 +/-   0.06 &#91;779&#93;
VALUEL_B_EG          =   3.32 +/-   0.06 &#91;850&#93;
VALUEL_R_EG          =   6.08 +/-   0.11 &#91;1556&#93;
VALUEL_Q_EG          =  11.08 +/-   0.26 &#91;2836&#93;
VALUEQ_BB_MG         =   0.13 +/-   0.03 &#91;33&#93;
VALUEQ_BB_EG         =   0.23 +/-   0.04 &#91;59&#93;
VALUEQ_PASS_MG       =   0.71 +/-   0.18 &#91;183&#93;
VALUEQ_PASS_EG       =   3.11 +/-   0.09 &#91;796&#93;
VALUE_WIN_EG         =   4.44 +/-   0.15 &#91;1136&#93;
MOBILITY_N_MG        =   0.00 +/-   0.00 &#91;1&#93;
MOBILITY_N_EG        =   0.00 +/-   0.00 &#91;0&#93;
MOBILITY_B_MG        =   0.00 +/-   0.00 &#91;0&#93;
MOBILITY_B_EG        =  -0.00 +/-   0.00 &#91;-0&#93;
MOBILITY_R_MG        =  -0.00 +/-   0.00 &#91;-1&#93;
MOBILITY_R_EG        =   0.00 +/-   0.00 &#91;1&#93;
MOBILITY_Q_MG        =  -0.00 +/-   0.00 &#91;-0&#93;
MOBILITY_Q_EG        =  -0.00 +/-   0.01 &#91;-1&#93;
PST_CENTRE_P_MG      =   0.01 +/-   0.00 &#91;3&#93;
PST_CENTRE_N_MG      =   0.05 +/-   0.00 &#91;12&#93;
PST_CENTRE_B_MG      =   0.05 +/-   0.00 &#91;12&#93;
PST_CENTRE_Q_MG      =  -0.00 +/-   0.01 &#91;-1&#93;
PST_CENTRE_K_EG      =   0.04 +/-   0.00 &#91;11&#93;
PST_CENTRE_N_EG      =   0.08 +/-   0.01 &#91;20&#93;
PST_CENTRE_B_EG      =   0.05 +/-   0.01 &#91;12&#93;
PST_CENTRE_Q_EG      =   0.06 +/-   0.01 &#91;16&#93;
``````
The Rook is still low, but not as low as it was. I combine Knight and Bishop MG values into a single "minor" value (the tuner sets them equal anyway when I don't).
The PST_* terms are just the weight for the centre in the PST (currently the only component in the tables) and are multiplied by the following table to get the piece-specific PST:

Code: Select all

``````  -7  -4  -2  -1  -1  -2  -4  -7
-4  -1   1   2   2   1  -1  -4
-2   1   3   4   4   3   1  -2
-1   2   4   5   5   4   2  -1
-1   2   4   5   5   4   2  -1
-2   1   3   4   4   3   1  -2
-4  -1   1   2   2   1  -1  -4
-7  -4  -2  -1  -1  -2  -4  -7
``````
What I find really surprising, however, is that the tuner always tunes the mobility weights down to 0. I thought this was due to the weights starting out at 0 and the tuner being stuck in the wrong minimum, but even if I start them out at some larger value, I end up back with the above. The mobility term is weight*(N - (<N>-1)), where N is the number of moves and <N> is the median number of moves for that piece type on an empty board. This is decreased by 1 to crudely take into account that the board is normally not empty (as such, it isn't a particularly good estimate). This gives the following progression for each piece type:

Code: Select all

``````Knight    &#58;   2   5   4   8 &#123;  -3  -2  -1   0   1   2   3   4   5&#125;
Bishop    &#58;   7   9   7  13 &#123;  -6  -5  -4  -3  -2  -1   0   1   2   3   4   5   6   7&#125;
Rook      &#58;  14  14  14  14 &#123;  -7  -6  -5  -4  -3  -2  -1   0   1   2   3   4   5   6   7&#125;
Queen     &#58;  21  23  21  27 &#123; -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10  -9  -8  -7  -6  -5  -4  -3  -2  -1   0   1   2   3   4   5   6   7&#125;
``````
(The four numbers are the minimum, medium, median and maximum number of moves on an empty board). As I said though, the actual mobility weights are set to 0 by the tuner.

Has anyone successfully managed to tune mobility weights using test positions? The only explanation I can think of is that it is the interaction with the search that makes mobility a valuable term, but I find that highly surprising. Thoughts?

Evert
Posts: 2929
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

### Re: Ab-initio evaluation tuning

Typical. I post about the issue, and I figure out what's up shortly afterwards. Turns out I forgot to subtract the White and Black contributions to the final score (I was adding them instead). With that fixed,

Code: Select all

``````MOBILITY_N_MG        =   0.02 +/-   0.01 &#91;6&#93;
MOBILITY_N_EG        =  -0.00 +/-   0.01 &#91;-1&#93;
MOBILITY_B_MG        =   0.07 +/-   0.01 &#91;18&#93;
MOBILITY_B_EG        =   0.07 +/-   0.01 &#91;18&#93;
MOBILITY_R_MG        =   0.06 +/-   0.00 &#91;15&#93;
MOBILITY_R_EG        =   0.02 +/-   0.00 &#91;6&#93;
MOBILITY_Q_MG        =   0.02 +/-   0.00 &#91;4&#93;
MOBILITY_Q_EG        =   0.07 +/-   0.01 &#91;18&#93;
PST_CENTRE_P_MG      =   0.01 +/-   0.00 &#91;2&#93;
PST_CENTRE_N_MG      =   0.03 +/-   0.01 &#91;8&#93;
PST_CENTRE_B_MG      =  -0.00 +/-   0.01 &#91;-1&#93;
PST_CENTRE_Q_MG      =  -0.03 +/-   0.01 &#91;-7&#93;
PST_CENTRE_K_EG      =   0.05 +/-   0.00 &#91;12&#93;
PST_CENTRE_N_EG      =   0.09 +/-   0.01 &#91;23&#93;
PST_CENTRE_B_EG      =   0.01 +/-   0.01 &#91;1&#93;
PST_CENTRE_Q_EG      =   0.04 +/-   0.01 &#91;9&#93;
``````
So as not to make this completely useless, some further details on how I do the tuning run.
It should be fairly obvious, but it helps if the test positions used for tuning actually contain the features you're trying to tune, which is apparent in the condition number of the Jacobian. For piece values, this means unbalanced material. For mobility, this is of course not an issue (you can always tune mobility). As a bonus, things run faster.

When tuning, I split the positions in half (at random) and first tune using half the positions before doing it again on the larger set. My main motivation for doing this is speed (it's much faster to run on a smaller number of test positions, and if the solution is reasonable you converge more quickly on the final set as well), but it has the added benefit of acting as a sanity-check: you expect the parameters to not change very much between the two run.
I tried finer divisions, but they don't offer any speed advantage.