About pawn hash tables

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Uri Blass
Posts: 10280
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

About pawn hash tables

Post by Uri Blass »

I thought to find how much speed improvement I can get by pawn hash tables for part of the evaluation that depedenent only on pawn structure but I find that it is not so simple.

The problem is that I have opening evaluation and endgame evaluation
and I calculate average of them for every pawn based on the stage of the game.

I do not like to hash the stage of the game and without it I cannot do things only faster and it seems that I must do things also different.

suppose I have opening evaluation for pawn A4 10 and endgame evaluation for pawn A4 15 and average based on the stage of the game is 11.4

suppose the same is also for pawn B4 and pawn C4.

today the total evaluation that I have will be 11+11+11=33

If I calculate opening evaluation and endgame evaluation for every pawn
then I am going to have opening evaluation of 30 and endgame evaluation of 45 when the average is 34.2 that is calculated as 34.

You can claim that if I do it in this way my evaluation is more correct but I am afraid of bugs that may make the program weaker so I will probably first only write the new evaluation and check the difference between the new evaluation and the old evaluation in every node in order to find that the maximal value is small.

Only if the maximal value is small enough I will continue and try to implement pawn hash.

Uri
mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: About pawn hash tables

Post by mjlef »

In NOW, I also use both opening and endgame evaluations, but I do not interpolate for each individual feature. That would be a hundred or so multiplcations and divisions depending on the number of features measurd. I just sum all opening and endgame scores in two different variables and store them in the pawn hash. At the end fo the eval I do one weighted sum (of the pawn eval, king safety eval, mobility evals, etc). Faster and more accurate since it does account for fractional effects better.
Aleks Peshkov
Posts: 892
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia

Re: About pawn hash tables

Post by Aleks Peshkov »

If your pawn evaluation depends on material, add material counter to pawn structure hash-key.
Uri Blass
Posts: 10280
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: About pawn hash tables

Post by Uri Blass »

Aleks Peshkov wrote:If your pawn evaluation depends on material, add material counter to pawn structure hash-key.
No
I thought about it but
I see no reason to do it.

It is better to have more accurate evaluation and simply to store opening evaluation and endgame evaluation that is not dependent on material.

If I add too much information in the pawn hash it may not be effective because if I get different position with different material I will not be able to use the data that I already calculated.

Uri
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: About pawn hash tables

Post by hgm »

Why don't you want to hash the game stage? Is it a continuous variable?

My Pawn evaluation is not so time consuming that it could benifit from hashing. (Unless I had a really small Pawn hash table, that would be always in cache.) And as I am refining my Pawn evaluation I am leaning to more and more interaction terms with pieces. E.g. a certain Pawn structure can be good with a Bishop of one color, and bad with the opposite one, or good for Knights and bad for Bishops, etc. Backward Pawn penalties on half-open lines depend on the presence of Rooks with the opponent, passer bonuses (and even the value of Pawns in general) depend on having a numeric piece majority/minority...

To make use of hashing I would have to store not one value for the Pawn structure, but just flag a number of conditions that can be multiplied with weights depending on the piece composition. E.g. the number of passers, the number of backward Pawns.
Uri Blass
Posts: 10280
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: About pawn hash tables

Post by Uri Blass »

hgm wrote:Why don't you want to hash the game stage? Is it a continuous variable?

My Pawn evaluation is not so time consuming that it could benifit from hashing. (Unless I had a really small Pawn hash table, that would be always in cache.) And as I am refining my Pawn evaluation I am leaning to more and more interaction terms with pieces. E.g. a certain Pawn structure can be good with a Bishop of one color, and bad with the opposite one, or good for Knights and bad for Bishops, etc. Backward Pawn penalties on half-open lines depend on the presence of Rooks with the opponent, passer bonuses (and even the value of Pawns in general) depend on having a numeric piece majority/minority...

To make use of hashing I would have to store not one value for the Pawn structure, but just flag a number of conditions that can be multiplied with weights depending on the piece composition. E.g. the number of passers, the number of backward Pawns.
I practically have 2 parts of my pawn evaluation.
In one part I get 2 scores that are dependent only on the pawn structure
In another part the score is dependent on other factors.

I want to hash only the evaluation scores for the part that is dependent only on the pawn structure.

Passed pawn evaluation is of course dependent on other factors and blocked passed pawns get a smaller bonus.

game stage is an integer but can get many values(possible values 0-24) and the score is
(stage*endgame_score+(24-stage)*opening_score)/24;

Uri
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: About pawn hash tables

Post by BubbaTough »

Why not just hash 2 values, endgame_score and opening_score, and then keep everything else the same.

-Sam