Alternative NNUE inputs

Discussion of chess software programming and technical issues.

Moderator: Ras

salmon
Posts: 1
Joined: Thu Jul 24, 2025 3:12 pm
Full name: Salomon Dölle

Alternative NNUE inputs

Post by salmon »

I am currently implementing a nnue into my own hobby engine. I would love to try a complete new approach for the architecture and see how it does. My idea was to focus on relative piece-piece interactions (for example a pawn three squares below an enemy knight is kind of the same pattern no matter where on the board). This would lead to 12 piece types * 12 piece types * 15 x difference * 15 y difference = 32.400 different inputs. I hope the net could generalize piece relations very well because they don't depend on the absolute position on the board. However this approach does neglect the edge of the board.
Next number of inputs could be reduced by only looking at 8 possible x difference values assuming that horizontal mirroring of the two pieces does not change the value of their relation. Besides I did count some piece relations twice ((piece_a,piece_b) and (piece_b,piece_a)).
So I could reduce the number of inputs to (12 choose 2) piece type combinations * 8 xdiff * 15 ydiff = 7920 Inputs. This is pretty small compared to a HalfKP architecture.
So here are my questions:
1. Do you think my input encoding has potential regarding playing strength?
2. I haven't figured out how I want to do efficient updates. Moving a piece would change lots of inputs, especially when it is a capture or castle.
AlvaroBegue
Posts: 932
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: Alternative NNUE inputs

Post by AlvaroBegue »

The beauty of something like HalfKP is that it allows you to have lots of parameters, which encode lots of knowledge, but with very small computational effort. You just need to keep the two sums-of-embeddings vectors updated, by subtracting two rows and adding two rows every time a piece moves.

The fact that there are many input features in HalfKP is actually good.

What you propose has fewer features, but many more of them need to be added, which results in less possibilities for encoding knowledge and more computation time.

In short, I don't think your idea will result in strong play. But it's worth trying! It's good to follow your instincts, because sometimes everyone else is wrong and you'll discover something great; and if you don't, you'll probably learn something along the way.