Is expensive eval required for QS?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 4:02 pm

Is expensive eval required for QS?

Post 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?
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Is expensive eval required for QS?

Post 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.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Is expensive eval required for QS?

Post 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
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Is expensive eval required for QS?

Post 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.
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Is expensive eval required for QS?

Post 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.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Is expensive eval required for QS?

Post 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.
User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Re: Is expensive eval required for QS?

Post 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.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Is expensive eval required for QS?

Post 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.
Uri Blass
Posts: 10280
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Is expensive eval required for QS?

Post 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.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Is expensive eval required for QS?

Post 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.