Stockfish SEE (and in general SEE related question)

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

gladius
Posts: 568
Joined: Tue Dec 12, 2006 10:10 am
Full name: Gary Linscott

Stockfish SEE (and in general SEE related question)

Post by gladius »

Stockfish's SEE weights bishops higher than knights, so in a position like [D]r1bqkb1r/pppppppp/2n2n2/6B1/3P4/8/PPP1PPPP/RN1QKBNR w KQk[/D], it won't play Bxf6 in the q-search, as it's pruned as a "losing" capture.

It's an interesting question to debate, but my guess is this would end up hurting strength. What do other folks out there do? Myself, I weight bishops and knights the same (for simplicity reasons mainly - not because I thought about it beforehand :)).
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish SEE (and in general SEE related question)

Post by mcostalba »

gladius wrote: It's an interesting question to debate, but my guess is this would end up hurting strength.
My guess is it doesn't :-)

Ok, is not only a guess actually we have tested with real piece values and with simplified piece values (1, 3, 3, 5, 9) and at the end, perhaps unexpectedly (for me it was) it turned out with real values is stronger.
gladius
Posts: 568
Joined: Tue Dec 12, 2006 10:10 am
Full name: Gary Linscott

Re: Stockfish SEE (and in general SEE related question)

Post by gladius »

mcostalba wrote:Ok, is not only a guess actually we have tested with real piece values and with simplified piece values (1, 3, 3, 5, 9) and at the end, perhaps unexpectedly (for me it was) it turned out with real values is stronger.
That is quite interesting! Thanks for the data :).

I wonder if it's a side effect of the bishop pair. In the majority of cases, capturing knight with a bishop breaking the b. pair is bad. But, not searching the lines in q. search from bishop takes defended knight seems like it would lead to incorrect evaluations. I guess overall it ends up hurting though.

Or maybe it's a sign that some bishop terms are not weighted highly enough? If not pursuing the capture in q-search scores better, perhaps the same effect could be had by making the bishop worth slighty more, and trying the capture.

Another thought is to only consider it losing when it breaks the bishop pair.

Ah, so many ideas, so little time.

Anyhow, congrats on another great release :).
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish SEE (and in general SEE related question)

Post by mcostalba »

gladius wrote: Ah, so many ideas, so little time.
Yes, I know VERY well what you mean :-)

Here is my opinion (just an opinion).

The role of qsearch is NOT to find the best position or the best move.

Looking at the diagram you posted you said here in qsearch the engine discard BXN capture, and this looks strange.

But why looks strange?

Looks strange because when we, as humans, look at a diagram we always look at it (also if not conscious) from a PV point of view, i.e. we try to find the best move or the best confutation given a chess diagram. This human bias toward thinking always in term of principal variation can lead to misleadings when applied to chess engines.

If you do a little statistic you will see that 99% of qsearch calls are made from side branches, not from PV. And the logic from side branches is completely different and far from how humans look at a diagram.

The logic is that of the confutation. The job of side branches is _only_ to find a possible confutation to an _already exsistent_ PV and find it _as fast as it can_. The goal of search is NOT to find the best move, but to QUICKLY demonstrate that the already found best move (found by PV search) is actually not the real best move.

qsearch has much more to do with side branches then with PV and to understand an algorithm used in qsearch it is useful (for me it is) to start to look at it from the point of view of a side branch, not of a PV node.

So filtering out BXN is of course faster then considering it so that at the end you have a qsearch that discards BXN but is faster or a qsearch that includes BXN but is a bit slower: testing seems to show that speed is more important in this case. And my guess is that is more important _only_ because we are talking about side branches most of the time.
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: Stockfish SEE (and in general SEE related question)

Post by BubbaTough »

hmm..

Your explanation seems to imply it might be a good idea to have a different qsearch/see for pv vs. nonpv.

Anyway, if you are using SEE to do move order stuff, and it considers BxN as a bad capture, does that mean you are looking at such moves last? It would surprise me if that was a good idea. If that is what you are doing, might want to look into doing things differently when you are doing move ordering instead of qsearch pruning.

-Sam
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Stockfish SEE (and in general SEE related question)

Post by hgm »

This sounds very strange, as the true value of a single Bishop is exactly equal to that of a Knight. It is only the pair bonus that gives the first Bishop a higher marginal value. So it seems to me that this heuritic must hurt you at least during part of the game.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish SEE (and in general SEE related question)

Post by mcostalba »

BubbaTough wrote:hmm..

Your explanation seems to imply it might be a good idea to have a different qsearch/see for pv vs. nonpv.
We haven't experimented with that, so I cannot say anything about.

BubbaTough wrote: Anyway, if you are using SEE to do move order stuff, and it considers BxN as a bad capture, does that mean you are looking at such moves last? It would surprise me if that was a good idea. If that is what you are doing, might want to look into doing things differently when you are doing move ordering instead of qsearch pruning.
This is the same case of having 2 SEE, I haven't experimented. The only thing I can say is: Yes, BXN are considered among bad captures also in move ordering.

I don't know if splitting the SEE in two: SEE_qsearch and SEE_pv can give some gain here....
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Stockfish SEE (and in general SEE related question)

Post by Dann Corbit »

hgm wrote:This sounds very strange, as the true value of a single Bishop is exactly equal to that of a Knight. It is only the pair bonus that gives the first Bishop a higher marginal value. So it seems to me that this heuritic must hurt you at least during part of the game.
The true value of a bishop and the true value of a knight are never identical.

A bishop can be behind a pawn wall and totally worthless.

A knight can have a strong forward outpost near the enemy king and have a value approximately equal to a rook.

It is also possible for a bishop to be worth much more than a knight.

The true value of chessmen (when the chessmen are not identical) is best determined by a material imbalance table, together with board position, pawn formations and other important factors.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Stockfish SEE (and in general SEE related question)

Post by bob »

gladius wrote:Stockfish's SEE weights bishops higher than knights, so in a position like [D]r1bqkb1r/pppppppp/2n2n2/6B1/3P4/8/PPP1PPPP/RN1QKBNR w KQk[/D], it won't play Bxf6 in the q-search, as it's pruned as a "losing" capture.

It's an interesting question to debate, but my guess is this would end up hurting strength. What do other folks out there do? Myself, I weight bishops and knights the same (for simplicity reasons mainly - not because I thought about it beforehand :)).
I would agree. In my SEE, B and N are identical in value, and in fact, are worth exactly 3 pawns, so that SEE trading a B for 3 pawns is considered an even trade and I let the search/evaluation decide whether it is really good or not. Ditto for BxN. This move is not always bad, and depending on the position, it is quite good. I'd rather let the search sort that out.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Stockfish SEE (and in general SEE related question)

Post by bob »

mcostalba wrote:
gladius wrote: It's an interesting question to debate, but my guess is this would end up hurting strength.
My guess is it doesn't :-)

Ok, is not only a guess actually we have tested with real piece values and with simplified piece values (1, 3, 3, 5, 9) and at the end, perhaps unexpectedly (for me it was) it turned out with real values is stronger.
My testing was exactly the opposite. Not a _big_ difference, but a difference. I once had accidentally done this same thing, where the B vs N material values were different. When I tested using normal 1, 3, 3, 5, 9 values, it was 3-4 Elo better.

YMMV of course.