multi PV mode

Discussion of anything and everything relating to chess playing software and machines.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Leo
Posts: 843
Joined: Fri Sep 16, 2016 4:55 pm
Location: USA/Minnesota
Full name: Leo

multi PV mode

Post by Leo » Thu Mar 07, 2019 1:15 am

Will Multi PV mode set at 2 or more help a chess engine? What does multi PV mean?
Advanced Micro Devices fan.

adams161
Posts: 527
Joined: Sun May 13, 2007 7:55 pm
Location: Tacoma, WA USA

Re: multi PV mode

Post by adams161 » Thu Mar 07, 2019 1:34 am

A PV is a Principal Variation. Engine may search depth 20 and return a score of +1.00 i.e. i'm one pawn up and the moves that it found that got that score are something like Nf3 Nc6 d5 Qxd3 etc.

Multi PV says Ok I got your PV and I know you found the best move to be in this example Nf3 but if you could not play Nf3, lets say we threw the move out of the possible moves, what's your second best move and the score for that. And you can keep doing this and get a 3 lines or 4 lines PV etc just eliminating the earlier best moves reached from the search for the next PV.

Score of course goes down with second and third best moves as the best scores are the first moves tried or firsst PV's and very first PV is best score.

Multi PV is useful to get a feel for what are the good moves in a position. In some positions it's pretty clear like a recapture there may only be one good move and anything else is a blunder. But in other positions, second and third best moves may score close together with the first so it can be worth knowing about them rather than just thinking, "well it says Nf3 is the best move, that must be all that's played".

Multi PV wont speed up the engine or get it to go deeper on the best move. All that other searching actually slows it down a little as its computing for more lines at once rather than if the user just had it focus on one line.

Leo
Posts: 843
Joined: Fri Sep 16, 2016 4:55 pm
Location: USA/Minnesota
Full name: Leo

Re: multi PV mode

Post by Leo » Thu Mar 07, 2019 2:00 am

Thanks. Much appreciated. Very helpful. I read that Multi PV helps LCO.
Advanced Micro Devices fan.

Geonerd
Posts: 66
Joined: Fri Mar 10, 2017 12:44 am

Re: multi PV mode

Post by Geonerd » Thu Mar 07, 2019 4:05 am

I'm not 100% sure this is happening, but it seems that setting MultiPV to N causes the engine to search all N first moves to a more or less equal depth. This short-circuits the engine's finely tuned pruning parameters and theoretically weakens the engine slightly. But the engine is also significantly more likely to find 'difficult' or puzzle-like moves when running in MPV mode. Try some of the offbeat puzzles/positions posted here with and w/o MPV and see what happens!

lkaufman
Posts: 3754
Joined: Sun Jan 10, 2010 5:15 am
Location: Maryland USA
Contact:

Re: multi PV mode

Post by lkaufman » Thu Mar 07, 2019 5:08 am

For all normal engines, multiPV hurts the strength more than "slightly". Some tests I ran indicate that looking at just two moves costs normal Komodo about a hundred elo, and looking at four about another hundred elo. Stockfish may not lose quite as much, but still a huge amount. Lc0 and Komodo MCTS don't lose any strength in multiPV mode, because they basically do the calculations of all the moves anyway. If you use Komodo, even with multiPV as low as 2 the MCTS version is stronger.
Komodo rules!

adams161
Posts: 527
Joined: Sun May 13, 2007 7:55 pm
Location: Tacoma, WA USA

Re: multi PV mode

Post by adams161 » Thu Mar 07, 2019 10:42 am

Classical chess engines like Stockfish or Komodo use Alpha Beta search/pruning. This means rather than do straight min max they prune or cut parts of the tree that are second best to the best move and do not return a true score for the second best move. This means After a single search the score is only known for the best move.

So how do you get the second best score? Well lets say your in some position, not opening a little later, with 15 possible moves. The best move is Nf3. To calculate the second best move what they do is call a search that never plays Nf3. The first iteration of search iterates over 14 possible moves, no Nf3. So whatever the best move of those 14 moves is known but not the second best.

And this goes on with each multi PV. But It's not that different with Multi-PV of 4 as if you called it to search four different things splitting the cpu power by 25% for each line. Perhaps there are some efficiencies as well with optimizing the searches to create less drag.

This is why in playing programs Mutli PV always creates a lower rating. But in analysis it just means you got to run it a bit longer to get the same depths.

User avatar
Mike S.
Posts: 1480
Joined: Thu Mar 09, 2006 4:33 am

Re: multi PV mode

Post by Mike S. » Thu Mar 07, 2019 12:09 pm

Geonerd wrote:
Thu Mar 07, 2019 4:05 am
Try some of the offbeat puzzles/positions posted here with and w/o MPV and see what happens!
Yes, that is a common observation and it is logical. Also, while kibitzing with an engine Multi-PV(2) is very useful to spot forced moves quickly, where the unguided eye may miss the sharpness of the position. The speed with this setting is better than half of single-pv. For calm positional situations, 3 or 4 variations can be useful to see different ideas without a too big slowdown.

But for engine vs. engine competiton, I guess multi-pv is never an improvement, at least not for A-B engines. Or maybe for some which do too radical pruning, but if that is a problem it should be fixed internally.
Regards, Mike

Geonerd
Posts: 66
Joined: Fri Mar 10, 2017 12:44 am

Re: multi PV mode

Post by Geonerd » Thu Mar 07, 2019 6:10 pm

Larry, anyone.
Halving the cpu resources should cost the typical engine somewhere around 20(?) elo? Yet MPV =2 kills ~100 points. Why is the MPV performance hit so high? (A simple question with - I suspect - a complex answer! :roll: )

lkaufman
Posts: 3754
Joined: Sun Jan 10, 2010 5:15 am
Location: Maryland USA
Contact:

Re: multi PV mode

Post by lkaufman » Thu Mar 07, 2019 9:17 pm

Geonerd wrote:
Thu Mar 07, 2019 6:10 pm
Larry, anyone.
Halving the cpu resources should cost the typical engine somewhere around 20(?) elo? Yet MPV =2 kills ~100 points. Why is the MPV performance hit so high? (A simple question with - I suspect - a complex answer! :roll: )
Well, 20 elo for a doubling might be close for 3 hour games on 44 threads, although even for that I would think 30 is more realistic. But I'm talking about single thread blitz ratings such as CCRL or CEGT, where I think doubling is more like 80 elo or so (I haven't checked this in a long time though). We could tell by comparing four threads to one thread ratings, and assuming that four threads is equal to a tripling of time, which is close enough to the truth to use. The log of 3 divided by log of 4 is about .793, so multiplying the average four thread to one thread rating gap on CEGT would tell us the answer (CCRL uses bayeselo, which is not appropriate for this purpose). 100 elo does sound a bit high for this, maybe I ran at a somewhat faster tc, I can't remember now. I think Komodo tends to scale well, meaning that doubling is worth more than average for it.
Komodo rules!

Post Reply