Trading Pieces When Ahead In Material

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Cardoso
Posts: 362
Joined: Thu Mar 16, 2006 7:39 pm
Location: Portugal
Full name: Alvaro Cardoso

Re: Trading Pieces When Ahead In Material

Post by Cardoso »

Michael Sherwin wrote:Hi Dany,

Romi has eval history tables. They are created in search just like normal history tables except that they are used in the eval to bonus some moves over other moves. Exchanging queens in that position would have a higher history value. I call this idea feedback from search to the eval.
Hi Michael, what ELO increase did you get with this idea, and what kind of tests did you do?
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Trading Pieces When Ahead In Material

Post by Michael Sherwin »

Cardoso wrote:
Michael Sherwin wrote:Hi Dany,

Romi has eval history tables. They are created in search just like normal history tables except that they are used in the eval to bonus some moves over other moves. Exchanging queens in that position would have a higher history value. I call this idea feedback from search to the eval.
Hi Michael, what ELO increase did you get with this idea, and what kind of tests did you do?
Romi has had them for a decade or more. I'm not sure about the elo gain. I only know that I have tried to get rid of it and every time I do Romi plays worse.

Over the years I have tested tens of thousands of games. The idea still needs lots of work. :)
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Trading Pieces When Ahead In Material

Post by Michael Sherwin »

Example of work to be done.

Added a Normalize function to the eval to limit extremes that allows the eval history table to be more aggressive. Then moving the the incrementing of the table to > beta result and making the increment 100 instead of 16.

Code: Select all

    if(histTbln[fig][fs][ts] > 100) {
      histTbln[fig][fs][ts] /= 2;
      histTblg[fig][fs][ts] /= 2;
    }
    if(evalHistTbln[fig][ts] > 20000) {
      evalHistTbln[fig][ts] /= 2;
      evalHistTblg[fig][ts] /= 2;
    }
    if(!inNull && !inShort && board[ts] == EMPTY) {
      histTbln[fig][fs][ts]++;
      evalHistTbln[fig][ts]++;
    }
    if(h->node->score > alpha) {
      if(!inShort && !inNull && board[ts] == EMPTY) {
        histTblg[fig][fs][ts] += 100;
      }
      if(h->node->score >= beta) {
        if(!inShort && !inNull && board[ts] == EMPTY) {
          evalHistTblg[fig][ts] += 100;
Sorry if this is a bit oblique. It is my bedtime. :(

Here is an early partial result.

RomiChess64P3o - Monolith_03_x64 : 21.0/31 16-5-10 (=010=1101=1110011==1==1111=11==) 68% +131

Best previous Romi result vs Monolith was 53% after 100 games, fingers crossed this test holds up.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Re: Trading Pieces When Ahead In Material

Post by Rebel »

Michael Sherwin wrote:
zenpawn wrote:
Michael Sherwin wrote:Romi has eval history tables. They are created in search just like normal history tables except that they are used in the eval to bonus some moves over other moves. Exchanging queens in that position would have a higher history value. I call this idea feedback from search to the eval. Tord later included a feedback idea in Glaurung but I could not tell how it compared to my idea. Way back the early Stockfish kept the feedback idea. I don't know if current Stockfish still keeps the idea or not. 8-)
Could you please elaborate on this concept? Thanks!
In the search I have this.

Code: Select all

    if(evalHistTbln[fig][ts] > 20000) {
      evalHistTbln[fig][ts] /= 2;
      evalHistTblg[fig][ts] /= 2;
    }

    if(!inNull) {
      evalHistTbln[fig][ts]++;
    }

    if(h->node->score > alpha) {
      if(!inNull) {
        evalHistTblg[fig][ts] += 16;
And in the Eval I have this.

Code: Select all

    g = evalHistTblg[WQ][sq]; n = evalHistTbln[WQ][sq];
    wQueenTbl[sq] += (n > 49 ? g/n : 0);
It is not a large bonus but the idea is if in Daniel's situation above the WQ takes the BQ because that move gets a bonus from the history table more than other moves get.
It's a crazy idea, but I love crazy ideas. Have you tried it for all pieces? Not just for her majesty only.
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Trading Pieces When Ahead In Material

Post by Michael Sherwin »

Rebel wrote:
Michael Sherwin wrote:
zenpawn wrote:
Michael Sherwin wrote:Romi has eval history tables. They are created in search just like normal history tables except that they are used in the eval to bonus some moves over other moves. Exchanging queens in that position would have a higher history value. I call this idea feedback from search to the eval. Tord later included a feedback idea in Glaurung but I could not tell how it compared to my idea. Way back the early Stockfish kept the feedback idea. I don't know if current Stockfish still keeps the idea or not. 8-)
Could you please elaborate on this concept? Thanks!
In the search I have this.

Code: Select all

    if(evalHistTbln[fig][ts] > 20000) {
      evalHistTbln[fig][ts] /= 2;
      evalHistTblg[fig][ts] /= 2;
    }

    if(!inNull) {
      evalHistTbln[fig][ts]++;
    }

    if(h->node->score > alpha) {
      if(!inNull) {
        evalHistTblg[fig][ts] += 16;
And in the Eval I have this.

Code: Select all

    g = evalHistTblg[WQ][sq]; n = evalHistTbln[WQ][sq];
    wQueenTbl[sq] += (n > 49 ? g/n : 0);
It is not a large bonus but the idea is if in Daniel's situation above the WQ takes the BQ because that move gets a bonus from the history table more than other moves get.
It's a crazy idea, but I love crazy ideas. Have you tried it for all pieces? Not just for her majesty only.
Yes, it is done for all pieces. Currently I'm trying larger values. However, it is necessary to "Normalize" the eval based on each piece types maximum value. Right now I'm reducing each piece type to 90 on highest square and scaling down all other squares for that piece type to keep them in proportion. In the current test it looks really promising if it holds. Also to make the increase more meaningful instead of doing it on a search value > alpha it is being done on >= beta, but at a much greater value. So many parameters, so little time :). But you know how that is. Thankfully my first guess is usually really close.

Romi's best performance to date against Monolith was 53/100. The above being tested so far is 33.5/51 for 66%. Too few games, I know, so we will have to see if it holds up. :D
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Re: Trading Pieces When Ahead In Material

Post by Rebel »

Actually, now that you say it, I do something similar. Before the search starts I modify the (12) piece square tables using the values of the history[piece_type][square] table. While I expected nothing from such a crazy idea it actually worked.