checks in quies

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Re: checks in quies

Post by lkaufman »

rvida wrote:
lkaufman wrote: Still, 7 moves in PV and 2 in non-PV vs. 2 in PV and 1 in non-PV is a huge difference. Can you comment on why Ivanhoe finds it worthwhile to do this while SF does not?
AFAIK Stockfish does 2 plies of checks in both PV and non-PV nodes.

1) Non-pv nodes: programs don't really differ here

2) pv nodes: IMO it is not worthwhile what Ivanhoe does. I guess the intention was to compensate for doing LMR in pv nodes (original Ippolit did not).

And there are other things to consider. Whether QS nodes are hashed or not? Are there additional conditions besides depth? (is_check_dangerous() in Stockfish, eval being close to scout in Ivanhoe). Another important thing is how many evasion moves are considered (avoiding QS tree explosion).
On the last point, do any strong programs restrict the number of evasion moves tried in quies, other than excluding bad-SEE interpositions?
User avatar
Rebel
Posts: 6995
Joined: Thu Aug 18, 2011 12:04 pm

Re: checks in quies

Post by Rebel »

[d] 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - -

Here is a nice position to test checks in QS.

00:00:00 1.00 -12.10 1.cxd3 Qb4 2.Kf7 Nxg3
00:00:00 1.04 -11.36 1.Kxf8 Qb4 2.Kg8 Kxf6 3.cxd3 Nxg3
00:00:00 1.17 M 30 1.Neg4 Kf5 2.Nh6 Ke5 3.Nf7 Kf5 4.Nd6

:wink:
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: checks in quies

Post by rvida »

lkaufman wrote:
rvida wrote:Another important thing is how many evasion moves are considered (avoiding QS tree explosion).
On the last point, do any strong programs restrict the number of evasion moves tried in quies, other than excluding bad-SEE interpositions?
Yes. If the eval is two tempi (or more) below scout, Critter considers only captures. Additionally it applies the usual delta pruning condition (prune if eval + value of victim + margin < scout).
lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Re: checks in quies

Post by lkaufman »

rvida wrote:
lkaufman wrote:
rvida wrote:Another important thing is how many evasion moves are considered (avoiding QS tree explosion).
On the last point, do any strong programs restrict the number of evasion moves tried in quies, other than excluding bad-SEE interpositions?
Yes. If the eval is two tempi (or more) below scout, Critter considers only captures. Additionally it applies the usual delta pruning condition (prune if eval + value of victim + margin < scout).
I think this would prune very little except after capture checks. The side giving check must have a score below scout else he would stand pat, so unless the check was positionally very good the side in check would normally be above scout. Still, it seems a worthwhile thing to do.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: checks in quies

Post by bob »

lkaufman wrote:
bob wrote:[

The purpose of adding checks to the q-search is to cover up for tactical errors induced due to pruning near the tips..
I find this a most surprising comment. I simply don't see how adding checks in quies will help in any way to make up for missing a move before quies. Furthermore your answer suggests that programs that do no pruning at all cannot benefit from checks in quies, but I'm pretty sure that old full-width programs like the Spracklens' Fidelity programs did benefit from one ply of checks in quies.
However, if you are right, this would explain the puzzle. The Ippo-related programs look at fewer moves on the last few ply than SF, so according to your theory they would offset this by more quies checks. But I just don't see how that would help.
Simple null-move failure example.

You reach a position when you win a pawn (playing black). Your opponent gets a pawn on f6, queen on h6, with your king at g8. You have no way to avoid the forced mate. But you are two plies within the horizon, and when you try a null-move and reduce the depth to 0, you conclude that winning that pawn is good and you can fail high. Wrong. Look at the qg7+ move and you discover all is not well.

That was the reason I added checks to the q-search about 10 years ago or so, to solve that specific problem. Until then, one simply had to avoid reducing the search so much that after a null-move you dropped directly into the q-search which doesn't see such tactics. It is more efficient to reduce, period, and let the q-search discover the winning checks as well as the winning captures..

One can gain from checks in q-search, because it lets you spot deeper mates that you could not normally see if you can't reach deep enough. But there is a cost, because the normal search looks at all moves, not just checks and captures, and most of the time, the best move is not either of those. So it is a compromise.

I have not tested q-search checks in several years to see whether they help, do nothing, or hurt, at todays much deeper depths. They are not a "major win" however.
lkaufman
Posts: 5960
Joined: Sun Jan 10, 2010 6:15 am
Location: Maryland USA

Re: checks in quies

Post by lkaufman »

bob wrote:
lkaufman wrote:
bob wrote:[

The purpose of adding checks to the q-search is to cover up for tactical errors induced due to pruning near the tips..
I find this a most surprising comment. I simply don't see how adding checks in quies will help in any way to make up for missing a move before quies. Furthermore your answer suggests that programs that do no pruning at all cannot benefit from checks in quies, but I'm pretty sure that old full-width programs like the Spracklens' Fidelity programs did benefit from one ply of checks in quies.
However, if you are right, this would explain the puzzle. The Ippo-related programs look at fewer moves on the last few ply than SF, so according to your theory they would offset this by more quies checks. But I just don't see how that would help.
Simple null-move failure example.

You reach a position when you win a pawn (playing black). Your opponent gets a pawn on f6, queen on h6, with your king at g8. You have no way to avoid the forced mate. But you are two plies within the horizon, and when you try a null-move and reduce the depth to 0, you conclude that winning that pawn is good and you can fail high. Wrong. Look at the qg7+ move and you discover all is not well.

That was the reason I added checks to the q-search about 10 years ago or so, to solve that specific problem. Until then, one simply had to avoid reducing the search so much that after a null-move you dropped directly into the q-search which doesn't see such tactics. It is more efficient to reduce, period, and let the q-search discover the winning checks as well as the winning captures..

One can gain from checks in q-search, because it lets you spot deeper mates that you could not normally see if you can't reach deep enough. But there is a cost, because the normal search looks at all moves, not just checks and captures, and most of the time, the best move is not either of those. So it is a compromise.

I have not tested q-search checks in several years to see whether they help, do nothing, or hurt, at todays much deeper depths. They are not a "major win" however.
OK, I didn't realize you were talking about null move when you spoke of "pruning near the tips". Talking only about real moves and not the null move, is there any case where checks in quies would offset pruning in the main search (for example, futility pruning)? As for the null move case, it is clear why including checks on the first ply of quies would help, but it seems to me that it would never help to include them on the second ply, as that would only help the "wrong" side. Am I right or wrong here?
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: checks in quies

Post by diep »

lkaufman wrote:There is a huge disparity among top programs in the number of plies of quies which include non-capturing checks. I believe that SF only looks at 1 (PV) or 2(nonPV) plies (as currently does Komodo), while Rybka, Ippo, Critter, and Ivanhoe look at quite a few, I believe 5 (PV) or 7(nonPV) in the case of Ivanhoe if the score is not too bad. Presumably all of these authors have "checked" this out (sorry for pun) and have found that the numbers they use are best or at least near-optimal.
My question is this: what characteristics of the programs make it reasonable to look at so many plies of checks in the case of Rybka/Ippo etc. and unreasonable in the case of Stockfish and Komodo? Since Ivanhoe and Stockfish are open-source, perhaps I should limit the discussion to those two programs. What fundamental difference between Stockfish and Ivanhoe accounts for this enormous disparity in number of plies of checks?
Diep is doing everywhere checks in qsearch.

Qsearch in diep is not layered, every ply is the same. Max depth of qsearch is a ply or 32.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: checks in quies

Post by diep »

Rebel wrote:[d] 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - -

Here is a nice position to test checks in QS.

00:00:00 1.00 -12.10 1.cxd3 Qb4 2.Kf7 Nxg3
00:00:00 1.04 -11.36 1.Kxf8 Qb4 2.Kg8 Kxf6 3.cxd3 Nxg3
00:00:00 1.17 M 30 1.Neg4 Kf5 2.Nh6 Ke5 3.Nf7 Kf5 4.Nd6

:wink:
That's not really true Ed, as extensions in mainsearch also will find this one.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: checks in quies

Post by diep »

lkaufman wrote:
rvida wrote:
lkaufman wrote: Still, 7 moves in PV and 2 in non-PV vs. 2 in PV and 1 in non-PV is a huge difference. Can you comment on why Ivanhoe finds it worthwhile to do this while SF does not?
AFAIK Stockfish does 2 plies of checks in both PV and non-PV nodes.

1) Non-pv nodes: programs don't really differ here

2) pv nodes: IMO it is not worthwhile what Ivanhoe does. I guess the intention was to compensate for doing LMR in pv nodes (original Ippolit did not).

And there are other things to consider. Whether QS nodes are hashed or not? Are there additional conditions besides depth? (is_check_dangerous() in Stockfish, eval being close to scout in Ivanhoe). Another important thing is how many evasion moves are considered (avoiding QS tree explosion).
On the last point, do any strong programs restrict the number of evasion moves tried in quies, other than excluding bad-SEE interpositions?
Diep is using a lot of chessknowledge deciding which checks to try. PV or non-PV is not a difference there.

In game tree search there is a trade-off between qsearch and mainsearch.

If you research more moves in qsearch, your mainsearch becomes more efficient and your evaluation can have more chessknowledge.

So in general the faster the engine the less they do in qsearch. The first ply is most effective then and the 2nd ply or 2nd check is very effective then for solving tactical positions at smaller depths.

elowise researching this is not so easy, except if you have the hardware to test it all out.

It seems though that my years 90 statement on that doing checks in qsearch is important, which was denied by many, that nowadays most just simply try them.

Please note that diep is doing both giving checks as well as escaping from check in qsearch.

We should not mix up discussions here tha tmost authors, when referring to checks in qsearch, they speak about escaping from checks; if i refer to 'most effective' i speak about GIVING checks.

Eds example also is a 'giving check' example.

The discussion is not so much where to do evasion checks, the expensive thing is to GIVE checks in qsearch :)
User avatar
mhull
Posts: 13447
Joined: Wed Mar 08, 2006 9:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

Re: checks in quies

Post by mhull »

lkaufman wrote:There is a huge disparity among top programs in the number of plies of quies...
...quiesce...

Pedantic Regards,
:)
Matthew Hull