Mayhem NNUE - New NN engine

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

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
JohnWoe
Posts: 346
Joined: Sat Mar 02, 2013 10:31 pm

Mayhem NNUE - New NN engine

Post by JohnWoe » Thu Oct 22, 2020 9:40 pm

Yes I copy pasted the NNUE from here and there. And what a difference does a good evaluation make. It completely annihilates Sapeli 1.92 Standard/Chess960 games!

Mayhem is Sapeli written in C++14 + SF NNUE evaluation. Thanks to Maksim simplifying off DirtyPiece/etc crap!
Release: https://github.com/SamuraiDangyo/mayhem ... /tag/v0.42
Contains a fast Linux binary.

At least +350 Elo stronger than Sapeli 1.92. This proves that handcrafted evaluations are all crap.

Code: Select all

5s
Score of Mayhem 0.42 NNUE vs Sapeli 1.92: 64 - 5 - 9  [0.878] 78
Elo difference: 343.19 +/- 109.68
Finished match

Score of Mayhem NNUE 0.42 vs Sapeli 1.92: 75 - 13 - 12  [0.810] 100
Elo difference: 251.89 +/- 80.80
Finished match

20s
Score of Mayhem NNUE 0.42 vs Sapeli 1.92: 7 - 1 - 2  [0.800] 10
Elo difference: 240.82 +/- nan
Finished match
I played a few test games on lichess. Mayhem annihilates sachy2 totally! 7½-½. Despite massive lag: https://lichess.org/k6wbI1sF

Mayhem NNUE nice analysis. Look how consistend 1. d4 is!

Code: Select all

info depth 1 nodes 40 time 1 nps 20000 score cp 69 pv d2d4
info depth 2 nodes 269 time 4 nps 53800 score cp 24 pv d2d4
info depth 3 nodes 1552 time 22 nps 67478 score cp 45 pv d2d4
info depth 4 nodes 5933 time 46 nps 126234 score cp 34 pv d2d4
info depth 5 nodes 18196 time 78 nps 230329 score cp 60 pv d2d4
info depth 6 nodes 66327 time 157 nps 419791 score cp 39 pv d2d4
info depth 7 nodes 156246 time 288 nps 540643 score cp 46 pv d2d4
info depth 8 nodes 648186 time 836 nps 774415 score cp 32 pv d2d4
info depth 9 nodes 1803245 time 1892 nps 952585 score cp 51 pv d2d4
info depth 10 nodes 8442083 time 7493 nps 1126512 score cp 32 pv d2d4
info depth 11 nodes 27943335 time 26254 nps 1064305 score cp 46 pv d2d4

BrendanJNorman
Posts: 2360
Joined: Sun Feb 07, 2016 11:43 pm
Full name: Brendan J Norman

Re: Mayhem NNUE - New NN engine

Post by BrendanJNorman » Fri Oct 23, 2020 3:26 am

JohnWoe wrote:
Thu Oct 22, 2020 9:40 pm
This proves that handcrafted evaluations are all crap.
This will cause enough heads here to shake that it'll cause an earthquake. :lol:

Maybe a better way to express yourself is "this proves that copy and pasting Stockfish's evaluation into other engines is superior to using your own".

Something we already knew haha.

But even doing this is only sufficient if the goal is strength.

As an end-user, I'm getting more and more bored of the wave of Stockfish NNUEs being plugged into other engines.

And even Frank Q has switched to testing for style rather than strength.

I feel like if the trend for programmers is to copy/pasting SF NNUE, most of the end-users will also move in another direction and test older or different engines.

Or perhaps I'm misunderstanding what exactly NNUE is...I dunno.

carldaman
Posts: 2094
Joined: Sat Jun 02, 2012 12:13 am

Re: Mayhem NNUE - New NN engine

Post by carldaman » Fri Oct 23, 2020 7:00 am

Yeah, in many ways it's a sad state of affairs when you just plug in SF-NNUE as a shortcut. The worst part is that it's a black box that doesn't even let you set contempt, let alone other settings. It takes the fun out for guys like Brendan and me, and also for some conscientious programmers like Andrew G of Ethereal fame, who take pride in fine tuning an engine.

My advice to developers that know they are not chasing after Stockfish is to program for style, and to create an enjoyable opponent or analysis partner. That would be something to be proud of, regardless of actual Elo rating. :)

JohnWoe
Posts: 346
Joined: Sat Mar 02, 2013 10:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe » Fri Oct 23, 2020 8:40 am

carldaman wrote:
Fri Oct 23, 2020 7:00 am
Yeah, in many ways it's a sad state of affairs when you just plug in SF-NNUE as a shortcut. The worst part is that it's a black box that doesn't even let you set contempt, let alone other settings. It takes the fun out for guys like Brendan and me, and also for some conscientious programmers like Andrew G of Ethereal fame, who take pride in fine tuning an engine.

My advice to developers that know they are not chasing after Stockfish is to program for style, and to create an enjoyable opponent or analysis partner. That would be something to be proud of, regardless of actual Elo rating. :)
Mayhem is just an experimental engine.

Also pext doesn't give any speedup as CPU is having hard time with NNUE instructions. My testing NNUE only is that it shuffles too much in endgames. It wasn't trained on? You still need classical evaluation.

I see NNUE as evaluation library. Tho it needs to be cleaned/polished and header only. Without all those hacks. It could use GPU/CPU/whatever I don't care. As long it works.

New version: Mayhem 0.43: https://github.com/SamuraiDangyo/mayhem ... /tag/v0.43

Sample game. See how effortless the NNUE is.

User avatar
mvanthoor
Posts: 979
Joined: Wed Jul 03, 2019 2:42 pm
Location: Netherlands
Full name: Marcel Vanthoor
Contact:

Re: Mayhem NNUE - New NN engine

Post by mvanthoor » Fri Oct 23, 2020 8:52 am

JohnWoe wrote:
Thu Oct 22, 2020 9:40 pm
Mayhem is Sapeli written in C++14 + SF NNUE evaluation. Thanks to Maksim simplifying off DirtyPiece/etc crap!
My engine is quite fast with regard to search already. It can achieve depth 10 in under 15 seconds in many positions WITHOUT even having a TT or other search optimizations yet. The main weakness is that it only has material count + PSQT for an evaluation. I could implement some things such as LMR and other search tricks, a TT, and stick a NNUE to that search and call it a day. That engine would probably be at least 2500 Elo.

God I hate NNUE. All those engines (and the GPU-engines as well) should be transferred to their own rating list(s), but I digress. There are other topics to discuss this.
Author of Rustic.
Releases | Code | Docs

JohnWoe
Posts: 346
Joined: Sat Mar 02, 2013 10:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe » Fri Oct 23, 2020 9:03 am

mvanthoor wrote:
Fri Oct 23, 2020 8:52 am
JohnWoe wrote:
Thu Oct 22, 2020 9:40 pm
Mayhem is Sapeli written in C++14 + SF NNUE evaluation. Thanks to Maksim simplifying off DirtyPiece/etc crap!
My engine is quite fast with regard to search already. It can achieve depth 10 in under 15 seconds in many positions WITHOUT even having a TT or other search optimizations yet. The main weakness is that it only has material count + PSQT for an evaluation. I could implement some things such as LMR and other search tricks, a TT, and stick a NNUE to that search and call it a day. That engine would probably be at least 2500 Elo.

God I hate NNUE. All those engines (and the GPU-engines as well) should be transferred to their own rating list(s), but I digress. There are other topics to discuss this.
Even if you plug in the NNUE it doesn't take anything away from Rustic! You could use that classical evaluation to deliver a quick checkmate/time trouble.
Evaluation is the hardest part to get right. To me the most boring job.

User avatar
mvanthoor
Posts: 979
Joined: Wed Jul 03, 2019 2:42 pm
Location: Netherlands
Full name: Marcel Vanthoor
Contact:

Re: Mayhem NNUE - New NN engine

Post by mvanthoor » Fri Oct 23, 2020 9:03 am

BrendanJNorman wrote:
Fri Oct 23, 2020 3:26 am

...

But even doing this is only sufficient if the goal is strength.

As an end-user, I'm getting more and more bored of the wave of Stockfish NNUEs being plugged into other engines.

And even Frank Q has switched to testing for style rather than strength.

I feel like if the trend for programmers is to copy/pasting SF NNUE, most of the end-users will also move in another direction and test older or different engines.

Or perhaps I'm misunderstanding what exactly NNUE is...I dunno.
I've finally installed Arena and looked into how it works.

There are actually some nice engines packaged with it. There are some that I remember from way back, such as SOS 5.1 and Ruffian 1.0.5. Those are 15 and 17 years old. Maybe I should look into collecting more older free and open source engines for testing.

With Stockfish, I'm sticking with version 10. In 11, they have recalibrated Skill and UCI_Strength to the CCRL scale, and now the engine is way too strong on the lowest 1350 setting. That is not 1350 Elo; it feels more like 1600, maybe even 1700. In the past I have always had these engines installed:

- Whatever the Fritz GUI installs, and Frtiz 13 and 11. (I don't have 12, or anything before 11.)
- Stockfish (up to 10) and Texel 1.07 (which is my favorite engine because of its great Strength setting)
- Stockfish 11 and Ethereal for analyzing.

You're right; for playing against, it wouldn't hurt to look into older engines again especially if they have a strength/skill setting, and they'll make good sparring partners for my own engine.
Author of Rustic.
Releases | Code | Docs

User avatar
mvanthoor
Posts: 979
Joined: Wed Jul 03, 2019 2:42 pm
Location: Netherlands
Full name: Marcel Vanthoor
Contact:

Re: Mayhem NNUE - New NN engine

Post by mvanthoor » Fri Oct 23, 2020 9:06 am

JohnWoe wrote:
Fri Oct 23, 2020 9:03 am
Even if you plug in the NNUE it doesn't take anything away from Rustic! You could use that classical evaluation to deliver a quick checkmate/time trouble.
Evaluation is the hardest part to get right. To me the most boring job.
To me, it is the REASON to write the chess engine in the first place.

The evaluation is the place where the chess engine plays chess. It makes it a "chess engine", instead of an "apparatus that makes legal moves on a internal board representation, on the basis of values ascribed to those moves by algorithms of which we don't know how they actually work."

The only thing I'll not be doing by hand (eventually) is tuning the precise values of the evaluation. And even then, I might change some values after tuning to tweak the engine's personality, even if it decreases strength somewhat.
Author of Rustic.
Releases | Code | Docs

JohnWoe
Posts: 346
Joined: Sat Mar 02, 2013 10:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe » Thu Oct 29, 2020 12:12 pm

I release Mayhem NNUE 0.47
Release: https://github.com/SamuraiDangyo/mayhem ... /tag/v0.47
Source code: https://github.com/SamuraiDangyo/mayhem

- Classical evaluation removed. Tiny mating helper added to finish games faster.
- Added null move for non tactical moves.
- Against SF12 Level: 2300 Elo it scores "5 to 1".

The 22Mb eval file is needed too.

This NNUE black box contains perfect KPK endings. No need to have KPK code inside.

jorose
Posts: 322
Joined: Thu Jan 22, 2015 2:21 pm
Location: Zurich, Switzerland
Full name: Jonathan Rosenthal

Re: Mayhem NNUE - New NN engine

Post by jorose » Thu Oct 29, 2020 1:46 pm

BrendanJNorman wrote:
Fri Oct 23, 2020 3:26 am
JohnWoe wrote:
Thu Oct 22, 2020 9:40 pm
This proves that handcrafted evaluations are all crap.
This will cause enough heads here to shake that it'll cause an earthquake. :lol:

Maybe a better way to express yourself is "this proves that copy and pasting Stockfish's evaluation into other engines is superior to using your own".

Something we already knew haha.

But even doing this is only sufficient if the goal is strength.

As an end-user, I'm getting more and more bored of the wave of Stockfish NNUEs being plugged into other engines.

And even Frank Q has switched to testing for style rather than strength.

I feel like if the trend for programmers is to copy/pasting SF NNUE, most of the end-users will also move in another direction and test older or different engines.

Or perhaps I'm misunderstanding what exactly NNUE is...I dunno.
I feel like the logical next step for programmers to consider is copy pasting Stockfish's search into their program as well. I am sure that is also worth a couple hundred Elo! Also why not the board representation, move generation, uci options etc, since those are all just boilerplate anyways?

Perhaps it makes most sense to start with copy pasting the author list.
-Jonathan

Post Reply