Tapered Eval between 4 phases

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
AndrewGrant
Posts: 494
Joined: Tue Apr 19, 2016 4:08 am
Location: U.S.A
Full name: Andrew Grant
Contact:

Tapered Eval between 4 phases

Post by AndrewGrant » Mon Oct 16, 2017 1:40 am

So I (and I think most of us) are using some variant of shifting evaluation between MG and EG based on material values.

Code: Select all

    phase = 24 - popcount(queens) * 4
               - popcount(rooks) * 2
               - popcount(knights | bishops);
    phase = (phase * 256 + 12) / 24;
          
    eval = (mg * (256 - phase) + eg * phase) / 256;
I'm getting ready to try something a bit different. Instead of MG and EG, we have four different phases

Each type of Phase
P1 = All Pawns & All Minor/Major
P2 = All Pawns & No Minor/Major
P3 = No Pawns & All Minor/Major
P4 = No Pawns & No Minor/Major

We will say mphase (Minor/Major Phase) = the same as the phase in the above code snipet.
We will say pphase (Pawn Phase) = ((16 - popcount(pawns)) * 256 + 8) / 16

Then to compute the actual evaluation, based on the P1, P2, P3 and P4 evaluations we will say

Code: Select all

eval = (p1 * (512 - mphase - pphase))
     + (p2 * (256 - mphase + pphase))
     + (p3 * (256 + mphase - pphase))
     + (p4 * (  0 + mphase + pphase));
eval = eval / 1024;
Has anyone tried anything along these lines? I only know of one engine that uses a 3 phased evaluation (Gull? or Fire?).

elcabesa
Posts: 815
Joined: Sun May 23, 2010 11:32 am
Contact:

Re: Tapered Eval between 4 phases

Post by elcabesa » Mon Oct 16, 2017 6:59 am

I'd like to try it replacing the number of pawn with open/closed position
But I never tried

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

Re: Tapered Eval between 4 phases

Post by hgm » Mon Oct 16, 2017 7:25 am

IMO the largest shortcoming of the two-phase model is not the shape of the interpolation, but that all eval parameters depend on the same game-phase variable. I other words, that game phase is a one-dimensional quantity. It is very unlikely that King safety should be interpolated the same way between a full FIDE setup and bare Kings as, for instance, the value of pushing passers.

In other words, worrying about the number of intermediate phases is a lot like worrying about the exact radius a circle has to have to best approximate a given square.

elcabesa
Posts: 815
Joined: Sun May 23, 2010 11:32 am
Contact:

Re: Tapered Eval between 4 phases

Post by elcabesa » Mon Oct 16, 2017 7:34 am

My idea is to have a 2 dimension gamephase

jorose
Posts: 269
Joined: Thu Jan 22, 2015 2:21 pm
Location: Zurich, Switzerland
Full name: Jonathan Rosenthal

Re: Tapered Eval between 4 phases

Post by jorose » Mon Oct 16, 2017 9:44 am

I use a generalization of this in Winter. I assume every position is from some set of k Gaussians. For every position evaluation I estimate the probability that a position is from each of those Gaussians and interpolate the evaluation based on the parameters I estimated for each Gaussian and these probabilities.

Unfortunately Winter is still very weak relative to top engines, so I don't feel confident the idea is worth anything in general, but for Winter it seems to be working quite well.

User avatar
cdani
Posts: 2104
Joined: Sat Jan 18, 2014 9:24 am
Location: Andorra
Contact:

Re: Tapered Eval between 4 phases

Post by cdani » Mon Oct 16, 2017 12:14 pm

In Andscacs I have various bonus/penalizations related to the number of pawns and closed center. I think is better to have specific features like this than generic ones, as Hgm suggest. Anyway I have also an standard two phase tapered eval.

User avatar
Evert
Posts: 2924
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: Tapered Eval between 4 phases

Post by Evert » Mon Oct 16, 2017 3:38 pm

hgm wrote:IMO the largest shortcoming of the two-phase model is not the shape of the interpolation, but that all eval parameters depend on the same game-phase variable. I other words, that game phase is a one-dimensional quantity. It is very unlikely that King safety should be interpolated the same way between a full FIDE setup and bare Kings as, for instance, the value of pushing passers.
Yes.
I usually divide phases as "hide king", "activate king" and "run with pawns", at least in my mind. No, for orthochess, "activate king" and "run with pawns" are close enough that you can lump them together, so you end up with two phases you could label "middle game" and "end game" if you like.
For variants it is a different matter, of course.

ymatioun
Posts: 64
Joined: Fri Oct 18, 2013 9:40 pm
Location: New York

Re: Tapered Eval between 4 phases

Post by ymatioun » Mon Oct 16, 2017 9:50 pm

I tried this earlier this year; i tried using 4 stages, 8 stages and even 16 stages (you can fit 16 16-bit values into one AVX variable that you can operate on in one instruction, so up to 16 stages can be accommodated with virtually no performance penalty). This significantly reduces variance of the residual in optimization(possibly due to overfitting), but i could not get any performance improvement.

Post Reply