LMP in PV nodes

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: LMP in PV nodes

Post by bob »

Michel wrote:Not pruning in PV nodes allows the PVS mechanism to correct certain mistakes in the search.

I once worked this out for LMR at CUT nodes. See here

http://www.talkchess.com/forum/viewtopic.php?t=48356

In general for PVS to yield the correct tree value a lower bound returned by a CUT node should be sane and similarly an upper bound returned by an ALL node should be sane.

Of course PVS researches take time so it is a tradeoff.

PS. CUT/ALL is defined by the parity of the distance to the lowest PV ancestor.
I don't disagree at all, but what does that have to do with treating PV vs non-PV nodes differently? What is the difference between a PV node and an ALL node other than at a PV node the first move is searched with a normal window while the rest are searched with a null-window, while at a normal ALL node every move is searched with a null-window?

And as a note, your definition of CUT/ALL is wrong. In a perfectly ordered tree it would be correct, but such is impossible to produce, as a result, the parity is only a hint, not anywhere near a "fact".
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: LMP in PV nodes

Post by bob »

Michel wrote:I guess what I wanted to say is this.

In PVS PV nodes really _are_ special for the following reason: if a scout search fails high then the child node is researched as a PV node. If the the fail high was erroneous the research may catch it.

However this "error correction" does not work if the same pruning is done in PV nodes as in non-PV nodes.
Why?

If you fail high at p, incorrectly, you will then fail low at p-1, incorrectly, and eventually you have to widen the window at the root and re-search anyway, which is exactly what happens when you find a new best move at the root. And while you are initially searching that new best move, you are not searching any PV nodes (except the root node of course which is always PV) so you treat it DIFFERENTLY on the re-search which is not a reasonable idea. You reduce it more the first time and it fails high, you reduce it less the second time and it fails low, how is that good?
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: LMP in PV nodes

Post by Michel »

I don't disagree at all, but what does that have to do with treating PV vs non-PV nodes differently?
In the post after the one you are answering I explained it.
And as a note, your definition of CUT/ALL is wrong
A definition is never wrong :-)

The definition of CUT/ALL I gave reflects how search errors are propagated to the nearest PV node which is important for PVS since scout searches are researched if they fail high but not if they fail low.

Don Dayley once wrote that Komodo also uses this definition (for the same reason). I do not know if this is still true.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: LMP in PV nodes

Post by bob »

Michel wrote:
I don't disagree at all, but what does that have to do with treating PV vs non-PV nodes differently?
In the post after the one you are answering I explained it.
And as a note, your definition of CUT/ALL is wrong
A definition is never wrong :-)

The definition of CUT/ALL I gave reflects how search errors are propagated to the nearest PV node which is important for PVS since scout searches are researched if they fail high but not if they fail low.

Don Dayley once wrote that Komodo also uses this definition (for the same reason). I do not know if this is still true.
If you read my Ph.D. dissertation, this idea was a 1987 thing I used in Cray Blitz to help choose a split point. I sometimes had to split before the first branch of a node had been searched, so this ALL/CUT parity was a specific starting point (but one which had to be modified since ALL/CUT is NEVER correct in every place.

Your "propagate" really overlooks a lot of things. First, non-PV nodes directly influence PV nodes via the transposition table.

But the question still remains unanswered, what theoretical justification is there for reducing or pruning differently based only on the criteria "is alpha == beta -1 or not?" Of course that definition only works for PVS, but that is what everyone is using so it seems like a good way of defining a PV node in the classic sense, even if it is quite often wrong due to improper move ordering.

Here is a more specific example question. Suppose you have searched a root move completely except for the very last node. Why would you reduce/prune MORE on that very last node, just because this position comes from the first move at the root vs the second move at the root?

The only viable exception to the PV vs non-PV node treatment is with null-move search, since doing a null-move at a PV node doesn't help, as a null-move is not legal and can not be propagated back to the root. So you do the search and if it fails low, you do nothing anyway, just as always, if it fails high, you still do nothing since you can't back up the null-move as best under any circumstance. But I have not seen any other example of where treating PV / non-PV nodes differently is sound.

The most often-quoted answer is "it seems to work." (for some, although many of us have tested it and found it to be worse). Just because something works is NOT a good reason to use the idea unless the idea has a rational justification. I've had plenty of bugs where fixing them actually hurt performance, but I was not going to leave the bugs in because they were bugs. My approach has always been "if it is theoretically sound but doesn't work, figure out why and fix it" or "if it is theoretically unsound but does work, figure out why and fix it." I don't like witchcraft/superstition solutions.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: LMP in PV nodes

Post by Evert »

bob wrote: The only viable exception to the PV vs non-PV node treatment is with null-move search, since doing a null-move at a PV node doesn't help, as a null-move is not legal and can not be propagated back to the root.
That was my initial thinking as well, but I'm not convinced anymore that it makes sense: suppose you do include a null-move search in the PV. If the null-move fails high, then you take the cut-off, which (eventually) triggers a re-search with a larger window to keep the null-move in window. If it doesn't fail high, you just search the remaining moves as normal. At no point do you get a null-move in the PV at the end of an iteration (you might get it for an intermediate result, but that's not necessarily a problem although it might look a bit odd if you display that to the user). Am I missing something?

What would not surprise me is if a null move is simply a waste of time in a PV node, but I haven't tested this in any way. Of course, one could do something with the information from the null-move search (change move-ordering, or threat extensions) and those may help. Again, not something I've tried at (expected) PV nodes.
jdart
Posts: 4367
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: LMP in PV nodes

Post by jdart »

The PV descendant of a non-PV node is just the most plausible refutation of the previous move. The logic applied there is no different than the logic at the root. You may choose to treat the most plausible move differently from others.

--Jon
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: LMP in PV nodes

Post by bob »

jdart wrote:The PV descendant of a non-PV node is just the most plausible refutation of the previous move. The logic applied there is no different than the logic at the root. You may choose to treat the most plausible move differently from others.

--Jon
Lost me completely. A node is PV or it is not. It can change with no warning (non-PV to PV). Almost everybody treats "the most plausible move" differently, since I have not seen anyone that reduces or prunes the first move out of any node...

But back to the question, why would you reduce/prune differently based on the simple criterion of "alpha != beta - 1"??? Not to mention the inconsistencies this causes. When you do fail high, the re-search is done with different reductions/pruning rules than the original fail-high, for example.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: LMP in PV nodes

Post by bob »

Evert wrote:
bob wrote: The only viable exception to the PV vs non-PV node treatment is with null-move search, since doing a null-move at a PV node doesn't help, as a null-move is not legal and can not be propagated back to the root.
That was my initial thinking as well, but I'm not convinced anymore that it makes sense: suppose you do include a null-move search in the PV. If the null-move fails high, then you take the cut-off, which (eventually) triggers a re-search with a larger window to keep the null-move in window. If it doesn't fail high, you just search the remaining moves as normal. At no point do you get a null-move in the PV at the end of an iteration (you might get it for an intermediate result, but that's not necessarily a problem although it might look a bit odd if you display that to the user). Am I missing something?

What would not surprise me is if a null move is simply a waste of time in a PV node, but I haven't tested this in any way. Of course, one could do something with the information from the null-move search (change move-ordering, or threat extensions) and those may help. Again, not something I've tried at (expected) PV nodes.
You would have to special-case it. But I ran millions of test positions and in general, null-move everywhere increased the overall tree-size measurably. These were fixed-depth searches so that nodes could be compared. This is not a significant issue in terms of Elo, but it has a measurable effect.
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: LMP in PV nodes

Post by Michel »

The PV descendant of a non-PV node is just the most plausible refutation of the previous move. The logic applied there is no different than the logic at the root. You may choose to treat the most plausible move differently from others.
What I am trying to say is that the (potential) PV descendant node _is_ different since you are now in a research (the scout search for the parent non-PV move failed high). So you may choose to do the research with less pruning to validate the fail high.

What I am saying is really "theoretically correct" (see my first post in this thread)! Not pruning in PV nodes may compensate for more aggressive pruning in non PV nodes through the PVS mechanism in such a way that the tree value does not change.

Since researches take time, in reality it is a trade off.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: LMP in PV nodes

Post by syzygy »

lucasart wrote:
Bloodbane wrote:This might be a stupid question, but how could LMP even be theoretically correct at PV-nodes? The point of LMP is to reduce the time spent at ALL-nodes, and PV-nodes are not ALL-nodes so I do not see how there would be any sense in applying it there. Or is it the fact that a PV-node can turn into an ALL-node in some cases?
LMP is theoretically incorrect, whether you do it at PV, Cut, All, or random nodes.
It is theoretically correct if you do it at the "cut nodes" of a verification subtree (i.e. of a null-window search). (Using Michel's definition of cut nodes, which is the only one that makes sense in the context of PVS.)

The idea of PVS is that in a PV node, the first move searched is likely to be the best move. All other moves are therefore searched only to verify that they are worse. Assume white is to move in the PV node. When searching the 2nd, 3rd etc. moves of white, all PVS needs to do is to verify that white can't do better than alpha / that black can do better. This is what the null-window search does. When doing this verification, it is completely safe to search only a subset of black's moves.

If the verification succeeds, we know that white can't do better than alpha if black is only allowed to play a subset of moves. GIving black its full set of moves obviously can only make things even worse for white. So the verification result is correct.

If the verification fails, we only know that white might do better than alpha if black is given its full set of moves. We haven't checked yet against all of black's moves, so we aren't sure, but the re-search will take care of this.

As Michel explained, this is a trade-off between faster verification searches and more re-searches.

Clearly when doing PVS there are many fundamental differences between PV nodes, cut nodes and all nodes.

(I'm not saying that LMP does not work in other types of nodes where it is unsafe unless corrected for at later iterations.)