Are hybrid approaches stronger than pure nnue?

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

Moderators: hgm, Rebel, chrisw

Madeleine Birchfield
Posts: 512
Joined: Tue Sep 29, 2020 4:29 pm
Location: Dublin, Ireland
Full name: Madeleine Birchfield

Are hybrid approaches stronger than pure nnue?

Post by Madeleine Birchfield »

Shortly after nnue was merged into the official Stockfish project, one of the first patches to pass was to use Stockfish's handcrafted evaluation instead of nnue for positions that are above a certain evaluation (5.00 was the original threshold). An year has passed, and that patch has still not been simplified away. Instead, the Stockfish developers have found new ways to switch between its handcrafted evaluation function and its neural network, such as in bishop vs pawns endgames, in fortress detection, and in frc960 positions, all better than using purely nnue only.

However, almost all other engines using nnue only use nnue, with many of them stripping away their handcrafted evaluation completely from their engine, or only making the handcrafted evaluation available through a uci option, using it only to train new neural networks. Neural networks have their weak points and there are positions where a hybrid approach would be better than only using nnue, and a hybrid approach is more unique than the current situation with people copying stockfish's architecture and inference code.
dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: Are hybrid approaches stronger than pure nnue?

Post by dkappe »

Madeleine Birchfield wrote: Thu Jul 08, 2021 8:06 pm Shortly after nnue was merged into the official Stockfish project, one of the first patches to pass was to use Stockfish's handcrafted evaluation instead of nnue for positions that are above a certain evaluation (5.00 was the original threshold). An year has passed, and that patch has still not been simplified away. Instead, the Stockfish developers have found new ways to switch between its handcrafted evaluation function and its neural network, such as in bishop vs pawns endgames, in fortress detection, and in frc960 positions, all better than using purely nnue only.

However, almost all other engines using nnue only use nnue, with many of them stripping away their handcrafted evaluation completely from their engine, or only making the handcrafted evaluation available through a uci option, using it only to train new neural networks. Neural networks have their weak points and there are positions where a hybrid approach would be better than only using nnue, and a hybrid approach is more unique than the current situation with people copying stockfish's architecture and inference code.
Which ones use pure NNUE? Dark Toga uses hybrid at 500 cp. Igel uses hybrid. I find it hard to believe that anyone uses pure nnue, as even a primitive psqt eval hybrid gains elo, especially outside the PV.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
Uri Blass
Posts: 10280
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Are hybrid approaches stronger than pure nnue?

Post by Uri Blass »

Why hybrid earns elo?

If it is only because of speed then I wonder if it holds at longer time control.

If it is because nnue is relatively bad in positions when one side has a big advantage then maybe it is better to improve nnue and teach it based on scoring system that not all wins are the same and it is better to win in less moves.
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Are hybrid approaches stronger than pure nnue?

Post by Michel »

Uri Blass wrote: Fri Jul 09, 2021 6:00 am Why hybrid earns elo?

If it is only because of speed then I wonder if it holds at longer time control.

If it is because nnue is relatively bad in positions when one side has a big advantage then maybe it is better to improve nnue and teach it based on scoring system that not all wins are the same and it is better to win in less moves.
Speed. The HCE is used as lazy eval. Spending less time in search on positions that are won/lost with very high likelihood means more time for positions that matter. I would guess this does not depend on TC.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
Uri Blass
Posts: 10280
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Are hybrid approaches stronger than pure nnue?

Post by Uri Blass »

Michel wrote: Fri Jul 09, 2021 8:42 am
Uri Blass wrote: Fri Jul 09, 2021 6:00 am Why hybrid earns elo?

If it is only because of speed then I wonder if it holds at longer time control.

If it is because nnue is relatively bad in positions when one side has a big advantage then maybe it is better to improve nnue and teach it based on scoring system that not all wins are the same and it is better to win in less moves.
Speed. The HCE is used as lazy eval. Spending less time in search on positions that are won/lost with very high likelihood means more time for positions that matter. I would guess this does not depend on TC.
Spending less time on positions that are won/lost can be done by more aggressive pruning if you know accurate evaluation.

If stockfish cannot detect some fotress positions as a draw regardless of time control because of lazy evaluation then it may be more important at long time control.
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Are hybrid approaches stronger than pure nnue?

Post by Michel »

Uri Blass wrote: Fri Jul 09, 2021 4:34 pm
Michel wrote: Fri Jul 09, 2021 8:42 am
Uri Blass wrote: Fri Jul 09, 2021 6:00 am Why hybrid earns elo?

If it is only because of speed then I wonder if it holds at longer time control.

If it is because nnue is relatively bad in positions when one side has a big advantage then maybe it is better to improve nnue and teach it based on scoring system that not all wins are the same and it is better to win in less moves.
Speed. The HCE is used as lazy eval. Spending less time in search on positions that are won/lost with very high likelihood means more time for positions that matter. I would guess this does not depend on TC.
Spending less time on positions that are won/lost can be done by more aggressive pruning if you know accurate evaluation.
Sure but the two things are not incompatible. Some branches can be pruned based on lazy evaluation and other branches can be pruned based on the more accurate NNUE evaluation.

If stockfish cannot detect some fortress positions as a draw regardless of time control because of lazy evaluation then it may be more important at long time control.
How much Elo would perfect fortress detection be worth? I have the feeling that it would not be a lot but I am not a good chess player.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
abgursu
Posts: 91
Joined: Thu May 14, 2020 3:34 pm
Full name: A. B. Gursu

Re: Are hybrid approaches stronger than pure nnue?

Post by abgursu »

It was nearly 90 elo loss when both SF and Crystal were using classical. I believe the difference should increase a lot in NNUE (I honestly expect more than 200), but I didn't test recent SF NNUE and Crystal yet.
User avatar
towforce
Posts: 11561
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

Re: Are hybrid approaches stronger than pure nnue?

Post by towforce »

Big picture: if NNs keep on improving their chess skill, there won't be much point to hybrid.

People used to say that computer+human was stronger than either computer or human alone - but that period was short lived: now the best chess just comes from a strong computer on its own.
Writing is the antidote to confusion.
It's not "how smart you are", it's "how are you smart".
Your brain doesn't work the way you want, so train it!
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Are hybrid approaches stronger than pure nnue?

Post by Daniel Shawul »

Most engines simply have way too inferior HCE that can not compete with NNUE.
Even Stockfish's NNUE is 100 or so elo stronger now, so it makes sense for most to use pure NNUE.
However, NNUE seems to have problems learning "scaling factors", such as for OCB and wrong-color bishop, so that
part of HCE still seems to be necessary, until atleast a better solution is found.
User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: Are hybrid approaches stronger than pure nnue?

Post by yurikvelo »

Madeleine Birchfield wrote: Thu Jul 08, 2021 8:06 pm many of them stripping away their handcrafted evaluation completely
forum3/viewtopic.php?f=2&t=77571