Train a neural network evaluation

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
brianr
Posts: 499
Joined: Thu Mar 09, 2006 2:01 pm

Re: Train a neural network evaluation

Post by brianr » Wed Sep 02, 2020 12:51 pm

I have never seen a batch size less than 1K.

The learning rate is by batch size.
So, for 1,024 batch size a LR=.0001 is about .1 for just one sample, which is close to your value.

There are rapid learning approaches with very high initial LRs.
See: https://www.youtube.com/watch?v=bR7z2MA0p-o

Most Leela training is done with a stepped LR schedule, for example:
.1 for 80K steps
.01 for 60K
.001 for 40K
.0001 for 20K
for a total of 200K steps.
Sometimes the initial LR is .2 or other values.
This schedule trains a reasonable Leela net, but several million steps are needed for a strong net.
All of this is specific to supervised learning (SL), not reinforcement learning (RL) with Leela type nets, which are quite different from NNUE nets.

Experiment with larger batch sizes initially and then reduce the value.
With an initial LR=.0001 and a 1K batch size progress will be quite slow.

jstanback
Posts: 88
Joined: Fri Jun 17, 2016 2:14 pm
Location: Colorado, USA
Full name: John Stanback

Re: Train a neural network evaluation

Post by jstanback » Wed Sep 02, 2020 12:59 pm

I am also updating the weights on every position, so I guess a batch size of one. Do LC0 and SFNNUE start by using random positions for tuning or some other method to get enough variety such that all the weights get tuned correctly?

John

brianr
Posts: 499
Joined: Thu Mar 09, 2006 2:01 pm

Re: Train a neural network evaluation

Post by brianr » Wed Sep 02, 2020 1:35 pm

I don't know about SF-NNUE and the like.

For the main Leela project (which is RL), until quite recently all games are from the starting position with initially random weights.
Then, the nets are trained with random samples from the games, which of course are over-represented by the starting position and likely first moves. There have been some experiments using games with opening books; I'm not sure how that is going.

Variety is created in the games played by various technical parameters.
Sample positions are randomly chosen after skipping N positions, with the default value of SKIP=32.

There is some evidence that Leela type nets train better with weaker play early and moving towards stronger play as the nets get "smarter".

David Carteau
Posts: 99
Joined: Sat May 24, 2014 7:09 am
Location: France
Full name: David Carteau
Contact:

Re: Train a neural network evaluation

Post by David Carteau » Sun Sep 06, 2020 12:40 pm

Fabio Gobbato wrote:
Tue Sep 01, 2020 12:25 pm
(...)
The net trained in this way gives a mean error of 200cp that is very high.
(...)
I have exactly the same here, while trying to implement my own NNUE trainer (see here) ! As far as I am concerned, I'm using as target the static eval from nn-82215d0fd0df.nnue net and my own dataset, built from CCRL games (and already used to tune v0.7).

That's not easy !

Fabio Gobbato
Posts: 168
Joined: Fri Apr 11, 2014 8:45 am
Full name: Fabio Gobbato
Contact:

Re: Train a neural network evaluation

Post by Fabio Gobbato » Fri Oct 23, 2020 3:38 pm

How do you choose the positions for the training? Is it better to use only quiet positions?

Karlo Bala
Posts: 331
Joined: Wed Mar 22, 2006 9:17 am
Location: Novi Sad, Serbia

Re: Train a neural network evaluation

Post by Karlo Bala » Sat Oct 24, 2020 1:33 pm

How good is Zurichess set with 725K positions?
I immediately spotted positions 6 and 10 which are IMO incorrectly marked as draws.



Best Regards,
Karlo Balla Jr.

Post Reply