I've been in a bit of a rut with Abbess, half building out a few ideas without really bringing them all the way (e.g. a giant minimaxed opening book that grows). Very little actual progress in the past several years.
NNUE is of course the hot item for the past few years. I got into chess programming more from the machine intelligence perspective, rather than from being a chess player (950 elo or so). So from that perspective, NNUE is an attractive path to investigate.
On the flip side, I guess there are two things that have held me back so far:
1. I wasn't interested in making another engine that's just like every other one. It felt like hand-crafted evaluations had a level of individuality in them that I would lose going to NNUE. I just don't know that I have the interest in banging my head against the wall of trying new ideas that never seem to add any strength.
2. I've come to terms with the fact that I'm a much better statistician than programmer. I still use vanilla C from 30 years ago with hardly any of the advancements. I fiddle with Python for my AI work, but I don't want to write a python chess program. (I'd happily do Python training code, though.)
I read through some sample NNUE code on Github a long time ago. There was a lot of leveraging special registers/instructions to make things fast that was a lot lower-level than the programming I usually do. So I guess my question is: is that a must-do if I want more than a toy NNUE, or can I get by with standard arrays of chars/ints (CPU agnostic stuff)? I'm fine taking a 2x or 10x performance hit for simplicity, but if it's a 100x hit, there isn't much point.
Any thoughts?
To NNUE or not to NNUE, that is the question
Moderator: Ras
-
- Posts: 567
- Joined: Sat Mar 25, 2006 8:27 pm
- Location: USA
- Full name: Robert Pope
-
- Posts: 128
- Joined: Sat Jul 30, 2022 12:12 pm
- Full name: Jamie Whiting
Re: To NNUE or not to NNUE, that is the question
You don't need any of that **provided you use a simple enough architecture**.Robert Pope wrote: ↑Wed Aug 13, 2025 2:48 am I read through some sample NNUE code on Github a long time ago. There was a lot of leveraging special registers/instructions to make things fast that was a lot lower-level than the programming I usually do. So I guess my question is: is that a must-do if I want more than a toy NNUE, or can I get by with standard arrays of chars/ints (CPU agnostic stuff)? I'm fine taking a 2x or 10x performance hit for simplicity, but if it's a 100x hit, there isn't much point.
If you were to adopt NNUE, you should start with the simplest architecture - just 1 hidden layer - and build incrementally. It so happens that performance gains from handwriting SIMD for this are relatively minor provided you use a language like C/C++/Rust and compile with the proper (e.g. AVX2) targets enabled.
Single layer inference is very simple:
https://github.com/jw1912/bullet/blob/m ... #L102-L186
Also may be of help:
https://github.com/jw1912/bullet/blob/m ... nner-traps
-
- Posts: 976
- Joined: Fri Mar 10, 2006 4:29 pm
- Location: Germany
- Full name: Jörg Oster
Re: To NNUE or not to NNUE, that is the question
Here https://github.com/joergoster/Stockfish ... nue-small/ I had implemented into Stockfish (last HCE version) one of the first small NNUEs from the engine Smallbrain, whose author 'Disservin' is now one of the maintainers of Stockfish.
(This was done mainly for educational purpose only.)
Scroll a bit down, and you'll find the 1st buggy implementation, and also the bugfixed and improved version(s) further up.
The latest improved and bugfree version is almost 90 elo stronger than the HCE version of Stockfish, which is not about the same strength than SF's initial NNUE commit, but still a LOT and way less complicated and thus much easier to follow.
So I guess the answer is yes, if you don't intend to play in the top league, you can get by with standard arrays and simple addition/multiplication stuff.
(This was done mainly for educational purpose only.)
Scroll a bit down, and you'll find the 1st buggy implementation, and also the bugfixed and improved version(s) further up.
The latest improved and bugfree version is almost 90 elo stronger than the HCE version of Stockfish, which is not about the same strength than SF's initial NNUE commit, but still a LOT and way less complicated and thus much easier to follow.
So I guess the answer is yes, if you don't intend to play in the top league, you can get by with standard arrays and simple addition/multiplication stuff.
Jörg Oster
-
- Posts: 906
- Joined: Mon Jan 15, 2007 11:23 am
- Location: Warsza
Re: To NNUE or not to NNUE, that is the question
Nice work! If only training a net was as simple as this code!Joerg Oster wrote: ↑Wed Aug 13, 2025 3:23 pm I had implemented into Stockfish (last HCE version) one of the first small NNUEs from the engine Smallbrain, whose author 'Disservin' is now one of the maintainers of Stockfish.
Pawel Koziol
http://www.pkoziol.cal24.pl/rodent/rodent.htm
http://www.pkoziol.cal24.pl/rodent/rodent.htm