Toolkit to train a net without gensfen nor selfplay

Moderators: Elijah, Igbo, timetraveller

deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

2021.03.10 : i evaluated about 790m EPD from same previous games and from XGFS 2m games.

For this one, i changed a little bit the training command to get a longer training (=more evalsave files) :

Code: Select all

stockfish.bmi2.halfkp_256x2-32-32.nnue-learn.2020-07-19.exe
uci
setoption name SkipLoadingEval value true
setoption name Threads value 36
isready
learn targetdir training loop 100 batchsize 1000000 eta 1 lambda 1 eval_limit 32000 nn_batch_size 1000 newbob_decay 0.5 eval_save_interval 200000000 loss_output_interval 50000000 mirror_percentage 50 validation_set_file_name validation\1m_d17.bin
So with 1m d17 as validation data i got 15 evalsave files instead of only 9 (when trained with 1m d18 as validation data).

Same cutechess command.

With +310m (from 480m to 790m), i had got +20 elo (+20 elo to +40 elo) :

Code: Select all

   # PLAYER                           :  RATING  ERROR   POINTS  PLAYED   (%)     W      D     L  D(%)  OppAvg  OppN
   1 790m_d14_nn2_evalsave13_rejected :      40      6   3335.5    6000  55.6  1425   3821   754  63.7       0     1
   2 790m_d14_nn2_evalsave14_rejected :      35     11   1098.5    2000  54.9   439   1319   242  66.0       0     1
   3 790m_d14_nn2_evalsave9           :      35      6   3292.0    6000  54.9  1452   3680   868  61.3       0     1
   4 790m_d14_nn2_evalsave12          :      35      6   3291.5    6000  54.9  1406   3771   823  62.9       0     1
   5 790m_d14_nn2_evalsave10_rejected :      34     11   1096.5    2000  54.8   455   1283   262  64.2       0     1
   6 790m_d14_nn2_evalsave11          :      31     11   1087.0    2000  54.4   445   1284   271  64.2       0     1
   7 790m_d14_nn2_evalsave7_rejected  :      27     11   1076.5    2000  53.8   446   1261   293  63.0       0     1
   8 790m_d14_nn2_evalsave8           :      26     11   1074.5    2000  53.7   431   1287   282  64.3       0     1
   9 790m_d14_nn2_evalsave6           :      25     11   1071.0    2000  53.5   442   1258   300  62.9       0     1
  10 790m_d14_nn2_evalsave5           :      25     11   1069.5    2000  53.5   432   1275   293  63.8       0     1
  11 790m_d14_nn2_evalsave4_rejected  :      24     11   1066.5    2000  53.3   416   1301   283  65.0       0     1
  12 790m_d14_nn2_evalsave3           :      21     11   1060.0    2000  53.0   457   1206   337  60.3       0     1
  13 790m_d14_nn2_evalsave2           :       7     11   1018.5    2000  50.9   429   1179   392  59.0       0     1
  14 790m_d14_nn2_evalsave1           :       0     11   1001.0    2000  50.0   382   1238   380  61.9       0     1
  15 stockfish 190720 no-nnue         :       0   ----  19443.5   42000  46.3  6253  26381  9366  62.8      26    15
  16 790m_d14_nn2_evalsave0           :     -29     11    918.0    2000  45.9   309   1218   473  60.9       0     1

White advantage = 38.89 +/- 1.25
Draw rate (equal opponents) = 50.00 % +/- 0.00
I'm adding more games for evalsave14_rejected...

Some stats :
- 155 sec/game
- about 126 plies/game
- average depth between 27 to 29plies
- 1500 ms/ply
IbaiBuR

Top contribute Forum
Administrators
Points: 7 707,00 
Forum Contributions
Posts: 149
Joined: 05/01/2021, 15:29
Status: Offline (Active 4 Hours, 42 Minutes ago)
Medals: 1
Topics: 6
Reputation: 252
Location: Madrid, ES
Has thanked: 64 times
Been thanked: 319 times

Toolkit to train a net without gensfen nor selfplay

Post by IbaiBuR »

Why do you use the old trainer? Because the new trainer is definetely better and faster for both learning and generating process I believe.
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

Hi, because i don't need a new trainer nor a new bin format loool

Here we talk about toolkit without gensfen you know. Many people don't want to be screwed by the gensfen's internal eval of stockfish too.

Furthermore, all these posts are evidence this toolkit works well, no problem !
IbaiBuR

Top contribute Forum
Administrators
Points: 7 707,00 
Forum Contributions
Posts: 149
Joined: 05/01/2021, 15:29
Status: Offline (Active 4 Hours, 42 Minutes ago)
Medals: 1
Topics: 6
Reputation: 252
Location: Madrid, ES
Has thanked: 64 times
Been thanked: 319 times

Toolkit to train a net without gensfen nor selfplay

Post by IbaiBuR »

Yes you are complete right. Seems to work quite good. I thought it might have been better for just the learn process. But your approach seems to be working completely fine, so, keep working then. You are doing a great job anyways!
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

With this toolkit, we can choose which engine will evaluate our data, we can choose precisely which data will be evaluated, we keep the same statistics format, no need to compile anything.

To obtain a same net, I think that by choosing the data, you need a lot less positions than with data generated randomly by selfplay.
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

Image
When the loss value decrease, it smeels good.

Image
About the "_nn2" mention : i trained again the same data but with 1m d17 as validation (instead of 1m d18).
I plan to train again the 350m d14 data but with 1m d17 as validation data.

To help to compare, i added a net of 1 billion sfens generated and trained by the gensfen's command at fixed depth 10 with 1 million sfens at fixed depth 14 as validation data.
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

deeds wrote:Optional tool => plain_stats : https://mega.nz/folder/nwY2VTBA#amivGNttwxqFnvrtVRGYXg

ENJOY !
New release of plain_stats :
- new statistics (score min, score max, piecenumber min, piecenumber average, piecenumber max)
- updated MaterialImbalance's bounds (over +/-39 after promoted pawns)

ENJOY !
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

Here are some statistics concerning the PLAIN TEXT data extracted from different sources.
In parentheses, the minimum/maximum values encountered previously.

XGFS august 2020 (19 726 244 Ko) :
Games = 1 984 080
EPD = 207 325 187
epd/game = min. 1 (1), avg. 104 (124), max. 389 (398)

EPDStringLength = min. 33 (32), max. 82 (83)
PlainTextBlocSize = min. 66 (66), max. 117 (120)

score = min. -195,40, max. +227,26
Plies = min. 6 (1), max. 400 (400)
max50 = 99 coups (99)

PieceCount = min. 3 (2), avg. 14 (22), max. 32 (32)
MaterialImbalance = min. -22 (-44), max. 23 (62)
CCRL 40/4 until 2011 (25 910 673 Ko) :
Games = 2 348 249
EPD = 261 946 092
epd/game = min. 1 (1), avg. 112 (124), max. 396 (398)

EPDStringLength = min. 32 (32), max. 83 (83)
PlainTextBlocSize = min. 66 (66), max. 118 (120)

score = min. -319,49, max. +271,59
Plies = min. 3 (1), max. 400 (400)
max50 = 99 coups (99)

PieceCount = min. 2 (2), avg. 17 (22), max. 32 (32)
MaterialImbalance = min. -44 (-44), max. 62 (62)
ps : previous sources
http://outskirts.altervista.org/forum/viewtopic.php?p=25462&view=single_post#p25462
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

This weekend I found some motivation to improve my neural network.

As between my last 2 networks (480m and 790m sfens), there were not as many elo gains as before, I will wait to have evaluated 2B sfens before re-training a new network.

New data : i have already evaluated the CCRL 40-4 games (262m sfens) + the "6 first moves" (9m sfens) + thanks to cutechess, i generated 9m selfplay games from the "6 first moves" positions.

At the moment i'm extracting data from the 9m games :
Image
There are 90 files which contain 100k games each. I should take 10 days to extract 36 files of them. I hope to train my next net this summer. The duplicated sfens rate is about 0.8% so i won't lose many of them. I'm extracting about 44m sfens by day. As there are about 116 sfens/game, i can expect altmost 1b sfens only from these 9m games.

In sum : 790m (previous net) + 262m (ccrlf 40-4) + 9m (6 first moves) + 1b (9m games) should offer the 2b sfens in order to train a better net.
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

Previous week, I finished to extract the 1b sfens at d14 from the 9m selfplay's games (starting from the 6 first legal moves) :

selfplay_max6_plain.txt (103 285 759 Ko) :
Games = 9 127 090
EPD = 1 025 980 840
epd/game = min. 1 (1), avg. 112 (124), max. 393 (398)

EPDStringLength = min. 33 (32), max. 83 (83)
PlainTextBlocSize = min. 68 (66), max. 119 (120)

score = min. -319,61, max. +317,89
Plies = min. 4 (1), max. 398 (400)
max50 = 99 coups (99)

PieceCount = min. 3 (2), avg. 19 (22), max. 32 (32)
MaterialImbalance = min. -28 (-44), max. 36 (62)
This weekend, i appened all my PLAIN TEXT files into a big chunk :

Code: Select all

stockfish.x86-64-bmi2.halfkp_256x2-32-32.profile-learn.2020-08-30.exe
Stockfish 300820 by the Stockfish developers (see AUTHORS file)
learn convert_bin check_invalid_fen 1 check_illegal_move 1 output_file_name 2000m_d14.bin _2000m_d14\2000m_d14_plain.txt
learn command , learn from _2000m_d14\2000m_d14_plain.txt ,
base dir        :
target dir      :
convert_bin..
check_invalid_fen=1
check_illegal_move=1
convert _2000m_d14\2000m_d14_plain.txt ... done 2088285268 parsed 0 is filtered (invalid fen:0, illegal move:0, invalid ply:0)
all done
quit
2000m_d14_plain.txt (207 601 371 Ko) :
Games = 19 182 119
EPD = 2 088 285 268
epd/game = min. 1 (1), avg. 109 (124), max. 398 (398)

EPDStringLength = min. 32 (32), max. 83 (83)
PlainTextBlocSize = min. 66 (66), max. 119 (120)

score = min. -319,99, max. +319,99
Plies = min. 1 (1), max. 398 (400)
max50 = 99 coups (99)

PieceCount = min. 2 (2), avg. 17 (22), max. 32 (32)
MaterialImbalance = min. -44 (-44), max. 62 (62)
This week, i'm training my new net :

Code: Select all

stockfish.bmi2.halfkp_256x2-32-32.nnue-learn.2020-07-19.exe
uci
setoption name SkipLoadingEval value true
setoption name Threads value 36
isready
learn targetdir training loop 100 batchsize 1000000 eta 1 lambda 1 eval_limit 32000 nn_batch_size 1000 newbob_decay 0.5 eval_save_interval 500000000 loss_output_interval 125000000 mirror_percentage 50 validation_set_file_name validation\1m_d17.bin
2b sfens at d14 as training data , 1m sfens at d17 as validation data, a new evalsave after each 500m trained sfens :
Image
kenp_chess
Inactive User
Points: 54,00 
Posts: 8
Joined: 04/11/2019, 15:06
Status: Offline (Active 5 Hours, 9 Minutes ago)
Topics: 0
Reputation: 10
Has thanked: 116 times
Been thanked: 10 times

Toolkit to train a net without gensfen nor selfplay

Post by kenp_chess »

Hello! These look like wonderful NNUE tools! Can they be compiled for Mac OS (any recent version, 10.13.x to 11.2.x, High Sierra to Big Sur) or can you make the sources available? Thanks so much in advance!
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

Most personal links are here :
http://outskirts.altervista.org/forum/viewtopic.php?f=41&t=2009&start=30#p26457

I know only Windows based systems and i plan to stop to train nets soon.

But on the nodchip's github or the discord sf channel you should find all what you need.
kenp_chess
Inactive User
Points: 54,00 
Posts: 8
Joined: 04/11/2019, 15:06
Status: Offline (Active 5 Hours, 9 Minutes ago)
Topics: 0
Reputation: 10
Has thanked: 116 times
Been thanked: 10 times

Toolkit to train a net without gensfen nor selfplay

Post by kenp_chess »

Thank you! I will check nodchip's repository. Happy net training!
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

I'm searching the best validation data to get a long training session. With 1m d18 as validation data, it trained until 3.5b sfens versus only 2.5b sfens with 1m d17 as validation data. I will test with 1m d16 or 1m d19...
deeds
I've been banned!
Points: 6 000,00 
Posts: 246
Joined: 08/11/2019, 7:32
Status: Offline (Active 1 Year, 9 Months, 2 Weeks, 6 Days, 3 Hours, 37 Minutes ago)
Topics: 12
Reputation: 218
1
Location: France
Been thanked: 288 times

Toolkit to train a net without gensfen nor selfplay

Post by deeds »

2000m_d14_nn1 : 2B D14 as training data with 1M D17 as validation data

training command :

Code: Select all

stockfish.bmi2.halfkp_256x2-32-32.nnue-learn.2020-07-19.exe
uci
setoption name SkipLoadingEval value true
setoption name Threads value 36
isready
learn targetdir training loop 100 batchsize 1000000 eta 1 lambda 1 eval_limit 32000 nn_batch_size 1000 newbob_decay 0.5 eval_save_interval 500000000 loss_output_interval 125000000 mirror_percentage 50 validation_set_file_name validation\1m_d17.bin

NN1.BIN (evalsave4_rejected)
sfens              : 2 375 000 000
test_cross_entropy :      0.257523
move accuracy      :      34.6672%
loss               :     0.0465880
ordo ranking :

Code: Select all

   # PLAYER                              :  RATING  ERROR  POINTS  PLAYED   (%)     W     D     L  D(%)  OppAvg  OppN
   1 2000m_d14_nn1_evalsave4_rejected    :      49     11  1137.0    2000  56.9   547  1180   273  59.0       0     1
   2 2000m_d14_nn1_evalsave2             :      34     11  1095.0    2000  54.8   475  1240   285  62.0       0     1
   3 2000m_d14_nn1_evalsave3_rejected    :      34     11  1094.5    2000  54.7   476  1237   287  61.9       0     1
   4 2000m_d14_nn1_evalsave1             :      28     11  1079.5    2000  54.0   525  1109   366  55.5       0     1
   5 stockfish 190720 no-nnue            :       0   ----  4600.0   10000  46.0  1690  5820  2490  58.2      29     5
   6 2000m_d14_nn1_evalsave0             :      -2     11   994.0    2000  49.7   467  1054   479  52.7       0     1

White advantage = 48.40 +/- 2.53
Draw rate (equal opponents) = 50.00 % +/- 0.00
This training run was a little short with only 2.5B used sfens from 2B training data but there is even a gain versus my previous 790M D14 nets.
Post Reply

Return to “GUI's, Chess Utility, NNUE Free Networks”