Advice on stabalizing the eval needed

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.
Michael Sherwin
Posts: 3046
Joined: Fri May 26, 2006 1:00 am
Location: WY, USA
Full name: Michael Sherwin

Advice on stabalizing the eval needed

Post by Michael Sherwin » Thu May 03, 2007 9:58 pm

In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
I hate if statements. Pawns demand if statements. Therefore I hate pawns.

Tony

Re: Advice on stabalizing the eval needed

Post by Tony » Fri May 04, 2007 8:38 am

Michael Sherwin wrote:In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
In XiniX, I limit the extremes that are "spiking". fe I have no problem with giving a passed pawn a bonus X, but when rank-1 and rank+1 only have x/2 bonusses, it gets adjusted.

This can happen in my (buggy) neural net implementation.

I also have to take care of "doubles".
In my definition, I thought a backwards pawn was bad, but the neural net found good backward pawns: Pawns on the 6th rank, since my definition says that there must be a pawn ahead of it. So I was actually scoring backward pawns AND defended passed pawns.

Tony

Uri Blass
Posts: 8605
Joined: Wed Mar 08, 2006 11:37 pm
Location: Tel-Aviv Israel

Re: Advice on stabalizing the eval needed

Post by Uri Blass » Fri May 04, 2007 11:13 am

Michael Sherwin wrote:In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
I think that the best is not to create dynamically piece square tables before each search.

Michael Sherwin
Posts: 3046
Joined: Fri May 26, 2006 1:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Advice on stabalizing the eval needed

Post by Michael Sherwin » Fri May 04, 2007 2:55 pm

Uri Blass wrote:
Michael Sherwin wrote:In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
I think that the best is not to create dynamically piece square tables before each search.
I am aware of the argument of root evaluation of squares vs. that of endleaf evaluation. I have decided to investigate the former as it is possible to use huge amounts of chess knowledge to build the tables at virtually no cost in time to the search. Also the move that is played at the root is far more important than any move that may or may not be made further up in the tree and information from the root is more strategically in tune with the first move. However, I still see the need for endleaf evaluation and that is where the pawn structure eval and two bishop bonus are done (and other things that are planned). One thing that I have not done yet is to bonus/malus pawn squares based on how the pawn placement affects the movements of the pieces. That should help a lot. None of this addresses my original question though.

One thing of note is, that I have worked mostly on the search these last two years and only have a couple of days invested in the eval so far. So, unless I am a genius ( and I'm not) and created the almost absolute best 'root evaluator' from the start, there is still much to be gained from two more years work on the eval.

So, other than the argument that the search is too deep and root evaluation is therefore too inaccurate on modern computers, what if any further argument is there against root evaluation?
I hate if statements. Pawns demand if statements. Therefore I hate pawns.

Michael Sherwin
Posts: 3046
Joined: Fri May 26, 2006 1:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Advice on stabalizing the eval needed

Post by Michael Sherwin » Fri May 04, 2007 3:08 pm

Tony wrote:
Michael Sherwin wrote:In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
In XiniX, I limit the extremes that are "spiking". fe I have no problem with giving a passed pawn a bonus X, but when rank-1 and rank+1 only have x/2 bonusses, it gets adjusted.

This can happen in my (buggy) neural net implementation.

I also have to take care of "doubles".
In my definition, I thought a backwards pawn was bad, but the neural net found good backward pawns: Pawns on the 6th rank, since my definition says that there must be a pawn ahead of it. So I was actually scoring backward pawns AND defended passed pawns.

Tony
So, if at the beginning of the search, when the pawn tables are being generated, if there are a lot of advanced pawns for one side then to avoid a huge spike in the eval for that side the pawn tables should be adjusted downward some?
I hate if statements. Pawns demand if statements. Therefore I hate pawns.

bob
Posts: 20640
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Advice on stabalizing the eval needed

Post by bob » Fri May 04, 2007 7:47 pm

Michael Sherwin wrote:
Uri Blass wrote:
Michael Sherwin wrote:In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
I think that the best is not to create dynamically piece square tables before each search.
I am aware of the argument of root evaluation of squares vs. that of endleaf evaluation. I have decided to investigate the former as it is possible to use huge amounts of chess knowledge to build the tables at virtually no cost in time to the search. Also the move that is played at the root is far more important than any move that may or may not be made further up in the tree and information from the root is more strategically in tune with the first move. However, I still see the need for endleaf evaluation and that is where the pawn structure eval and two bishop bonus are done (and other things that are planned). One thing that I have not done yet is to bonus/malus pawn squares based on how the pawn placement affects the movements of the pieces. That should help a lot. None of this addresses my original question though.

One thing of note is, that I have worked mostly on the search these last two years and only have a couple of days invested in the eval so far. So, unless I am a genius ( and I'm not) and created the almost absolute best 'root evaluator' from the start, there is still much to be gained from two more years work on the eval.

So, other than the argument that the search is too deep and root evaluation is therefore too inaccurate on modern computers, what if any further argument is there against root evaluation?
It just doesn't work well. You are using information at position X to establish critical evaluation parameters. Then you evaluate position Y, which is _many_ plies removed from position X. At position X, king safety might have been meaningless, while at position Y, your king is terribly exposed. Processing at the root would base the eval on the position where your king is safe, and make terrible errors in the actual position being evaluated. It works when you search very shallow trees. But the deeper you can go, the farther the real positions you evaluate are removed from the root position where you set the terms up.

Tony

Re: Advice on stabalizing the eval needed

Post by Tony » Mon May 07, 2007 6:00 am

Michael Sherwin wrote:
Tony wrote:
Michael Sherwin wrote:In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
In XiniX, I limit the extremes that are "spiking". fe I have no problem with giving a passed pawn a bonus X, but when rank-1 and rank+1 only have x/2 bonusses, it gets adjusted.

This can happen in my (buggy) neural net implementation.

I also have to take care of "doubles".
In my definition, I thought a backwards pawn was bad, but the neural net found good backward pawns: Pawns on the 6th rank, since my definition says that there must be a pawn ahead of it. So I was actually scoring backward pawns AND defended passed pawns.

Tony
So, if at the beginning of the search, when the pawn tables are being generated, if there are a lot of advanced pawns for one side then to avoid a huge spike in the eval for that side the pawn tables should be adjusted downward some?
No, not quite.

The amount of advanced pawns has nothing to do with it. The adjustment is not on the eval as a whole, but on certain parts.

Fe I generate the tables for the passed pawns with certain pieces on the boards and the kings on certain locations/sides. Then I make sure that a passed pawn on A6 has a higher score than one on A5 (assuming the same other circumstances) but not as high as on A7.

Further I make sure that a passed pawn on A6 with my king on the queenside and your king on the kingsside, has a higher score than both our kings on the queenside etc.

Tony

mjlef
Posts: 1428
Joined: Thu Mar 30, 2006 12:08 pm
Contact:

Re: Advice on stabalizing the eval needed

Post by mjlef » Mon May 07, 2007 6:23 am

bob wrote:
Michael Sherwin wrote:
Uri Blass wrote:
Michael Sherwin wrote:In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
I think that the best is not to create dynamically piece square tables before each search.
I am aware of the argument of root evaluation of squares vs. that of endleaf evaluation. I have decided to investigate the former as it is possible to use huge amounts of chess knowledge to build the tables at virtually no cost in time to the search. Also the move that is played at the root is far more important than any move that may or may not be made further up in the tree and information from the root is more strategically in tune with the first move. However, I still see the need for endleaf evaluation and that is where the pawn structure eval and two bishop bonus are done (and other things that are planned). One thing that I have not done yet is to bonus/malus pawn squares based on how the pawn placement affects the movements of the pieces. That should help a lot. None of this addresses my original question though.

One thing of note is, that I have worked mostly on the search these last two years and only have a couple of days invested in the eval so far. So, unless I am a genius ( and I'm not) and created the almost absolute best 'root evaluator' from the start, there is still much to be gained from two more years work on the eval.

So, other than the argument that the search is too deep and root evaluation is therefore too inaccurate on modern computers, what if any further argument is there against root evaluation?
It just doesn't work well. You are using information at position X to establish critical evaluation parameters. Then you evaluate position Y, which is _many_ plies removed from position X. At position X, king safety might have been meaningless, while at position Y, your king is terribly exposed. Processing at the root would base the eval on the position where your king is safe, and make terrible errors in the actual position being evaluated. It works when you search very shallow trees. But the deeper you can go, the farther the real positions you evaluate are removed from the root position where you set the terms up.
Although in my program I have moved completely away from assigning values based on root analysis and now calculate everything I need at each node, I do think one inbetween technique is to use 2 tables. One for the opening and one for the endgame, then interpolate between these two values (Fruit does this). You then can set a piece value table entry for the openeing and for the endgame, and that can compensate a lot for things like piece safety, passed pawn scaling etc. Not as good as realy taking the current position into account, but a lot better than a static piece-square table.

bob
Posts: 20640
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Advice on stabalizing the eval needed

Post by bob » Mon May 07, 2007 5:28 pm

mjlef wrote:
bob wrote:
Michael Sherwin wrote:
Uri Blass wrote:
Michael Sherwin wrote:In RomiChess the piece/square tables are created dynamically before each search. This can lead to some extreamly unbalanced evals leading to things like bad sacrifices and other pathalogical behaviors. So, what is best, limiting each square to a maximum or adding up all the squares and scaling them all down to some total maximum or scaling wPos - bPos so that it is at the most some +/- value or what?

Thanks!
I think that the best is not to create dynamically piece square tables before each search.
I am aware of the argument of root evaluation of squares vs. that of endleaf evaluation. I have decided to investigate the former as it is possible to use huge amounts of chess knowledge to build the tables at virtually no cost in time to the search. Also the move that is played at the root is far more important than any move that may or may not be made further up in the tree and information from the root is more strategically in tune with the first move. However, I still see the need for endleaf evaluation and that is where the pawn structure eval and two bishop bonus are done (and other things that are planned). One thing that I have not done yet is to bonus/malus pawn squares based on how the pawn placement affects the movements of the pieces. That should help a lot. None of this addresses my original question though.

One thing of note is, that I have worked mostly on the search these last two years and only have a couple of days invested in the eval so far. So, unless I am a genius ( and I'm not) and created the almost absolute best 'root evaluator' from the start, there is still much to be gained from two more years work on the eval.

So, other than the argument that the search is too deep and root evaluation is therefore too inaccurate on modern computers, what if any further argument is there against root evaluation?
It just doesn't work well. You are using information at position X to establish critical evaluation parameters. Then you evaluate position Y, which is _many_ plies removed from position X. At position X, king safety might have been meaningless, while at position Y, your king is terribly exposed. Processing at the root would base the eval on the position where your king is safe, and make terrible errors in the actual position being evaluated. It works when you search very shallow trees. But the deeper you can go, the farther the real positions you evaluate are removed from the root position where you set the terms up.
Although in my program I have moved completely away from assigning values based on root analysis and now calculate everything I need at each node, I do think one inbetween technique is to use 2 tables. One for the opening and one for the endgame, then interpolate between these two values (Fruit does this). You then can set a piece value table entry for the openeing and for the endgame, and that can compensate a lot for things like piece safety, passed pawn scaling etc. Not as good as realy taking the current position into account, but a lot better than a static piece-square table.
That's not quite the thing we are talking about. At the root, you notice your opponent's king appears to be safe, so you set up everything to develop normally and try to control the center (or vice-versa). 20 plies down, you have discovered a way to expose his king, but it doesn't look interesting since your scoring terms are not concerned with an exposed king at depth 20 since at depth=1 the king was not exposed.

The point being that in the days (70's) of 5 ply searches, this idea was perfectly safe (you couldn't do much in 5 plies to drastically change a position) but today's 20 ply searches put those tip positions a _long_ way away from the root position where things started.

In an extreme case, you could notice (at the root) that your opponent has some significant (you think) threat, but by ply-4 the threat is gone. Yet your evaluation is worrying about that threat all the way out to depth=20. And guiding your search away from what is really about to happen were you looking more carefully...

CRoberson
Posts: 2005
Joined: Mon Mar 13, 2006 1:31 am
Location: North Carolina, USA
Contact:

Re: Advice on stabalizing the eval needed

Post by CRoberson » Mon May 07, 2007 6:03 pm

You need to consider the point of the search. The point is to find achievable positions for the positoin evaluator to decide if the positions are worth reaching. The position evaluation has to be evaluated based on its own merits and not on the merits of the root position. This is exactly the advice of several chess IM's and GM's.

I have several books by Eugene Znosko-Borovsky. One of them is "How Not to Play Chess". In it, he states a very common mistake for beginner to intermediate chess players is to become enamored with the search and lose site of the resulting position. They find a waycool (punn intended) combination and go for it, but they don't see that it leads them to a lost position.

A great combo that leads to a lost position is useless.

Post Reply