Fail-highs and fail-lows

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Fail-highs and fail-lows

Post by Sven »

Gerd Isenberg wrote:If you set alpha to [mate in 8] after a fail high, and you find a [mate in 8] again it should not be interpreted as fail low. Or?
Correct. Read my answers above where I explain why this is the reason to use 'value - 1' as new alpha.

Sven
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: Fail-highs and fail-lows

Post by Zach Wegner »

Gerd Isenberg wrote:If you set alpha to [mate in 8] after a fail high, and you find a [mate in 8] again it should not be interpreted as fail low. Or?
I think it should be interpreted as a fail low, because the score could be less than [mate in 8]. Well, maybe in this mate example it can't be, if you have a well behaved search. If you need to know whether the score is exactly X, set alpha to X-1 (or do two zero window searches...).
metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Re: Fail-highs and fail-lows

Post by metax »

Sven Schüle wrote:His problem is about exact scores returned by the first search. The old proposal to research with [value .. +INFINITY] does not deal with exact scores. If there is no heavy pruning and maybe also no hashing involved then you still would run into that problem with the lower bound of the new window set to 'value', because the exact score 'value' must remain "inside" the new window bounds. So the new lower bound should always be 'value - 1' to guarantee that.

However, if search instability is possible then it may still be the better choice to open the new aspiration window completely, i.e. [-INF .. + INF]. But at least the 'exact score' issue seems unrelated to search instability for me.
Do you do this in the researches after the NWS fail-highs, too (and at least in my engine it is not so rare that a NWS fails high, but the research with [value, +INF] window does not)?
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Fail-highs and fail-lows

Post by hgm »

Yes, an equal score (so also an equal mate dstance) is a fail low. The move is at best equal, and might be worse. You are not interested in figuring out if it is actually worse, as you already have a mate in 8.
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: Fail-highs and fail-lows

Post by Gerd Isenberg »

Zach Wegner wrote:
Gerd Isenberg wrote:If you set alpha to [mate in 8] after a fail high, and you find a [mate in 8] again it should not be interpreted as fail low. Or?
I think it should be interpreted as a fail low, because the score could be less than [mate in 8]. Well, maybe in this mate example it can't be, if you have a well behaved search. If you need to know whether the score is exactly X, set alpha to X-1 (or do two zero window searches...).
Yes, I explicitly refer to that "trusted" mate example. At depth X you fail high and find a lower bound of a mate in N - it could be even a shorter mate. So setting root alpha to mate in N seems correct to me, and to don't interpret score == alpha of the next iteration as a fail low in that case. I agree that alpha = score - 1 solves that, but it somehow seems counter intuitive to me - more logical (without actually looking to my source) after a "trusted" mate in x is to disable fail-lows at the root ;-)
metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Re: Fail-highs and fail-lows

Post by metax »

I just found something interesting that Stockfish does in case of a fail-high of a NWS move. It just researches with the [alpha, beta] window, nothing like [value, +INF] or [value - 1, +INF]. If it fails high then, it researches at the next iteration. This is a new approach at least for me and I think I'll try this out in ChessMind.
zamar
Posts: 613
Joined: Sun Jan 18, 2009 7:03 am

Re: Fail-highs and fail-lows

Post by zamar »

metax wrote:I just found something interesting that Stockfish does in case of a fail-high of a NWS move. It just researches with the [alpha, beta] window, nothing like [value, +INF] or [value - 1, +INF]. If it fails high then, it researches at the next iteration. This is a new approach at least for me and I think I'll try this out in ChessMind.
Just keep in mind that in this approach these things are closely related:

* time management (allocate _much_ extra time when facing aspiration fail/high-low to fully resolve it at next ply)

* dynamic aspiration window calculation (usually aspiration window should be quite small, but when resolving aspiration fail-high/low, you should enlarge it, but not too much...)

It can be very tricky to get all the pieces right...
Joona Kiiski
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Fail-highs and fail-lows

Post by bob »

Gerd Isenberg wrote:
Zach Wegner wrote:
Gerd Isenberg wrote:If you set alpha to [mate in 8] after a fail high, and you find a [mate in 8] again it should not be interpreted as fail low. Or?
I think it should be interpreted as a fail low, because the score could be less than [mate in 8]. Well, maybe in this mate example it can't be, if you have a well behaved search. If you need to know whether the score is exactly X, set alpha to X-1 (or do two zero window searches...).
Yes, I explicitly refer to that "trusted" mate example. At depth X you fail high and find a lower bound of a mate in N - it could be even a shorter mate. So setting root alpha to mate in N seems correct to me, and to don't interpret score == alpha of the next iteration as a fail low in that case. I agree that alpha = score - 1 solves that, but it somehow seems counter intuitive to me - more logical (without actually looking to my source) after a "trusted" mate in x is to disable fail-lows at the root ;-)
The only gotcha here is that if you set alpha, what do you set it to? The actual mate score? that's wrong, because it is a mate in N from the root, not a mate in N from the current node. If you set it to the "corrected" backed-up mate score, that can also be wrong because of how entries are stored in the hash table. It can be made to work, but it takes some thought to avoid a bad instability around mates.
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: Fail-highs and fail-lows

Post by Gerd Isenberg »

bob wrote:
Gerd Isenberg wrote:
Zach Wegner wrote:
Gerd Isenberg wrote:If you set alpha to [mate in 8] after a fail high, and you find a [mate in 8] again it should not be interpreted as fail low. Or?
I think it should be interpreted as a fail low, because the score could be less than [mate in 8]. Well, maybe in this mate example it can't be, if you have a well behaved search. If you need to know whether the score is exactly X, set alpha to X-1 (or do two zero window searches...).
Yes, I explicitly refer to that "trusted" mate example. At depth X you fail high and find a lower bound of a mate in N - it could be even a shorter mate. So setting root alpha to mate in N seems correct to me, and to don't interpret score == alpha of the next iteration as a fail low in that case. I agree that alpha = score - 1 solves that, but it somehow seems counter intuitive to me - more logical (without actually looking to my source) after a "trusted" mate in x is to disable fail-lows at the root ;-)
The only gotcha here is that if you set alpha, what do you set it to? The actual mate score? that's wrong, because it is a mate in N from the root, not a mate in N from the current node. If you set it to the "corrected" backed-up mate score, that can also be wrong because of how entries are stored in the hash table. It can be made to work, but it takes some thought to avoid a bad instability around mates.
Ok, I was referring the root, where Luca mentioned to fail low at ply 9 after a fail high at ply 8 with mate in 8 score, with the need to re-search.

Ply 08 Move M8++
Ply 09 Move M8--
Ply 09 Move M8

I wrote almost nonsense, since disabling fail low after a "trusted" mate score and setting root alpha to Mate in 8 would miss the PV.
John Major
Posts: 27
Joined: Fri Dec 11, 2009 10:23 pm

Re: Fail-highs and fail-lows

Post by John Major »

Gerd Isenberg wrote: You should use < alpha, == alpha is not a fail low.
Or,
< alpha when using fail-soft, <= alpha when using fail-hard