Mayhem NNUE - New NN engine

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

Moderator: Ras

Damir
Posts: 2972
Joined: Mon Feb 11, 2008 3:53 pm
Location: Denmark
Full name: Damir Desevac

Re: Mayhem NNUE - New NN engine

Post by Damir »

Ahh I just saw you posted the latest release already. I have put your link to New engine release section.. Sorry I just saw your link now.. :(
Damir
Posts: 2972
Joined: Mon Feb 11, 2008 3:53 pm
Location: Denmark
Full name: Damir Desevac

Re: Mayhem NNUE - New NN engine

Post by Damir »

Thanks for the new engine anyway. :) :) :D
JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe »

No problem.
4.2 was a good version. But there were some details in 4.2 that weren't optimal so this was the reason for 4.3
Wasn't aware of clamp. etc. C++ is a great language.
All these small speedups which pile up when doing things billions of times :D
JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe »

Mayhem 4.5 unleashed: https://github.com/SamuraiDangyo/mayhem ... s/tag/v4.5

- Stupid VLA crap removed.
- Very minor speedup.
Mayhem 4.3: NPS: 4646460
Mayhem 4.5: NPS: 4765287

You can measure speed of the program by

Code: Select all

./mayhem bench
My 4800U gets 4.7 MNPS

Mayhem 4.5 demolished Crafty :D
[pgn][Event "Computer Chess Game"]
[Site "pc"]
[Date "2021.05.11"]
[Round "-"]
[White "Mayhem 4.5"]
[Black "Crafty-23.4"]
[Result "1-0"]
[TimeControl "60+1"]

1. e4 Nc6
{+0,19/16 2,8}
2. Nf3 e5
{+0,13/17 2,7}
3. Bb5 a6
{+0,15/16 2,7}
4. Ba4 Nf6
{+0,01/16 4}
5. d3
{+0,10/14 3}
5... d6
{-0,16/15 2,5}
6. c3
{+0,10/1 0,1}
6... Be7
{-0,20/17 2,5}
7. Nbd2
{+0,10/1 0,1}
7... O-O
{-0,38/16 2,4}
8. O-O
{+0,16/13 3}
8... Bg4
{-0,32/16 2,5}
9. h3
{+0,20/14 3}
9... Bd7
{-0,35/15 2,4}
10. Re1
{+0,35/13 3}
10... b5
{-0,24/15 2,3}
11. Bc2
{+0,29/14 3}
11... a5
{-0,04/16 4}
12. Nf1
{+0,46/14 3}
12... b4
{+0,02/16 2,2}
13. Ng3
{+0,54/13 3}
13... bxc3
{+0,10/15 3}
14. bxc3
{+0,63/15 2,9}
14... Rb8
{+0,15/17 2,8}
15. d4
{+0,86/13 2,8}
15... exd4
{+0,00/14 2,0}
16. cxd4
{+1,04/15 2,7}
16... Nb4
{+0,25/14 2,0}
17. Bb1
{+1,24/15 2,7}
17... Re8
{+0,11/13 2,1}
18. a3
{+1,46/13 2,6}
18... Nc6
{+0,51/14 1,9}
19. Ba2
{+1,67/14 2,5}
19... h6
{+0,58/15 2,1}
20. e5
{+1,67/13 2,5}
20... Nh7
{+1,05/15 2,2}
21. Qc2
{+1,55/12 2,4}
21... Ng5
{+1,12/15 1,9}
22. Bxg5
{+1,65/13 2,4}
22... Bxg5
{+2,39/15 1,8}
23. Rad1
{+1,65/11 2,3}
23... Rb6
{+1,07/13 1,8}
24. Bb1
{+1,69/10 2,3}
24... g6
{+1,15/14 1,9}
25. Ba2
{+1,30/11 2,2}
25... Kg7
{+0,85/14 1,8}
26. Qc3
{+1,32/11 2,2}
26... Be7
{+0,39/12 1,7}
27. Ne4
{+1,85/10 2,1}
27... Kg8
{+0,86/14 1,7}
28. Qd2
{+2,38/10 2,1}
28... g5
{+1,47/13 1,7}
29. Qc2
{+2,26/11 2,0}
29... dxe5
{+1,30/13 1,7}
30. dxe5
{+3,12/11 2,0}
30... Nb8
{+4,05/15 2,9}
31. e6
{+3,34/12 2,0}
31... fxe6
{+4,32/15 1,6}
32. Ne5
{+3,41/11 1,9}
32... Rf8
{+5,18/15 2,0}
33. Ng3
{+3,86/11 1,9}
33... Kh8
{+5,01/14 1,7}
34. Bb1
{+4,92/12 1,9}
34... Rxb1
{+4,32/15 1,7}
35. Ng6+
{+4,39/13 1,8}
35... Kg8
{+3,98/16 1,5}
36. Rxb1
{+5,10/12 1,8}
36... Nc6
{+4,18/16 1,5}
37. Nxf8
{+5,39/12 1,8}
37... Qxf8
{+4,43/17 1,9}
38. Rbd1
{+5,47/12 1,7}
38... Bd6
{+4,55/17 1,7}
39. Ne4
{+5,54/12 1,7}
39... Kf7
{+4,74/16 2,9}
40. Nxd6+
{+6,91/12 1,7}
40... cxd6
{+5,83/16 1,4}
41. Qh7+
{+6,76/12 1,7}
41... Ke8
{+5,82/18 1,4}
42. Re3
{+6,08/11 1,6}
42... Qe7
{+5,91/18 1,4}
43. Qg8+
{+7,02/13 1,6}
43... Qf8
{+4,26/2 0,1}
44. Rxe6+
{+7,13/14 1,6}
44... Bxe6
{+5,63/17 1,4}
45. Qxe6+
{+7,24/14 1,6}
45... Qe7
{+5,84/18 1,5}
46. Rxd6
{+7,18/14 1,5}
46... Qxe6
{+5,70/19 0,5}
47. Rxe6+
{+7,19/17 1,5}
47... Kd7
{+5,95/21 1,5}
48. Rxh6
{+4,71/19 1,5}
48... Nd4
{+5,95/20 1,5}
49. Rh5
{+4,53/19 1,5}
49... Ne6
{+6,02/21 1,5}
50. h4
{+5,05/19 1,5}
50... gxh4
{+5,86/18 1,5}
51. Rxa5
{+4,84/18 1,4}
51... h3
{+5,96/19 1,7}
52. Ra7+
{+5,08/19 1,4}
52... Kd6
{+6,01/18 1,7}
53. Ra6+
{+7,46/21 1,4}
53... Kd5
{+12,90/20 1,4}
54. Rxe6
{+8,12/20 1,4}
54... Kxe6
{+13,81/21 1,4}
55. gxh3
{+7,98/19 1,4}
55... Kd6
{+14,71/22 1,4}
56. h4
{+8,72/18 1,4}
56... Ke5
{+17,67/22 1,6}
57. a4
{+15,37/17 1,3}
57... Ke4
{+23,38/21 1,3}
58. h5
{+16,19/17 1,3}
58... Kf5
{+23,54/21 2,4}
59. a5
{+16,62/17 1,3}
59... Kg5
{+327,37/20 1,3}
60. a6
{+17,14/17 1,3}
60... Kxh5
{+327,45/19 1,0}
61. a7
{+17,50/16 1,3}
61... Kg4
{+327,47/16 1,0}
62. a8=Q
{+17,82/15 1,3}
62... Kf5
{+327,49/15 1,0}
63. Qd5+
{+17,50/12 1,3}
63... Kf6
{+327,51/15 1,0}
64. f4
{+17,83/12 1,3}
64... Ke7
{+327,53/15 1,0}
65. f5
{+18,94/12 1,3}
65... Kf6
{+327,55/15 1,0}
66. Qe6+
{+26,49/12 1,2}
66... Kg7
{+327,57/14 1,0}
67. Kf2
{+104,85/10 0,1}
67... Kf8
{+327,59/13 1,0}
68. Qd7
{+104,85/7 0,1}
68... Kg8
{+14,05/2 0,1}
69. Qe7
{+104,85/5 0,1}
69... Kh8
{+14,05/2 0,1}
70. f6
{+104,85/4 0,1}
70... Kg8
{+327,65/2 0,1}
71. Qg7#
{+104,85/3 0,1}

{Xboard adjudication: Checkmate} 1-0

[/pgn]
JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe »

Mayhem 4.7
https://github.com/SamuraiDangyo/mayhem ... s/tag/v4.7

- A few Elo stronger

Mayhem 4.7 is about 3,050-3,100 Elo
[pgn][Event "Computer Chess Game"]
[Site "ThinkPad"]
[Date "2021.05.27"]
[Round "-"]
[White "Mayhem 4.7"]
[Black "Stockfish 13"]
[Result "1/2-1/2"]
[TimeControl "40/60"]

1. d4 d5
{-0,40/21 1,1}
2. c4 e6
{-0,29/22 0,5}
3. Nf3 Nf6
{-0,17/20 0,6}
4. Nc3 Be7
{-0,25/21 0,7}
5. Bg5 h6
{-0,11/21 0,6}
6. Bh4 O-O
{-0,06/22 1,3}
7. e3 b6
{+0,01/25 2,3}
8. Be2 dxc4
{-0,04/22 1,2}
9. Bxc4 Bb7
{+0,00/23 0,5}
10. O-O
{+0,05/11 1,9}
10... Nbd7
{-0,20/28 7}
11. Qe2
{+0,05/1 0,1}
11... Nd5
{-0,10/25 0,5}
12. Nxd5
{+0,08/15 2,0}
12... exd5
{-0,05/24 0,7}
13. Bxe7
{+0,11/16 2,0}
13... Qxe7
{-0,09/25 0,9}
14. Bd3
{+0,11/16 2,0}
14... Rfc8
{-0,12/24 0,7}
15. Rfc1
{+0,11/14 2,0}
15... c5
{-0,05/23 0,8}
16. b3
{+0,09/14 2,0}
16... a5
{-0,13/25 0,8}
17. h3
{+0,11/14 2,0}
17... Rc7
{-0,06/22 0,8}
18. Bb5
{+0,14/13 2,0}
18... Nf6
{-0,11/23 1,4}
19. Rc2
{+0,11/14 2,0}
19... Bc8
{-0,17/24 1,1}
20. dxc5
{+0,08/13 2,0}
20... bxc5
{+0,00/23 0,9}
21. Rac1
{+0,10/13 2,0}
21... Bf5
{-0,03/25 0,8}
22. Bd3
{+0,11/14 2,0}
22... Bxd3
{-0,03/27 1,7}
23. Qxd3
{+0,05/14 2,0}
23... a4
{-0,06/27 0,6}
24. b4
{+0,17/15 2,0}
24... c4
{+0,08/24 1,0}
25. Qd2
{+0,11/15 2,0}
25... a3
{+0,46/26 0,9}
26. b5
{+0,02/14 2,0}
26... Rb7
{+0,46/27 1,0}
27. Rb1
{+0,03/14 2,0}
27... Rab8
{+0,40/28 2,5}
28. Nd4
{+0,03/15 2,0}
28... Ne4
{+0,29/25 1,4}
29. Nc6
{-0,01/14 2,0}
29... Qc5
{+0,65/27 1,0}
30. Qe1
{+0,00/14 2,0}
30... Rc8
{+0,64/28 1,4}
31. Nd4
{-0,37/14 2,0}
31... Nd6
{+0,52/31 1,6}
32. Qb4
{-0,53/14 2,0}
32... Nxb5
{+0,40/32 2,6}
33. Nxb5
{-0,08/15 2,0}
33... Qxb4
{+0,55/33 1,4}
34. Rxb4
{-0,32/18 2,0}
34... Rc5
{+0,38/32 1,6}
35. e4
{-0,43/18 2,0}
35... dxe4
{+0,39/32 1,5}
36. Rbxc4
{-0,44/17 2,0}
36... Rxc4
{+0,27/31 2,0}
37. Rxc4
{-0,49/19 2,0}
37... Rxb5
{+0,40/34 2,3}
38. Rxe4
{-0,40/18 2,0}
38... Rb1+
{+0,50/32 2,4}
39. Kh2
{-0,36/19 2,0}
39... Rb2
{+0,50/35 2,5}
40. Ra4
{-0,36/18 2,0}
40... Rxa2
{+0,38/34 3}
41. Ra7
{-0,36/17 1,5}
41... Kf8
{+0,43/31 0,9}
42. h4
{-0,39/18 1,5}
42... g6
{+0,59/28 0,9}
43. Kg3
{-0,30/17 1,5}
43... h5
{+0,51/31 2,0}
44. Kf3
{-0,32/17 1,5}
44... Ra1
{+0,45/33 2,4}
45. Kf4
{-0,37/17 1,5}
45... f6
{+0,37/34 2,6}
46. Ra6
{-0,27/17 1,5}
46... Kg7
{+0,37/32 0,7}
47. Ra7+
{-0,26/17 1,5}
47... Kg8
{+0,31/35 1,5}
48. Kf3
{-0,28/17 1,5}
48... Kf8
{+0,30/35 0,9}
49. Ra6
{-0,36/17 1,5}
49... Ke7
{+0,29/34 1,1}
50. g3
{-0,26/17 1,5}
50... a2
{+0,29/36 1,3}
51. Kg2
{-0,24/19 1,5}
51... Kd8
{+0,26/37 1,3}
52. Ra7
{-0,22/18 1,5}
52... Kc8
{+0,17/39 1,5}
53. f3
{-0,24/19 1,5}
53... Kb8
{+0,91/30 1,0}
54. Ra3
{-0,23/19 1,5}
54... g5
{+0,43/36 2,1}
55. hxg5
{-0,08/20 1,5}
55... fxg5
{+0,13/39 2,1}
56. f4
{-0,08/20 1,5}
56... gxf4
{+0,00/37 1,2}
57. gxf4
{-0,08/18 1,5}
57... Kc7
{+0,00/40 1,1}
58. Ra6
{-0,09/19 1,5}
58... Kd7
{+0,00/44 1,1}
59. f5
{-0,19/19 1,5}
59... h4
{+0,00/46 1,3}
60. Ra7+
{-0,07/17 1,5}
60... Ke8
{+0,00/45 1,1}
61. Kh2
{-0,08/18 1,5}
61... h3
{+0,00/48 1,1}
62. Ra8+
{-0,09/17 1,5}
62... Kf7
{+0,00/50 1,7}
63. Ra6
{-0,09/18 1,5}
63... Kg7
{+0,00/52 1,3}
64. Rg6+
{-0,08/19 1,5}
64... Kh8
{+0,00/56 1,3}
65. Rh6+
{-0,09/19 1,5}
65... Kg7
{+0,00/56 1,3}
66. Rg6+
{+0,00/24 1,5}
66... Kh8
{+0,00/53 1,4}
67. Rh6+
{+0,00/23 1,5}
67... Kg8
{+0,00/54 1,5}
68. Rg6+
{-0,04/20 1,5}
68... Kf7
{+0,00/55 1,6}
69. Ra6
{+0,00/24 1,5}
69... Ke7
{+0,00/55 1,7}
70. Re6+
{+0,00/18 1,5}
70... Kf8
{+0,00/56 1,6}
71. Rf6+
{+0,00/20 1,5}
71... Ke7
{+0,00/53 1,8}
72. Re6+
{+0,00/24 1,5}
72... Kf8
{+0,00/56 1,9}
73. Rf6+
{+0,00/23 1,5}
73... Ke8
{+0,00/56 1,9}
74. Re6+
{+0,00/18 1,5}
74... Kd7
{+0,00/57 1,6}
75. Ra6
{+0,00/18 1,5}
75... Kd8
{+0,00/58 2,1}
76. Ra7
{+0,00/21 1,5}
76... Ke8
{+0,00/57 1,7}
77. Ra8+
{+0,00/21 1,5}
77... Ke7
{+0,00/57 1,8}
78. Ra6
{-0,53/18 1,5}
78... Kf7
{+0,00/61 2,2}
79. f6
{-0,51/18 1,5}
79... Kg8
{+0,00/57 1,8}
80. Ra8+
{+0,00/22 1,5}
80... Kf7
{+0,00/58 1,3}
81. Ra6
{+0,00/24 1,5}
81... Kg6
{+0,00/58 1,3}
82. f7+
{-0,69/18 1,5}
82... Kxf7
{+0,00/59 1,3}
83. Ra8
{-0,53/18 1,5}
83... Ke6
{+0,00/60 1,3}
84. Ra6+
{-0,94/17 1,5}
84... Kd5
{+0,00/54 1,4}
85. Ra4
{-1,20/18 1,5}
85... Kc6
{+0,00/55 1,5}
86. Ra5
{-0,89/18 1,5}
86... Kd6
{+0,00/56 1,8}
87. Ra3
{-1,15/19 1,5}
87... Ke6
{+0,00/57 1,3}
88. Ra6+
{+0,00/24 1,5}
88... Kd5
{+0,00/58 1,9}
89. Ra4
{+0,00/24 1,5}
89... Kc6
{+0,00/59 2,4}
90. Ra5
{+0,00/24 1,5}
90... Rb1
{+0,00/55 1,4}
91. Rxa2
{+0,00/18 1,5}
91... Rb3
{+0,00/56 1,6}
92. Ra6+
{+0,00/16 1,5}
92... Kd5
{+0,00/55 1,6}
93. Ra5+
{+0,00/19 1,5}
93... Kc4
{+0,00/53 1,6}
94. Rh5
{+0,00/18 1,5}
94... Rb1
{+0,00/45 1,5}
95. Rxh3
{+0,00/18 1,5}
95... Rb2+
{+0,00/37 1,5}
96. Kg3
{-0,06/17 1,5}
96... Rb3+
{+0,00/51 1,4}
97. Kg4
{+0,00/19 1,5}
97... Rxh3
{+0,00/56 1,6}
98. Kxh3
{+0,00/36 1,5}

{Xboard adjudication: Insufficient mating material} 1/2-1/2

[/pgn]
JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe »

Build the binary and they will come ...

Mayhem 4.8: https://github.com/SamuraiDangyo/mayhem ... s/tag/v4.8
4.8 is just a little bit faster than 4.7. Probably a few +Elo.
Archimedes
Posts: 184
Joined: Tue Mar 05, 2019 3:43 pm
Full name: Archimedes

Re: Mayhem NNUE - New NN engine

Post by Archimedes »

Just for fun. :D
Tournament was played on Samsung Galaxy Tab A7 (Android 11) with Termux and the CETSA script.

c-chess-cli.conf:

Code: Select all

../bin/c-chess-cli/$CETSA_ABI/c-chess-cli -each \
  tc=10+0.1 \
  option.Hash=16 \
  option.Threads=1 \
  -engine cmd=../uci/Demolito "option.Contempt=0" \
  -engine cmd=../uci/Mayhem \
  -games 500 \
  -concurrency 4 \
  -openings file=../epd/5mvs_30k_analyzed.epd order=random \
  -repeat \
  -resign number=200 count=5 score=900 \
  -draw number=200 count=5 score=5 \
  -pgn games.pgn 1
c-chess-cli.txt:

Code: Select all

3-fold repetition: 55
50 moves rule: 13
Adjudication: 3
Checkmate: 417
Insufficient material: 11
Stalemate: 1
Time forfeit: 0
Bayeselo.txt:

Code: Select all

Rank Name                 Rating   Δ     +    -     #     Σ    Σ%     W    L    D   W%    =%   OppR 
---------------------------------------------------------------------------------------------------------
   1 Demolito 2021-03-28   3119   0.0   15   14   500  278.5  55.7  238  181   81  47.6  16.2  3081 
   2 Mayhem 5.0            3081  38.9   14   15   500  221.5  44.3  181  238   81  36.2  16.2  3119 
---------------------------------------------------------------------------------------------------------
  Δ = delta from the next higher rated opponent
  # = number of games played
  Σ = total score, 1 point for win, 1/2 point for draw
Games:
https://app.box.com/s/a7wvzl9v9mkwb6m2fy8sg6kspbvyyz9g
JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe »

Thanks!
3081 Elo! Excellent results. Recent developments has been just perfecting the Mayhem code base.
Checked through the games. Pretty much what I expected. Demolito is obviously super strong.

Some nice movements by Mayhem 5.0!
[pgn][Event "?"]
[Site "?"]
[Date "?"]
[Round "1.294"]
[White "Mayhem 5.0"]
[Black "Demolito 2021-03-28"]
[Result "1-0"]
[Termination "checkmate"]
[PlyCount "91"]
[FEN "rn1qkb1r/p1pbpppp/8/1p1n4/8/8/PPPPBPPP/RNBQK1NR w KQkq - 0 1"]
[SetUp "1"]

{--------------
r n . q k b . r
p . p b p p p p
. . . . . . . .
. p . n . . . .
. . . . . . . .
. . . . . . . .
P P P P B P P P
R N B Q K . N R
white to play
--------------}
1. Nc3 e6 2. Bxb5 Bxb5 3. Nxb5 Nd7 4. Nf3 c6 5. Nc3 Be7 6. O-O O-O 7. Qe2
Rc8 8. d3 Re8 9. Bd2 h6 10. Ne4 f5 11. Ng3 Bf6 12. c4 Bxb2 13. cxd5 Bxa1
14. Rxa1 cxd5 15. d4 Nf6 16. h3 Ne4 17. Bf4 Qb6 18. Kh2 Re7 19. Be5 Rb7 20.
Nh5 Rc4 21. Rg1 a5 22. Qe3 Rc3 23. Qf4 g5 24. Nf6+ Nxf6 25. Nxg5 Nd7 26.
Nf3 Kh7 27. g4 Rc2 28. Rg2 Nxe5 29. Nxe5 Qb1 30. gxf5 Qc1 31. Qf3 Rc3 32.
Qg4 Qg5 33. Qxg5 hxg5 34. f6 Kh6 35. h4 g4 36. Rxg4 Rc2 37. Kg3 Rc8 38. f3
Kh7 39. Kf4 Rf8 40. Rg6 Rg8 41. h5 Rbb8 42. Kg5 Rbc8 43. Nd7 Rgd8 44. Rg7+
Kh8 45. Ne5 Rc2 46. Ng6#
1-0

[/pgn]
Archimedes
Posts: 184
Joined: Tue Mar 05, 2019 3:43 pm
Full name: Archimedes

Re: Mayhem NNUE - New NN engine

Post by Archimedes »

JohnWoe wrote: ↑Sat Jun 12, 2021 11:16 am 3081 Elo! Excellent results.
Be aware, there was not set an offset (rating) for one of the engines. Bayeselo uses a default offset in that case. The calculated elo are based on that default offset.
JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: Mayhem NNUE - New NN engine

Post by JohnWoe »

Mayhem 5.2 !
Release: https://github.com/SamuraiDangyo/mayhem ... s/tag/v5.2

Added support for isready/stop/quit during search. Plus some +10 ELO

Testing 10,000 FRC games vs SF14. No time losses/illegal moves.
Also 10,000 FRC games 250ms. No time losses/illegal moves.
If there is then the GUI is buggy.

Code: Select all

FRC 1s
Score of Mayhem 5.2 vs Stockfish 14: 578 - 8965 - 457  [0.081] 10000
...      Mayhem 5.2 playing White: 283 - 4496 - 221  [0.079] 5000
...      Mayhem 5.2 playing Black: 295 - 4469 - 236  [0.083] 5000
...      White vs Black: 4752 - 4791 - 457  [0.498] 10000
Elo difference: -422.8 +/- 11.5, LOS: 0.0 %, DrawRatio: 4.6 %
Finished match