MutliPV behavior?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

MutliPV behavior?

Post by Ovyron »

Back in the times of Rybka 3, the best behavior for MultiPV was very clear, and standard among the engines that implemented it:

-If the move fails low, sit tight, and resolve it.

Eventually, more and more engines started to check all alternative moves on a fail low, and would move one as best if they found it was better, with the best move just disappearing not allowing the user to know what happened to it, sometimes only to resurface later, again, as best, if a fail high after the fail low happened.

I have also seen the engine just switching moves on losing positions that keep failing and never giving a score to them until later which seems to lose time.

This behavior might be the best for finding the best move ASAP, in games (after all, it must bring elo or programmers wouldn't have switched to it), but in analysis, with the purpose of MultiPV being to give the user a list of the best moves and their scores to the user, I think this is suboptimal.

I even suggested Vas to implement the "Always score main move" feature to Rybka, so that it would behave like this ("sit tight" on fail lows), and it has survived up to Fritz 16.

What do you think? Is this new behavior as bad as it sounds? Or is it actually better and only gives the illusion of being bad? (since it's best at SinglePV, maybe it also finds best moves faster for alternative line, but looks sloppy.)
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: MutliPV behavior?

Post by elcabesa »

I don't understand what you mean by "more and more engine",
My engine and stockfish resolve the fail low/high before moving to any other move when analizyng in multiPV mode.

what is your experience?
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: MutliPV behavior?

Post by Ovyron »

elcabesa wrote: stockfish resolve the fail low/high before moving to any other move when analizyng in multiPV mode.
No, it doesn't, you can check on the part of the GUI that shows what move is being analysed, like this:

#/*

Where * is the total number of moves, and # is the number of the move being analyzed.

For a position with 30 available moves, when Stockfish is starting the iteration, it reads:

1/30

Now, pay attention, and you may see the 1 quickly cycling through 2-30. If you stop the engine at that time, Stockfish will show the fail low. If any of the moves 2-30 are better, Stockfish will silently switch to it, and it will appear as new best (i.e. it becomes the 1/30 move.)

Stockfish just hides the fail low on MultiPV, so the user doesn't even know it happened on the output.

All Stockfish derivatives behave like this.
AndrewGrant
Posts: 1750
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: MutliPV behavior?

Post by AndrewGrant »

I can tell you from SF source every search is resolved. If you stop the search midway, then what you are seeing is not SF failing to resolve something.

You are seeing SF print partial results

https://github.com/official-stockfish/S ... h.cpp#L401
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: MutliPV behavior?

Post by elcabesa »

what you see are intermediate results.


Stocksfish search the first best result and you'll see the counter going from 1 to 30,
then it search the second best move and you'll see the counter going from 2 to 30,
then it search the third best move and you'll see the counter going from 3 to 30,

and so on ....
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: MutliPV behavior?

Post by Ovyron »

elcabesa wrote:what you see are intermediate results.
That's not what I'm seeing, Stockfish is doing the "2 to 30" thing before assigning the main move a score, and it's always on fail low.

It's weird that we can't agree on how it behaves, do I really have to make a video about what I see?

Try to do this:

Let Stockfish reach depth 29, so the "2 to 30" isn't as fast.

If at depth 30 Stockfish just outputs a score for the first move, it did't fail low, try again with some other position.

Now, if it does, stop the engine in the middle of "2 to 30", Stockfish would show the fail now.

Note that this would be impossible if the "2 to 30" happened after Stockfish already gave a score to the first move, and it wouldn't show a fail low because it already knows the first move's score.

Please, instead of looking at the code and telling me this is impossible, try it for yourself, I managed to reproduce it first try.
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: MutliPV behavior?

Post by elcabesa »

please, show us what do you mean because we haven't understood.

give us a reproducible example, with reproducible step and maybe some screenshot of what you thins is worng.

thank you
AndrewGrant
Posts: 1750
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: MutliPV behavior?

Post by AndrewGrant »

If you are stopping Stockfish in the middle of an iteration, you are most certainly seeing intermediate results, which are reported here

https://github.com/official-stockfish/S ... h.cpp#L401

You are either seeing partial results because SF reports the fail highs/lows when 3 seconds have passed, OR you are seeing a partial result because stopping the search has set Threads.stop to be true.

If you delete the time condition and the Threads.stop condition you will no longer see the behavior you are seeing.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: MutliPV behavior?

Post by abulmo2 »

Not sure to understand. Is that what you want: when a new iteration is started, always display the score of the previous best move, even if it is no more the best move, or in case of multiPV search, one of the k-best moves ?
Richard Delorme
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: MutliPV behavior?

Post by Ovyron »

elcabesa wrote:give us a reproducible example, with reproducible step and maybe some screenshot of what you thins is worng.
Did you try the steps I posted? What did you see?

It's useles for me to post reproducible example with reproducible step if people aren't even trying...

IN MULTIPV STOCKFISH IS CHECKING ALTERNATIVE MOVES BEFORE GIVING A SCORE TO THE MAIN MOVE IN FAIL LOWS

Please, try it in some position and tell me you see differently.