Minic version 3

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

Moderators: hgm, Rebel, chrisw

User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Minic version 3

Post by xr_a_y »

Second year anniversary for Minic :D ! and a new version number 3.00

Porting Stockfish NNUE implementation inside Minic was fun and instructive. This has clearly raised my interest in NN technologies and in this sense is a success.
As you already know, I was never comfortable with the big copy/paste of SF code involved, nor with the use of SF based nets of course.
This is why I first trained a net with my own data (but using Nodchip learner), namely the "napping nexus" net and then merged the learner directly inside Minic in order to train the pure Minic net named "nascent nutrient". Still, this was not enough to make me feel this technology and code can be inside Minic this way and in no way this can be considered as an "official" version of Minic as soon as a NNUE net is in use. This is why I decided to not use SF implementation anymore. This means that, starting from version 3, Minic is no more compatible with SF nets. Only versions 2.47 to 2.53 can read and use SF nets (and only using NNUE version 0x7AF32F16u nets).

In the meantime, I discovered Seer engine by Connor McMonigle (https://github.com/connormcmonigle/seer-nnue), and was very impressed by its code quality. This engine propose a very clear and simple to understand and use NNUE implementation. This implementation allows to very easily change architecture of the net and implements an engine-independent training code using pytorch. I decided to borrow this code base and adapt it to Minic (was very easy). This is a good compromise for me, a code base I can understand and work with, a very good starting point.

I then trained a first net for it, named "nefarious nucleus" (available here : https://github.com/tryingsomestuff/NNUE-Nets) that performs even with standard Minic2.53 eval at short TC (10s+0.1). Maybe better at longer TC...

My hope is of course to train better nets, probably try other architectures and also speed-up the code that is for now quite slow.

Please note that Minic 3.00 with no net loaded is weaker than version 2.53 because it has less nps. So that there is probably no need for testing for now ...

So for now this is a just a new forum thread for a new story ;-)
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Minic version 3

Post by Guenther »

xr_a_y wrote: Tue Nov 03, 2020 1:49 pm Second year anniversary for Minic :D ! and a new version number 3.00

Porting Stockfish NNUE implementation inside Minic was fun and instructive. This has clearly raised my interest in NN technologies and in this sense is a success.
As you already know, I was never comfortable with the big copy/paste of SF code involved, nor with the use of SF based nets of course.
This is why I first trained a net with my own data (but using Nodchip learner), namely the "napping nexus" net and then merged the learner directly inside Minic in order to train the pure Minic net named "nascent nutrient". Still, this was not enough to make me feel this technology and code can be inside Minic this way and in no way this can be considered as an "official" version of Minic as soon as a NNUE net is in use. This is why I decided to not use SF implementation anymore. This means that, starting from version 3, Minic is no more compatible with SF nets. Only versions 2.47 to 2.53 can read and use SF nets (and only using NNUE version 0x7AF32F16u nets).

In the meantime, I discovered Seer engine by Connor McMonigle (https://github.com/connormcmonigle/seer-nnue), and was very impressed by its code quality. This engine propose a very clear and simple to understand and use NNUE implementation. This implementation allows to very easily change architecture of the net and implements an engine-independent training code using pytorch. I decided to borrow this code base and adapt it to Minic (was very easy). This is a good compromise for me, a code base I can understand and work with, a very good starting point.

I then trained a first net for it, named "nefarious nucleus" (available here : https://github.com/tryingsomestuff/NNUE-Nets) that performs even with standard Minic2.53 eval at short TC (10s+0.1). Maybe better at longer TC...

My hope is of course to train better nets, probably try other architectures and also speed-up the code that is for now quite slow.

Please note that Minic 3.00 with no net loaded is weaker than version 2.53 because it has less nps. So that there is probably no need for testing for now ...

So for now this is a just a new forum thread for a new story ;-)
Very interesting!

I guess I cannot work around a new 'field' anymore in my XB/UCI chronology for 'nn type' and/or 'nn file(s) itself' and perhaps how it was learnt,
what I avoided so far. (Of course this is not meant as criticism on your decisions - more a general remark)
This will be probably a challenge for rating lists in the future too.

Any suggestions welcome...
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Minic version 3

Post by xr_a_y »

Fun game of Minic3 using "nefarious nucleus" net versus Weiss. Minic giving everything for the king side attack

[pgn]
[Event "My Tournament"]
[Site "?"]
[Date "2020.11.03"]
[Round "395"]
[White "minic_3.00_nefarious nucleus"]
[Black "weiss"]
[Result "1-0"]
[ECO "B25"]
[GameDuration "00:00:17"]
[GameEndTime "2020-11-03T17:07:04.166 CET"]
[GameStartTime "2020-11-03T17:06:46.869 CET"]
[Opening "Sicilian"]
[PlyCount "59"]
[TimeControl "10+0.1"]
[Variation "Closed"]

1. e4 {book} c5 {book} 2. Nc3 {book} Nc6 {book} 3. g3 {book} g6 {book}
4. Bg2 {book} Bg7 {book} 5. d3 {book} d6 {book} 6. Nge2 {book}
Nf6 {+0.13/16 0.49s} 7. O-O {+0.26/14 0.69s} O-O {+0.14/14 0.32s}
8. h3 {+0.28/13 0.45s} Bd7 {+0.15/15 0.38s} 9. f4 {+0.48/12 0.42s}
e5 {+0.13/14 0.50s} 10. f5 {+0.53/12 0.67s} h6 {+0.10/13 0.50s}
11. g4 {+0.61/13 0.48s} Nd4 {+0.10/15 0.33s} 12. g5 {+0.74/12 0.60s}
hxg5 {+0.24/13 0.57s} 13. Bxg5 {+0.84/12 0.48s} Qc8 {+0.16/13 0.28s}
14. Kh1 {+1.72/12 0.43s} a5 {+0.06/14 0.57s} 15. Bxf6 {+2.16/14 0.29s}
Bxf6 {-0.17/15 0.34s} 16. Nd5 {+2.19/15 0.33s} Qd8 {-0.21/16 0.30s}
17. c3 {+1.84/14 0.53s} Nxe2 {-0.04/14 0.26s} 18. Qxe2 {+1.50/13 0.32s}
b5 {-0.04/13 0.49s} 19. Rf3 {+3.53/11 0.31s} Bh4 {-0.41/15 0.26s}
20. Raf1 {+3.43/13 0.28s} Kh7 {-0.37/13 0.28s} 21. fxg6+ {+7.28/13 0.37s}
Kxg6 {-0.42/14 0.29s} 22. Rf5 {+7.26/15 0.41s} Bxf5 {-4.10/15 0.33s}
23. exf5+ {+8.07/15 0.43s} Kh6 {-3.84/13 0.32s} 24. f6 {+8.79/13 0.31s}
Qd7 {-4.91/14 0.99s} 25. Nb6 {+9.13/15 0.41s} Qd8 {-4.57/14 0.29s}
26. Rf5 {+13.80/15 0.21s} Bg5 {-7.37/13 0.18s} 27. Rxg5 {+99.93/32 0.18s}
Kxg5 {-M6/127 0.030s} 28. Qg4+ {+99.95/43 0.16s} Kh6 {-M4/127 0.007s}
29. Qh4+ {+99.97/121 0.062s} Kg6 {-M2/127 0.011s}
30. Be4# {+99.99/121 0.008s, White mates} 1-0

[/pgn]
User avatar
Werner
Posts: 2871
Joined: Wed Mar 08, 2006 10:09 pm
Location: Germany
Full name: Werner Schüle

Re: Minic version 3

Post by Werner »

Very interesting!
Now we can compare your net with the one from Seer 1.1 :wink:
Werner
Terje
Posts: 347
Joined: Tue Nov 19, 2019 4:34 am
Location: https://github.com/TerjeKir/weiss
Full name: Terje Kirstihagen

Re: Minic version 3

Post by Terje »

xr_a_y wrote: Tue Nov 03, 2020 5:12 pm Fun game of Minic3 using "nefarious nucleus" net versus Weiss. Minic giving everything for the king side attack

[pgn]
[Event "My Tournament"]
[Site "?"]
[Date "2020.11.03"]
[Round "395"]
[White "minic_3.00_nefarious nucleus"]
[Black "weiss"]
[Result "1-0"]
[ECO "B25"]
[GameDuration "00:00:17"]
[GameEndTime "2020-11-03T17:07:04.166 CET"]
[GameStartTime "2020-11-03T17:06:46.869 CET"]
[Opening "Sicilian"]
[PlyCount "59"]
[TimeControl "10+0.1"]
[Variation "Closed"]

1. e4 {book} c5 {book} 2. Nc3 {book} Nc6 {book} 3. g3 {book} g6 {book}
4. Bg2 {book} Bg7 {book} 5. d3 {book} d6 {book} 6. Nge2 {book}
Nf6 {+0.13/16 0.49s} 7. O-O {+0.26/14 0.69s} O-O {+0.14/14 0.32s}
8. h3 {+0.28/13 0.45s} Bd7 {+0.15/15 0.38s} 9. f4 {+0.48/12 0.42s}
e5 {+0.13/14 0.50s} 10. f5 {+0.53/12 0.67s} h6 {+0.10/13 0.50s}
11. g4 {+0.61/13 0.48s} Nd4 {+0.10/15 0.33s} 12. g5 {+0.74/12 0.60s}
hxg5 {+0.24/13 0.57s} 13. Bxg5 {+0.84/12 0.48s} Qc8 {+0.16/13 0.28s}
14. Kh1 {+1.72/12 0.43s} a5 {+0.06/14 0.57s} 15. Bxf6 {+2.16/14 0.29s}
Bxf6 {-0.17/15 0.34s} 16. Nd5 {+2.19/15 0.33s} Qd8 {-0.21/16 0.30s}
17. c3 {+1.84/14 0.53s} Nxe2 {-0.04/14 0.26s} 18. Qxe2 {+1.50/13 0.32s}
b5 {-0.04/13 0.49s} 19. Rf3 {+3.53/11 0.31s} Bh4 {-0.41/15 0.26s}
20. Raf1 {+3.43/13 0.28s} Kh7 {-0.37/13 0.28s} 21. fxg6+ {+7.28/13 0.37s}
Kxg6 {-0.42/14 0.29s} 22. Rf5 {+7.26/15 0.41s} Bxf5 {-4.10/15 0.33s}
23. exf5+ {+8.07/15 0.43s} Kh6 {-3.84/13 0.32s} 24. f6 {+8.79/13 0.31s}
Qd7 {-4.91/14 0.99s} 25. Nb6 {+9.13/15 0.41s} Qd8 {-4.57/14 0.29s}
26. Rf5 {+13.80/15 0.21s} Bg5 {-7.37/13 0.18s} 27. Rxg5 {+99.93/32 0.18s}
Kxg5 {-M6/127 0.030s} 28. Qg4+ {+99.95/43 0.16s} Kh6 {-M4/127 0.007s}
29. Qh4+ {+99.97/121 0.062s} Kg6 {-M2/127 0.011s}
30. Be4# {+99.99/121 0.008s, White mates} 1-0

[/pgn]
You'll get him next time, Weiss :cry:
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Minic version 3

Post by xr_a_y »

Terje wrote: Tue Nov 03, 2020 5:29 pm You'll get him next time, Weiss :cry:
Here is clear Weiss victory, and as Black ;), maybe Minic pushed it too hard on this one !

[pgn]
[Event "My Tournament"]
[Site "?"]
[Date "2020.11.03"]
[Round "415"]
[White "minic_3.00_nnue"]
[Black "weiss"]
[Result "0-1"]
[ECO "B04"]
[GameDuration "00:00:27"]
[GameEndTime "2020-11-03T17:19:34.409 CET"]
[GameStartTime "2020-11-03T17:19:07.295 CET"]
[Opening "Alekhine's defense"]
[PlyCount "104"]
[TimeControl "10+0.1"]
[Variation "Modern, Larsen Variation"]

1. e4 {book} Nf6 {book} 2. e5 {book} Nd5 {book} 3. d4 {book} d6 {book}
4. Nf3 {book} dxe5 {book} 5. Nxe5 {+1.06/14 0.54s} Nd7 {-0.42/15 0.46s}
6. Nxf7 {+1.59/16 0.64s} Kxf7 {0.00/17 0.30s} 7. Qh5+ {+1.96/16 0.63s}
Ke6 {0.00/18 0.29s} 8. c4 {+1.38/14 0.63s} N5f6 {+1.43/15 0.60s}
9. d5+ {+2.47/16 0.48s} Kd6 {+1.35/15 0.30s} 10. Qf7 {+2.46/18 0.55s}
Ne5 {+2.03/15 0.35s} 11. Bf4 {+2.67/13 0.36s} c5 {+1.78/15 0.32s}
12. Nc3 {+3.62/15 0.52s} a6 {+2.18/15 0.65s} 13. O-O-O {+3.21/14 0.51s}
g6 {+2.33/14 0.37s} 14. Bxe5+ {-0.26/11 0.36s} Kxe5 {+2.12/13 0.25s}
15. d6 {+0.08/13 0.34s} Bh6+ {+2.24/15 0.77s} 16. Kb1 {-1.75/13 0.48s}
Rf8 {+2.45/15 0.37s} 17. Qxe7+ {-1.91/16 0.43s} Qxe7 {+2.61/16 0.32s}
18. dxe7 {-2.51/15 0.43s} Re8 {+2.63/16 0.33s} 19. Nd5 {-2.55/14 0.26s}
Nxd5 {+4.46/16 0.28s} 20. Rxd5+ {-3.54/13 0.40s} Kf6 {+4.57/15 0.21s}
21. Bd3 {-4.07/16 0.36s} Rxe7 {+4.56/16 0.39s} 22. Rxc5 {-4.19/15 0.34s}
Be6 {+5.06/16 0.24s} 23. Be4 {-4.25/14 0.19s} Rd8 {+4.72/16 0.32s}
24. Bd5 {-4.72/14 0.35s} Bf5+ {+5.04/16 0.21s} 25. Ka1 {-4.35/13 0.35s}
Bd2 {+4.53/16 0.19s} 26. a3 {-3.87/12 0.29s} Be1 {+5.67/15 0.22s}
27. f4 {-4.59/13 0.32s} Bf2 {+6.93/18 0.23s} 28. Ra5 {-4.70/12 0.19s}
Bb6 {+7.10/18 0.23s} 29. Ra4 {-5.14/12 0.24s} a5 {+7.23/17 0.19s}
30. c5 {-5.61/14 0.26s} Bxc5 {+7.67/17 0.33s} 31. Bf3 {-6.39/15 0.28s}
b6 {+7.75/18 0.34s} 32. h4 {-7.42/12 0.27s} Re3 {+9.28/17 0.41s}
33. Rc4 {-8.15/11 0.15s} Rd2 {+9.64/14 0.18s} 34. Rc3 {-8.15/14 0.15s}
Rxc3 {+11.01/16 0.28s} 35. bxc3 {-8.62/14 0.24s} Bxa3 {+11.20/15 0.33s}
36. Re1 {-8.55/13 0.24s} Bb2+ {+12.42/15 0.17s} 37. Ka2 {-9.03/13 0.20s}
Bxc3+ {+14.33/15 0.19s} 38. Kb3 {-8.83/11 0.22s} Bb4 {+14.83/15 0.21s}
39. Rc1 {-10.95/13 0.20s} b5 {+15.27/14 0.18s} 40. Rc6+ {-11.35/20 0.17s}
Be6+ {+15.56/14 0.15s} 41. Rxe6+ {-11.62/17 0.18s} Kxe6 {+15.61/13 0.19s}
42. Bc6 {-12.02/16 0.18s} Kf5 {+16.08/16 0.23s} 43. g3 {-12.11/14 0.12s}
Rd3+ {+16.43/16 0.22s} 44. Kb2 {-12.60/15 0.18s} a4 {+20.08/15 0.14s}
45. Bxb5 {-12.82/12 0.12s} a3+ {+27.50/14 0.17s} 46. Kc1 {-14.61/13 0.11s}
Rxg3 {+27.88/17 0.19s} 47. Bd7+ {-14.41/13 0.14s} Kf6 {+28.50/16 0.14s}
48. h5 {-19.99/12 0.17s} a2 {+M21/18 0.24s} 49. Kb2 {-26.89/13 0.15s}
Ra3 {+M7/24 0.13s} 50. Be6 {-99.94/23 0.074s} a1=Q+ {+M5/127 0.032s}
51. Kc2 {-99.96/81 0.053s} Qc3+ {+M3/127 0.014s} 52. Kb1 {-99.98/121 0.022s}
Ra1# {+M1/127 0.013s, Black mates} 0-1
[/pgn]
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Minic version 3

Post by xr_a_y »

Werner wrote: Tue Nov 03, 2020 5:19 pm Very interesting!
Now we can compare your net with the one from Seer 1.1 :wink:
Yes !

Seer net is better inside Minic at short TC at least.
This look logical as the Seer net is based on SF data and is trained longer.
Minic one is using same data as Nascent Nutrient.
I'm trying to make "nefarious nucleus" stronger currently :twisted:
Madeleine Birchfield
Posts: 512
Joined: Tue Sep 29, 2020 4:29 pm
Location: Dublin, Ireland
Full name: Madeleine Birchfield

Re: Minic version 3

Post by Madeleine Birchfield »

Terje wrote: Tue Nov 03, 2020 5:29 pm You'll get him next time, Weiss :cry:
I remember you said at TCEC that you had plans to implement NNUE into your engine.
Madeleine Birchfield
Posts: 512
Joined: Tue Sep 29, 2020 4:29 pm
Location: Dublin, Ireland
Full name: Madeleine Birchfield

Re: Minic version 3

Post by Madeleine Birchfield »

xr_a_y wrote: Tue Nov 03, 2020 1:49 pm Second year anniversary for Minic :D ! and a new version number 3.00

Porting Stockfish NNUE implementation inside Minic was fun and instructive. This has clearly raised my interest in NN technologies and in this sense is a success.
As you already know, I was never comfortable with the big copy/paste of SF code involved, nor with the use of SF based nets of course.
This is why I first trained a net with my own data (but using Nodchip learner), namely the "napping nexus" net and then merged the learner directly inside Minic in order to train the pure Minic net named "nascent nutrient". Still, this was not enough to make me feel this technology and code can be inside Minic this way and in no way this can be considered as an "official" version of Minic as soon as a NNUE net is in use. This is why I decided to not use SF implementation anymore. This means that, starting from version 3, Minic is no more compatible with SF nets. Only versions 2.47 to 2.53 can read and use SF nets (and only using NNUE version 0x7AF32F16u nets).
I'm glad that people are moving away from Stockfish's unoptimised NNUE architecture and trainer code and trying to implement and optimise NNUE on their own.
connor_mcmonigle
Posts: 530
Joined: Sun Sep 06, 2020 4:40 am
Full name: Connor McMonigle

Re: Minic version 3

Post by connor_mcmonigle »

Congrats and thanks for consulting with me on this! I'm excited to see what kind of optimizations and architecture improvements you're able achieve. IMHO, the barrier to entry for making improvements/exploring different architectures is significantly lowered with my NN implementation as the C++ inference code totals a mere ~300 LOC :D (Compared to 5000 LOC for the NNUE implementation found in Stockfish). (The Pytorch training scripts are a bit more sizable, but still pretty light). Ultimately, I'm just pleased my networks can produce competitive results. I'll definitely be rooting for Minic at TCEC knowing that I contributed to its development. Rather amusingly, some improvements to the architecture since 1.0 now found both in Minic 3.0 and Seer 1.1 make the play far more aggressive I've found (the change is largely inspired by this paper: https://arxiv.org/abs/1608.06993 and involves concatenating encodings from separate layers to form skip connections to stabilize and improve training of deeper networks).