Page 1 of 2

Is expensive eval required for QS?

Posted: Fri Jul 21, 2017 11:10 am
by brtzsnr
The goal of QS as I understand is to resolve immediate threats. For Zurichess I don't even test if the position is in check.

In a recent test I noticed that a very expensive eval and a very simple eval many times result in the same sequence of moves in QS.

Has anyone tried something like this:
* Do QS with a very simple eval, e.g. material counting.
* Find the sequence of moves that make the position quiet.
* Reply the moves and reevaluate with the expensive eval.

Not only that a simple eval can be updated incrementally, but prunnings are also much easier to reason with only material counting.

What do you think? Has anyone experimented with this idea?

Re: Is expensive eval required for QS?

Posted: Fri Jul 21, 2017 1:22 pm
by hgm
For capture sequences that gain material compared to the PV score, lazy eval is usually enough to guarantee the stand-pat cutoff. Full evaluation would only be needed when you end very close in score to the PV. But I don't see how you could do without it, in that case. The capture sequence that you selected with the simple eval might not be the one that you selected with the full eval, if there are multiple QS leaves ending close to the PV. And the eval difference could decide on whether this line will become the new PV or not.

E.g. you might have the choice to stand pat or trade your Bishop for a Knight, and the lazy eval might favor keeping the Bishop. But the Knight might have been very detrimental to your King safety, so that the BxN would actually save the day. But you will take the full evaluation with the Knight still there, if you don't redo the entire QS with the full evaluation.

Re: Is expensive eval required for QS?

Posted: Fri Jul 21, 2017 3:18 pm
by jdart
I used to do lazy eval. You can for example do a lazy eval first for the stand-pat test and cut off if it exceeds in value beta + some margin. But there are several problems with this. First, at least for me, some complex eval terms such as king safety can be sizeable in value. Second, I save evals (currently in the hash table, but formerly in a separate eval cache). This is more complex/less efficient if you have full and partial evals.

--Jon

Re: Is expensive eval required for QS?

Posted: Fri Jul 21, 2017 3:35 pm
by hgm
An alternative is not to just discard the complex terms, but freeze them as soon as you enter QS. This can lead to inconsistencies when you reach the same position through different QS, and get its hashed score, but that is not very harmful (if at all). I once tried to freeze the piece mobilities to their pre-QS values in micro-Max, where they are cheaply obtained as a side effect of move generation in the position itself and its null-move reply ('static mobility'). The mobility bonuses were then made part of the piece values at the start of QS. This was not very successful, but I had never proven that the same mobility term fully applied would be beneficial at fixed nodes, so it could very well have been a mis-tuning of the term to begin with.

Re: Is expensive eval required for QS?

Posted: Sat Jul 22, 2017 7:04 pm
by PK
Actually exchanges, especially near-equal exchanges, are the most important decisions in the game. You don't want to make them half-informed.

Just imagine what happens when evaluation depends chiefly on attack prospects, because Your program sacrificed two pawns, and material-only quiescence search exchanges queens. Or if you hold the endgame when you exchange one piece pair, but lose it when you exchange another.

Re: Is expensive eval required for QS?

Posted: Sun Jul 23, 2017 11:56 pm
by Ras
brtzsnr wrote:Has anyone experimented with this idea?
QS needs the full eval because you can get positional advantage by trading. Just think of a minor piece trade that leaves the other side with an isolated double pawn on a semi-open file.

However, I maintain a "last valid eval" structure which holds the eval from the move before and gives an orientation what the position is supposed to be.

Now in the middlegame, if the material plus mobility part of the eval shows at least 200 centipawns above or below the last valid eval, then either the opponent has blundered - or much more probable, this is in a branch that will be cut off anyway, so I skip the other positional aspects and return the value as is.

The endgame is quite different because advanced passed pawns can be important, so I do that lazy eval only in the middlegame.

Re: Is expensive eval required for QS?

Posted: Mon Jul 24, 2017 9:06 am
by Rebel
brtzsnr wrote:The goal of QS as I understand is to resolve immediate threats.
Addition to the above:

in order to have an accurate evaluation of the position.

And herein lies the answer to your question.

Re: Is expensive eval required for QS?

Posted: Mon Jul 24, 2017 9:06 am
by Henk
Lately Skipper does nothing (only counting material) in QS for it hurts speed. But play did not improve.

Everything you add to QS may easily create a speed bottleneck if it is slower than collecting captures.

Lazy eval did not help much too.

Re: Is expensive eval required for QS?

Posted: Mon Jul 24, 2017 11:38 am
by Uri Blass
Henk wrote:Lately Skipper does nothing (only counting material) in QS for it hurts speed. But play did not improve.

Everything you add to QS may easily create a speed bottleneck if it is slower than collecting captures.

Lazy eval did not help much too.
I think that you care too much about speed.

Skipped is not going to be a top program even if you make it 100 times faster.
It is a mistake even to think about speed at the level of skipper.

Re: Is expensive eval required for QS?

Posted: Mon Jul 24, 2017 11:47 pm
by Sven
Henk wrote:Lately Skipper does nothing (only counting material) in QS for it hurts speed. But play did not improve.

Everything you add to QS may easily create a speed bottleneck if it is slower than collecting captures.

Lazy eval did not help much too.
QS is exactly the place where the expensive eval is required. It is where the leaf nodes are, where one of them carries the final score that will be propagated to the root. Otherwise the engine will lack some positional abilities, e.g. by missing positional sacrifices like giving the exchange vs. a pawn plus an unsafe enemy king, or by missing positional trades of bishop vs. knight or vice versa. If you evaluate at full-width leaves only then the engine will play very weak.

Of course you may choose to use a very minimal evaluation everywhere (e.g. material + PST). But do not skip positional evaluation in QS just because it is QS. If BxN PxB is positionally better than standing pat then trading is the PV.