Stockfish NNUE Questions

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

Moderators: hgm, Rebel, chrisw

Stephen Ham
Posts: 2488
Joined: Wed Mar 08, 2006 9:40 pm
Location: Eden Prairie, Minnesota
Full name: Stephen Ham

Stockfish NNUE Questions

Post by Stephen Ham »

Hello All,

Question #1:
In an earlier thread today, a member wrote that Stockfish NNUE switches to classical Stockfish (SF) when the evaluation exceeds 2.50. I wondered where that threshold was, so thank you! Regardless, alpha-beta engines are superior in endgames while NN engines have performed poorly there. So, does that mean that SF NNUE will continue to use NN play into endgames as long as the evaluation threshold remains below 2.50? Hopefully the engine is instead coded to switch to classical SF when an endgame is reached, perhaps defined by a preset number of pieces/pawns on the board.

Question #2: The abrok website provides development upgrades for specific PCs. My PC is a AMD Ryzen 9 3900X 12-core, 3.80 GHz, on Windows 10. So, which of the below abrok PC options should I upgrade to for maximum performance? To date, I've always just selected the modern computers option.

Windows x64 for modern computers + AVX2
Windows x64 for modern computers
Windows x64 + SSSE3

Thanks in advance for educating me.

Sincerely,
-Steve-
Werewolf
Posts: 1796
Joined: Thu Sep 18, 2008 10:24 pm

Re: Stockfish NNUE Questions

Post by Werewolf »

Stephen Ham wrote: Fri Aug 14, 2020 11:11 pm Hello All,

Question #1:
In an earlier thread today, a member wrote that Stockfish NNUE switches to classical Stockfish (SF) when the evaluation exceeds 2.50. I wondered where that threshold was, so thank you! Regardless, alpha-beta engines are superior in endgames while NN engines have performed poorly there. So, does that mean that SF NNUE will continue to use NN play into endgames as long as the evaluation threshold remains below 2.50? Hopefully the engine is instead coded to switch to classical SF when an endgame is reached, perhaps defined by a preset number of pieces/pawns on the board.

So just on your first question, unless I'm really getting this wrong SF NNUE is an alpha-beta all the time. The alpha-beta part is the search method.

What changes at 2.5 pawns is the evaluation function.
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: Stockfish NNUE Questions

Post by syzygy »

Werewolf wrote: Fri Aug 14, 2020 11:31 pm
Stephen Ham wrote: Fri Aug 14, 2020 11:11 pm Hello All,

Question #1:
In an earlier thread today, a member wrote that Stockfish NNUE switches to classical Stockfish (SF) when the evaluation exceeds 2.50. I wondered where that threshold was, so thank you! Regardless, alpha-beta engines are superior in endgames while NN engines have performed poorly there. So, does that mean that SF NNUE will continue to use NN play into endgames as long as the evaluation threshold remains below 2.50? Hopefully the engine is instead coded to switch to classical SF when an endgame is reached, perhaps defined by a preset number of pieces/pawns on the board.

So just on your first question, unless I'm really getting this wrong SF NNUE is an alpha-beta all the time. The alpha-beta part is the search method.

What changes at 2.5 pawns is the evaluation function.
Indeed. As far as I know, it's not so much that Lc0's evaluation is bad in the endgame. It's more that Lc0's search cannot compete with SF's deep search in positions where that deep search suffices to solve the position.
Stephen Ham
Posts: 2488
Joined: Wed Mar 08, 2006 9:40 pm
Location: Eden Prairie, Minnesota
Full name: Stephen Ham

Re: Stockfish NNUE Questions

Post by Stephen Ham »

Thank you, gentlemen! That's good to know.

Anyone have any input on Question #2? Although I'm an ICCF GM, I'm a computer dummy. So, I value what I can learn from you experts at this website.

And since I'm showing my computer ignorance here, please allow a third question, which I hope isn't too stupid.
Question #3:
It's my understanding that SF NNUE test nets are developed from self-play. In short, it's SF playing against itself. But that seems one-dimensional as the nets then only get really proficient at defeating SF. Why not also train the nets against Leela and other top NN engines? Learning how to defeat them too should produce the all-around strongest engine, rather than one that's just great at defeating SF. Am I missing something?

Thanks in advance.

All the best,
-Steve-
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: Stockfish NNUE Questions

Post by phhnguyen »

Stephen Ham wrote: Sat Aug 15, 2020 12:27 am Thank you, gentlemen! That's good to know.

Anyone have any input on Question #2? Although I'm an ICCF GM, I'm a computer dummy. So, I value what I can learn from you experts at this website.
I don't have a computer similar to yours, thus I don't know which one is the best performance. However, I know the solution ;) you may do yourselve and post the result here to help other people:
- Download all (3) those binaries
- Download the default net from Fishtest and store with those binaries
- Run benchmark for all binaries, for example:

Code: Select all

stockfish.exe bench 16 1 13 default depth NNUE
Delete any crashed one and compare their results, keep the best one. You may run several times to confirm results. I guest all take about 10 minutes :D
Stephen Ham wrote: Sat Aug 15, 2020 12:27 am And since I'm showing my computer ignorance here, please allow a third question, which I hope isn't too stupid.
Question #3:
It's my understanding that SF NNUE test nets are developed from self-play. In short, it's SF playing against itself. But that seems one-dimensional as the nets then only get really proficient at defeating SF. Why not also train the nets against Leela and other top NN engines? Learning how to defeat them too should produce the all-around strongest engine, rather than one that's just great at defeating SF. Am I missing something?

Thanks in advance.

All the best,
-Steve-
As far as I know, NNUE evaluation is trained to replace and improve the clasical one. It is not trained to win other engines. The high optimisation of SF search function as well as hybrid mode makes that way can work smothly but it may not work with too-much-different evaluation.
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
corres
Posts: 3657
Joined: Wed Nov 18, 2015 11:41 am
Location: hungary

Re: Stockfish NNUE Questions

Post by corres »

I have a Ryzen 9 3950x CPU and I found the most faster SF+NNUE binary (.exe) is the AVX2 optimized one.
It is faster about +20 % than the popc.
But the proposed test will decide the question.
Stephen Ham
Posts: 2488
Joined: Wed Mar 08, 2006 9:40 pm
Location: Eden Prairie, Minnesota
Full name: Stephen Ham

Re: Stockfish NNUE Questions

Post by Stephen Ham »

Thank you gentlemen for your informed thoughts and suggestions.

All the best,
-Steve-
Modern Times
Posts: 3546
Joined: Thu Jun 07, 2012 11:02 pm

Re: Stockfish NNUE Questions

Post by Modern Times »

corres wrote: Sat Aug 15, 2020 11:43 pm I have a Ryzen 9 3950x CPU and I found the most faster SF+NNUE binary (.exe) is the AVX2 optimized one.
Yes, same with my Ryzen 7 laptop,
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Stockfish NNUE Questions

Post by zullil »

Modern Times wrote: Sun Aug 16, 2020 9:57 pm
corres wrote: Sat Aug 15, 2020 11:43 pm I have a Ryzen 9 3950x CPU and I found the most faster SF+NNUE binary (.exe) is the AVX2 optimized one.
Yes, same with my Ryzen 7 laptop,
I suppose this is because the bmi2 binaries include the PEXT instruction, which is very slow on Ryzen?
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Stockfish NNUE Questions

Post by Dann Corbit »

Yes, you can look at Ipman's chess site, and he has lots of samples where the modern compile smokes the PEXT builds on modern AMD stuff. They emulated PEXT in software and did a bad job of it. It's not really a hardware instruction, even though they call it one
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.