So the Stockfish NNUE input network is basically Kingpos*AllPieces ~ 40k input nodes, for both sides.
Now a very simple question, why not 64 networks for each king position instead? Wouldn't that be a whole lot easier to train and give the same result?
Stockfish NNUE net question: Why 40k input nodes?
Moderator: Ras
-
- Posts: 54
- Joined: Fri Apr 21, 2023 3:46 pm
- Full name: Richard Hoffmann
-
- Posts: 5694
- Joined: Tue Feb 28, 2012 11:56 pm
Re: Stockfish NNUE net question: Why 40k input nodes?
I think you'd have to train them all at the same time or they will not be calibrated to each other? Also, if you train on games, you train on sets of positions where the king moves around.rdhoffmann wrote: ↑Tue May 23, 2023 11:44 pm So the Stockfish NNUE input network is basically Kingpos*AllPieces ~ 40k input nodes, for both sides.
Now a very simple question, why not 64 networks for each king position instead? Wouldn't that be a whole lot easier to train and give the same result?
-
- Posts: 54
- Joined: Fri Apr 21, 2023 3:46 pm
- Full name: Richard Hoffmann
Re: Stockfish NNUE net question: Why 40k input nodes?
Ah, that is a good point yes. About the moving king, sorting/filtering positions according to the king square should be fairly trivial. Another option is to generate only positions where the king is on a fixed square. This is what I did for some experiments, to avoid a huge training effort before knowing whether an idea actually works.
-
- Posts: 36
- Joined: Thu Mar 03, 2022 7:29 am
- Full name: Alvin Peng
Re: Stockfish NNUE net question: Why 40k input nodes?
I'm not sure if this idea is possible because a Stockfish network requires both black and white perspectives. The output of a network doesn't depend on the position of just one king - it depends on both.rdhoffmann wrote: ↑Tue May 23, 2023 11:44 pm So the Stockfish NNUE input network is basically Kingpos*AllPieces ~ 40k input nodes, for both sides.
Now a very simple question, why not 64 networks for each king position instead? Wouldn't that be a whole lot easier to train and give the same result?
-
- Posts: 54
- Joined: Fri Apr 21, 2023 3:46 pm
- Full name: Richard Hoffmann
Re: Stockfish NNUE net question: Why 40k input nodes?
True- makes perfect sense. Thank you for your replies! 

-
- Posts: 5694
- Joined: Tue Feb 28, 2012 11:56 pm
Re: Stockfish NNUE net question: Why 40k input nodes?
One can fix one king and let the other king run free. (Or one can fix both kings and train a network for each (wK, bK) position pair.)alvinypeng wrote: ↑Wed May 24, 2023 2:23 amI'm not sure if this idea is possible because a Stockfish network requires both black and white perspectives. The output of a network doesn't depend on the position of just one king - it depends on both.rdhoffmann wrote: ↑Tue May 23, 2023 11:44 pm So the Stockfish NNUE input network is basically Kingpos*AllPieces ~ 40k input nodes, for both sides.
Now a very simple question, why not 64 networks for each king position instead? Wouldn't that be a whole lot easier to train and give the same result?
But the problem that I see is that in games both kings tend to move at least now and then.
But I haven't touched a trainer so far, so I could be seeing problems that do not exist.