Stockfish NN release (NNUE)

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

Moderators: hgm, Rebel, chrisw

ChickenLogic
Posts: 154
Joined: Sun Jan 20, 2019 11:23 am
Full name: kek w

Re: Stockfish NN release (NNUE)

Post by ChickenLogic »

cucumber wrote: Wed Jun 03, 2020 9:36 pm I made a Dropbox for the ~100,000,000 FEN + game result + evals that I have. Here, for anyone who wants them.
https://www.dropbox.com/s/lri6ujmnrtm8o ... D.zip?dl=0

They've been shuffled already, so the FENs aren't in any particular order. Only problem is that the neural network will never see mate, since Fishtest adjudicates games. It might not see the fifty move rule either, but I'm not sure. SF's search is good enough that maybe that isn't an issue. I hope they can still be of some use.
The OP has contacted the author and apparently it isn't possible to convert any plain text fens/epds/pgns into usable training data for SF NNUE even if they are evaluated. By "not possible" I actually mean "not implemented" as in: the author made this as a proof of concept and if we want it we need to code it on our own. I would volunteer. Only 2 problems: 1) I don't speak Japanese 2) I can't code :D
What I will try to do is to get OpenMP to work and update the search from SF10 to SFdev.

If anyone is crazy enough to write a Fen to SF NNUE training-data conversion tool in their spare time let me know :P There seems to be an option to generate the training data in plain text but it is commented out. That might be a good starting point.

From this: https://github.com/nodchip/Stockfish/bl ... earner.cpp Line 2468 to 2500 is this snippet below:

Code: Select all

//			if (fs.read((char*)&p, sizeof(PackedSfenValue))) {
//				// plain textとして書き込む
//				ofs << "sfen " << tpos.sfen_unpack(p.sfen) << std::endl;
//				ofs << "move " << to_usi_string(Move(p.move)) << std::endl;
//				ofs << "score " << p.score << std::endl;
//				ofs << "ply " << int(p.gamePly) << std::endl;
//				ofs << "result " << int(p.game_result) << std::endl;
//				ofs << "e" << std::endl;
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Stockfish NN release (NNUE)

Post by Dann Corbit »

I got data from the original PGN files.
I created EPD that looks like this:

Code: Select all

rnbqk1nr/1pppbppp/8/p3p3/4P3/3P4/PPPN1PPP/R1BQKBNR w KQkq - bm Ngf3; ce 66; acd 22; acs 3; c0 "New-f7d7a374ef"; c3 "1/2-1/2";
rnbqk1nr/1pppbppp/8/p3p3/4P3/3P1N2/PPPN1PPP/R1BQKB1R b KQkq - bm Nc6; ce 26; acd 19; acs 1; c0 "Base-fb8095718b"; c3 "1/2-1/2";
r1bqk1nr/1pppbppp/2n5/p3p3/4P3/3P1N2/PPPN1PPP/R1BQKB1R w KQkq - bm Nc4; ce 44; acd 24; acs 5; c0 "New-f7d7a374ef"; c3 "1/2-1/2";
r1bqk1nr/1pppbppp/2n5/p3p3/2N1P3/3P1N2/PPP2PPP/R1BQKB1R b KQkq - bm d6; ce 13; acd 22; acs 1; c0 "Base-fb8095718b"; c3 "1/2-1/2";
Which creates stored procedure calls that look like this:

Code: Select all

EXECUTE InsertTom 'rnbqk1nr/1pppbppp/8/p3p3/4P3/3P4/PPPN1PPP/R1BQKBNR w KQkq -', 22, 66, 3, 'Ngf3', 'New-f7d7a374ef', '1/2';
EXECUTE InsertTom 'rnbqk1nr/1pppbppp/8/p3p3/4P3/3P1N2/PPPN1PPP/R1BQKB1R b KQkq -', 19, 26, 1, 'Nc6', 'Base-fb8095718b', '1/2';
EXECUTE InsertTom 'r1bqk1nr/1pppbppp/2n5/p3p3/4P3/3P1N2/PPPN1PPP/R1BQKB1R w KQkq -', 24, 44, 5, 'Nc4', 'New-f7d7a374ef', '1/2';
EXECUTE InsertTom 'r1bqk1nr/1pppbppp/2n5/p3p3/2N1P3/3P1N2/PPP2PPP/R1BQKB1R b KQkq -', 22, 13, 1, 'd6', 'Base-fb8095718b', '1/2';
Looks like the folder has a lot less PGN than was used to create your file, because I only got 4,264,177 distinct elements from the PGN files.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
cucumber
Posts: 144
Joined: Sun Oct 14, 2018 8:21 pm
Full name: JSmith

Re: Stockfish NN release (NNUE)

Post by cucumber »

Dann Corbit wrote: Wed Jun 03, 2020 10:34 pm I got data from the original PGN files.
I created EPD that looks like this:

Code: Select all

rnbqk1nr/1pppbppp/8/p3p3/4P3/3P4/PPPN1PPP/R1BQKBNR w KQkq - bm Ngf3; ce 66; acd 22; acs 3; c0 "New-f7d7a374ef"; c3 "1/2-1/2";
rnbqk1nr/1pppbppp/8/p3p3/4P3/3P1N2/PPPN1PPP/R1BQKB1R b KQkq - bm Nc6; ce 26; acd 19; acs 1; c0 "Base-fb8095718b"; c3 "1/2-1/2";
r1bqk1nr/1pppbppp/2n5/p3p3/4P3/3P1N2/PPPN1PPP/R1BQKB1R w KQkq - bm Nc4; ce 44; acd 24; acs 5; c0 "New-f7d7a374ef"; c3 "1/2-1/2";
r1bqk1nr/1pppbppp/2n5/p3p3/2N1P3/3P1N2/PPP2PPP/R1BQKB1R b KQkq - bm d6; ce 13; acd 22; acs 1; c0 "Base-fb8095718b"; c3 "1/2-1/2";
Which creates stored procedure calls that look like this:

Code: Select all

EXECUTE InsertTom 'rnbqk1nr/1pppbppp/8/p3p3/4P3/3P4/PPPN1PPP/R1BQKBNR w KQkq -', 22, 66, 3, 'Ngf3', 'New-f7d7a374ef', '1/2';
EXECUTE InsertTom 'rnbqk1nr/1pppbppp/8/p3p3/4P3/3P1N2/PPPN1PPP/R1BQKB1R b KQkq -', 19, 26, 1, 'Nc6', 'Base-fb8095718b', '1/2';
EXECUTE InsertTom 'r1bqk1nr/1pppbppp/2n5/p3p3/4P3/3P1N2/PPPN1PPP/R1BQKB1R w KQkq -', 24, 44, 5, 'Nc4', 'New-f7d7a374ef', '1/2';
EXECUTE InsertTom 'r1bqk1nr/1pppbppp/2n5/p3p3/2N1P3/3P1N2/PPP2PPP/R1BQKB1R b KQkq -', 22, 13, 1, 'd6', 'Base-fb8095718b', '1/2';
Looks like the folder has a lot less PGN than was used to create your file, because I only got 4,264,177 distinct elements from the PGN files.
My bad. I linked the folder for a test on Fishtest, rather than for *all* of the tests on Fishtest: https://drive.google.com/drive/folders/ ... sp=sharing

This should work.
cucumber
Posts: 144
Joined: Sun Oct 14, 2018 8:21 pm
Full name: JSmith

Re: Stockfish NN release (NNUE)

Post by cucumber »

Dann Corbit wrote: Wed Jun 03, 2020 9:40 pm Is the score relative to the side to move or is it relative to white.
Looks like no depth data.
No depth data, but it's definitely higher than 4-8. Score is relative to white.
muppetmuppet
Posts: 10
Joined: Tue May 19, 2020 7:41 pm
Full name: Ian Hodges

Re: Stockfish NN release (NNUE)

Post by muppetmuppet »

I can't seem to get the bigger net to work properly it keeps giving up its queen for a piece. Do I have to do something other than use the half exe and put the net in the eval dir?
ChickenLogic
Posts: 154
Joined: Sun Jan 20, 2019 11:23 am
Full name: kek w

Re: Stockfish NN release (NNUE)

Post by ChickenLogic »

muppetmuppet wrote: Thu Jun 04, 2020 12:36 pm I can't seem to get the bigger net to work properly it keeps giving up its queen for a piece. Do I have to do something other than use the half exe and put the net in the eval dir?
It seems that win against H was a lucky one off. Or I've sent the wrong net. In that case I'm sorry.
ChickenLogic
Posts: 154
Joined: Sun Jan 20, 2019 11:23 am
Full name: kek w

Re: Stockfish NN release (NNUE)

Post by ChickenLogic »

Sorry for the double post. Please note that the net is just a test run to look for ideal parameters. It could very well be that the depth=4 training data is showing through.
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: Stockfish NN release (NNUE)

Post by Joerg Oster »

ChickenLogic wrote: Thu Jun 04, 2020 2:13 pm Sorry for the double post. Please note that the net is just a test run to look for ideal parameters. It could very well be that the depth=4 training data is showing through.
Training with fixed depth is probably the worst method for Stockfish.
Fixed depth testing/tuning has proven to be a bad idea in the past!

Fixed movetime (maybe 10 ms) would already be much better, I guess.
Jörg Oster
Raphexon
Posts: 476
Joined: Sun Mar 17, 2019 12:00 pm
Full name: Henk Drost

Re: Stockfish NN release (NNUE)

Post by Raphexon »

muppetmuppet wrote: Thu Jun 04, 2020 12:36 pm I can't seem to get the bigger net to work properly it keeps giving up its queen for a piece. Do I have to do something other than use the half exe and put the net in the eval dir?
If you're using the latest binary (the one with the speedup); it will need a new net because its parameters have changed.
It can use an old net, but it might have eval problems.

Also I've found some extra information so when I'm home I'll add a new txt file to this thread.
ChickenLogic
Posts: 154
Joined: Sun Jan 20, 2019 11:23 am
Full name: kek w

Re: Stockfish NN release (NNUE)

Post by ChickenLogic »



Wow, SmallNN is the net I trained and BaseNN is the one coming with SFNNUE. This was 1 core at 30s+1sec. Can somebody PLEASE run a tournament and look into that. There were no losses on time.

https://drive.google.com/drive/folders/ ... sp=sharing This is the correct .exe with the shipped net.

This is my net. You'll need two folders with the .exe since the name of the net must be nn.bin.

Tell me I'm not crazy...