The AntiFish NN Project Has Started (Stockfish 2.3.1 is AntiFish's Primary Goal)

4,961 views
Skip to first unread message

Cscuile

unread,
Dec 7, 2018, 11:41:52 PM12/7/18
to LCZero
Brief Summary: AntiFish's primary purpose is to test whether or not a Neural Network can train to target holes within the AB engine Stockfish. If AntiFish can surpass Leela ID 9155 (3074 Elo or around SF2.3.1 Strength) then it shows that AntiFish is specifically training to target SF's evaluation holes. This can one day be used to improve Stockfish Dev, if this concept works. 


AntiFish Details:
-6x64 Block
-20,000 Games Generated per network
-2,000 Steps (Looking to perhaps increase) 
-AntiFish 400 Nodes trains against Stockfish 2.3.1 with increasing nodes. 
-1024 Batch-Size
-0.2 LR Value
-For more details please feel free to ask me. 



Challenges and Difficulties: 
-Resources!
-As of right now, in order to get to 100k steps, it would take around 70 days worth of game generation, even with a 6 block. This is due to my CPU bottlenecking my GPU in game generation.
-At around 50,000 Nodes for Stockfish, training time will double from 1 day to 2 days to 4 days...etc as nodes double. (20,000 games)


Even with a 6 block, AntiFish requires quite a substantial amount of resources to train. Perhaps a solution is to train off of FishTest data then, switch back to AntiFish-Stockfish 10 Game generation. 


Thoughts & Conclusion:

I was wondering if any of you have any thoughts, suggestions, advice, or anything of that such. 

The main "Hub" of AntiFish is on the Stockfish Discord, a link will be provided below. 

A contribution client will likely be needed in the future if AntiFish is to become serious at targeting Stockfish 10's evaluation holes at higher nodes (100-500+ Million). 

Resources is the biggest issue with this project. My CPU is causing the main bottleneck in game generation. 

Some questions I have are, will AntiFish be able to Scale against Stockfish with higher nodes? Will Stockfish lose its evaluation weaknesses with increasing nodes? Will the most recent AlphaZero Cpuct client allow AntiFish to scale 50+ or more Elo? 


If you have any questions or advice please share it with me below. 


Thank you, 
Cscuile

Stockfish/AntiFish Discord: https://discord.gg/kfyhvX3
AntiFish ID Progress Rating List: https://docs.google.com/spreadsheets/d/1ZAIuHR6n-5JTxKQc0XUSx1jyUrgVEcj8DNLKA7-urBw/edit#gid=442598453

Margus Riimaa

unread,
Dec 8, 2018, 2:14:48 PM12/8/18
to LCZero
I like your project very much.

Cscuile

unread,
Dec 8, 2018, 2:24:18 PM12/8/18
to LCZero
Thank you!

Cscuile

unread,
Dec 8, 2018, 2:27:14 PM12/8/18
to LCZero
Just an update, my CPU is the main bottle neck in game generation. I generate 20k games per 2k steps. Since I have to increase nodes every time I train, the training will take twice as long (At 50k Nodes plus)

Because of this, I have to use Fishtest data now to train.

brian

unread,
Dec 8, 2018, 3:23:53 PM12/8/18
to LCZero
Just curious, how were you generating the games between sf and nn?

Cscuile

unread,
Dec 8, 2018, 4:31:07 PM12/8/18
to LCZero
The way I generate games is by playing AntiFish against Stockfish 2.3.1 at increasing nodes. This method is unfortunately far too time consuming since my CPU bottlenecks game generation.

Right now I am trying to find a way to use FishTest games, then bootstrap regular generated games to the network. 

smashu2

unread,
Dec 8, 2018, 6:19:47 PM12/8/18
to LCZero
Your strategy should be start with net 11248 and train it vs SF to see if you can squeeze more juice out of it than when you Have squeeze all you can than net 30 might be ready I would wait for a net to reach is ceiling and try to squeeze more out of it by training vs SF when everybody start a new net like 40 don't start from scratch.

Cscuile

unread,
Dec 8, 2018, 6:33:04 PM12/8/18
to LCZero
Hmm, good idea. I'll have a ton of data I'll have to download for ID 11248/11258 though. 

Daniel Rocha

unread,
Dec 8, 2018, 8:39:15 PM12/8/18
to csc...@gmail.com, lcz...@googlegroups.com
If you are doing with 11248/58, you might as well to start with SF10

--
You received this message because you are subscribed to the Google Groups "LCZero" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lczero+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lczero/074d7f98-9c50-4b8a-9964-ec873b25c5bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Daniel Rocha - RJ

Cscuile

unread,
Dec 8, 2018, 10:05:42 PM12/8/18
to LCZero
I'm not certain how long it will take to generate games for a 20b, but why not right?

Daniel Rocha

unread,
Dec 8, 2018, 10:51:37 PM12/8/18
to csc...@gmail.com, lcz...@googlegroups.com
Well, I might help you. I have a 1070 here.


For more options, visit https://groups.google.com/d/optout.

Cscuile

unread,
Dec 8, 2018, 10:55:44 PM12/8/18
to LCZero
Wow awesome! I really do appreciate the help with a project like this.

I'll need some way to gather games and to update the cutechess-cli game commands, but for now I think the Stockfish Discord should do just fine hopefully. 

Daniel Rocha

unread,
Dec 8, 2018, 11:01:56 PM12/8/18
to csc...@gmail.com, lcz...@googlegroups.com
Just send me a message on LC0 discord, I am Daniel, you know. I'm there frequently


For more options, visit https://groups.google.com/d/optout.
Message has been deleted

smashu2

unread,
Dec 8, 2018, 11:53:52 PM12/8/18
to LCZero
So it was previously thought that net 11248 as reach is limit your project will either confirm it or show it's still possible to improve 11248, also by improving vs SF I presume the NN will also improve in general vs all other AB engine it will be interesting to test if it's true or not.


On Friday, December 7, 2018 at 11:41:52 PM UTC-5, Cscuile wrote:

smashu2

unread,
Dec 8, 2018, 11:57:20 PM12/8/18
to LCZero
yes start training vs SF10 the purpose is to see if 11248 can develop opening strategy and pawn structures that sf 10 will struggle with.


On Saturday, December 8, 2018 at 8:39:15 PM UTC-5, Daniel Rocha wrote:

fauzi...@revton.com

unread,
Dec 9, 2018, 4:18:27 AM12/9/18
to LCZero
nice interesting project, please keep us updated

Cscuile

unread,
Dec 9, 2018, 8:11:30 AM12/9/18
to LCZero
Sure thing! I'll update you guys here as well as on the stockfish discord. 

Though, I will need help with the 20b and game generation. 

Pawel Powet

unread,
Dec 9, 2018, 10:10:43 AM12/9/18
to LCZero
So why don't you buy a new PC or new CPU at least, having such a big project in hand? Upgrading PC while running such a great project should be a priority for you! 

Edward Panek

unread,
Dec 9, 2018, 11:15:09 AM12/9/18
to LCZero
Thats being presumptuous.

No person has the same situation as another. 

Cscuile

unread,
Dec 9, 2018, 11:44:52 AM12/9/18
to LCZero
I wish I could! A Threadripper would make this project go much much faster! But I just can't afford to get a new CPU right now. 


On Sunday, December 9, 2018 at 10:10:43 AM UTC-5, Pawel Powet wrote:

Pawel Powet

unread,
Dec 9, 2018, 11:54:27 AM12/9/18
to LCZero
I don't agree.  His idea is to run a project that demand computation power. If this is what he want to do, so it is up to him to acquire needed components that let him to accomplish it and His situation has nothing to do with it. !

Edward Panek

unread,
Dec 9, 2018, 11:57:23 AM12/9/18
to LCZero
Or,,,a radical idea..engage people on a forum to help him?

Cscuile

unread,
Dec 9, 2018, 12:14:01 PM12/9/18
to LCZero
+1

Cscuile

unread,
Dec 9, 2018, 12:16:49 PM12/9/18
to LCZero
In the future once I increase SF to nodes above 50,000, I will definitely need help generating games or else it would take me decades to finish alone. (Training time doubles per doubling nodes)

If this concept works, it may have vast implications for chess engines so it is definitely worth experimenting! 

Daniel Rocha

unread,
Dec 9, 2018, 12:20:06 PM12/9/18
to Edward Panek, lcz...@googlegroups.com
Yes, this is why I am offering him my computer. In fact, I guess this is why he is posting on a forum!

--
You received this message because you are subscribed to the Google Groups "LCZero" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lczero+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

pradip ingale

unread,
Dec 9, 2018, 12:22:16 PM12/9/18
to LCZero
Leela 11248 already strong why not you continue this network against sf10 only three to four week you can achieve you're goal

Cscuile

unread,
Dec 9, 2018, 12:28:15 PM12/9/18
to LCZero
I currently have Test10's latest data downloading and I'm experimenting with a few training parameter configurations =D

Edward Panek

unread,
Dec 9, 2018, 12:52:46 PM12/9/18
to LCZero
+1!!!!

Jupiter

unread,
Dec 9, 2018, 1:35:13 PM12/9/18
to LCZero
Brief Summary: AntiFish's primary purpose is to test whether or not a Neural Network can train to target holes within the AB engine Stockfish.
 
Could you elaborate what these evaluation holes are all about. Or you just run match games between the project net and SF2.3.1 (Stockfish 2.3.1) and see if project net would defeat SF2.3.1?

Did you try to match between id 9155 and Sf2.3.1? What is the result and on what conditions. One of the issues of determining which is best between Lc0 and Sf is the  hardware conditions?

1. Test it at same hardware cost?

a. Lc0
High end gpu + low end cpu to minimize cost

b. Stockfish
High end cpu + low end gpu to match the cost of Lc0

c. Limit the total cost to n usd, since Sf2.3.1 does not scale well with number of cpu, it is an old program.

d. Limit project net to use GTX 1060 or something lower, test it against Sf2.3.1 on what cpu? on a cpu such that they can play on equal TC and Sf2.3.1 must have a better result in the beginning or on certain stage of training. This gap in strength will be your target to achieve your goal to defeat St2.3.1. You need a clear metric to determine if you already achieve your goal or not.

Cscuile

unread,
Dec 9, 2018, 5:58:21 PM12/9/18
to LCZero
Stockfish sometimes misevaluates positions as winning, when Lc0 finds it to either be losing or a draw. AntiFish will attempt to specifically get into these positions against SF.

Daniel Rocha

unread,
Dec 9, 2018, 7:09:58 PM12/9/18
to csc...@gmail.com, lcz...@googlegroups.com
I thought you'd go for 11248/58, instead of going all the way from the bottom.

--
You received this message because you are subscribed to the Google Groups "LCZero" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lczero+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Cscuile

unread,
Dec 9, 2018, 7:18:32 PM12/9/18
to LCZero
Sorry, I should have said that this will be done after the initial bootstrap. 

Daniel Rocha

unread,
Dec 9, 2018, 7:26:21 PM12/9/18
to csc...@gmail.com, lcz...@googlegroups.com
What is the importance of the initial bootstrap?


For more options, visit https://groups.google.com/d/optout.

Cscuile

unread,
Dec 9, 2018, 7:30:59 PM12/9/18
to LCZero
The main issue with getting a network going is getting enough games to train off off. A initial bootstrap will allow for the NN to get relatively strong. After this is done you can start generating games via AntiFish vs Stockfish 10 play. 

Right now I am trying out a 15x192 block network. For Leela this is around 3300 Elo. From what I've heard, a 20b is too much for my hardware and too time consuming. 

If this doesn't work, I'll have to lower it one more step. 

Daniel Rocha

unread,
Dec 9, 2018, 7:34:18 PM12/9/18
to csc...@gmail.com, lcz...@googlegroups.com
Why not literally programing an FPGA with neurons? I mean, not you, but would there be an advantage? Every time you need more, you just increase the space.


For more options, visit https://groups.google.com/d/optout.

Cscuile

unread,
Dec 9, 2018, 7:50:11 PM12/9/18
to LCZero
Hmm, I'm not sure. 

Cscuile

unread,
Dec 9, 2018, 9:21:57 PM12/9/18
to LCZero
AntiFish 15x192 Bootstrap just finished. At .1+.1 TC it is +400 Elo to SF9. In comparison ID 11248 is +600 Elo. Now the question is, do I go for a 20b? 

Cscuile

unread,
Dec 9, 2018, 9:30:05 PM12/9/18
to LCZero
.01+.01 TC**

Cscuile

unread,
Dec 9, 2018, 9:33:32 PM12/9/18
to LCZero
Dang, I missed the fact that SF was losing on time. 

On Sunday, December 9, 2018 at 9:30:05 PM UTC-5, Cscuile wrote:
.01+.01 TC**

Cscuile

unread,
Dec 10, 2018, 1:19:01 AM12/10/18
to LCZero
The suggest YAML settings was the issue. Now that I have a better understanding of the training parameters, I will be using my own settings. 

garrykli...@gmail.com

unread,
Dec 10, 2018, 7:43:32 AM12/10/18
to LCZero
How could you possibly disagree? He said he should supply the power if he wants a separate project, to which you say he is engaging people for help, all that is is semantics. Obviously he knows that he is 'engaging' people for free help....thats what hes annoyed at since everything is only pulling away resources from the original projects ;) ;) ;)

In other words nothing wrong with it, but it is pretty bitchy that he rides the throbbing spike of both lc0 AND stockfish forums. Riding whatever wave of feeling he has this week... 'ohhh lc0.... ooooo sf 1billion......ohhhh both'

Cscuile

unread,
Dec 13, 2018, 1:44:27 AM12/13/18
to LCZero
If anyone here would like to contribute games to the AntiFish project. I have created a file with everything you need to start generating games. If you need any help please feel free to ask me here or on discord. 

https://drive.google.com/file/d/1LLl9glt8jRTtmnGEVNnVAFhqyzTbQje8/view?usp=sharing

Cscuile

unread,
Dec 13, 2018, 2:10:36 AM12/13/18
to LCZero
Oh I forgot to mention, if you would like to use more of your GPU/CPU, duplicate the file and run another CMD.

Cscuile

unread,
Dec 14, 2018, 10:08:36 AM12/14/18
to LCZero
Updated Game generation v2. You do not have to download everything. You can just download the latest SF version, as well as the latest command. 

Includes:
CUDA
OpenCL
CUDA FP16

Lothar Jung

unread,
Dec 16, 2018, 10:49:48 AM12/16/18
to LCZero
What about updating your rating list?
After the changes in lc0 0.19.2 it could be interesting!

Cscuile

unread,
Dec 16, 2018, 10:50:39 AM12/16/18
to LCZero
I'll test it right after AntiFish ID 1 is trained. 

Cscuile

unread,
Dec 16, 2018, 11:00:09 AM12/16/18
to LCZero
Major AntiFish Update: In order to start training AntiFish ID 1 we need 400k FishTest games and 100k generated games. Right now we have over 100k generated games and 200k FishTest games.

The main issue now is that I have 8 million FishTest games however they have FEN starting positions which is an issue for the trainingdata tool converter which does not accept FEN. 

I am attempting to search for positions within FEN, so far I have found 200k. 

gvergh...@gmail.com

unread,
Dec 16, 2018, 12:35:03 PM12/16/18
to LCZero
You can use dkappe's lczero supervise build, but it works only in Linux.

Or I could convert the fens to training data and upload for you.

Cscuile

unread,
Dec 16, 2018, 12:38:57 PM12/16/18
to LCZero
There's quite a bit of data to download. Around 32 GBs worth. How could you convert FENS into training data?

gvergh...@gmail.com

unread,
Dec 16, 2018, 12:46:20 PM12/16/18
to LCZero
Check dkappe's repo -- lczero supervise

I can help if you need me to :)

Cscuile

unread,
Dec 16, 2018, 12:49:19 PM12/16/18
to LCZero
Sure. I would love help. Lczero supervise doesn't have information on figuring out the FEN issue from what I saw. How could I continue from here? 

gvergh...@gmail.com

unread,
Dec 16, 2018, 12:51:29 PM12/16/18
to LCZero

Send me the link to the games -- would be better to split up the games to maybe 100,000 per pgn.

Once I've converted them, I'll upload them for you.

gvergh...@gmail.com

unread,
Dec 16, 2018, 12:52:37 PM12/16/18
to LCZero

If splitting the pgn's is an issue, I'll handle that also :)

Cscuile

unread,
Dec 16, 2018, 12:55:04 PM12/16/18
to LCZero
Sure. I can't fit all the games in my drive due to the GB limit. But I'm uploading all the games I have compressed so far. 

gvergh...@gmail.com

unread,
Dec 16, 2018, 12:57:03 PM12/16/18
to LCZero

I have about 4 laptop drives handy, so 32gb isn't an issue...

The issue would be the time it takes !!

Cscuile

unread,
Dec 16, 2018, 1:00:39 PM12/16/18
to LCZero
Here you go! Sorry, I mean that I can't fit the data in my drive. https://drive.google.com/open?id=1yqrYgBLpZ3Fyhshce4Sy3Cs2YYETVqou

Cscuile

unread,
Dec 16, 2018, 1:01:13 PM12/16/18
to LCZero
Please tell me if you are able to make this data usable. 

gvergh...@gmail.com

unread,
Dec 16, 2018, 1:05:53 PM12/16/18
to LCZero

I'm not sure I understand your question.
If you have doubts, send maybe 100 games...
Then, you can test the data and decide.

gvergh...@gmail.com

unread,
Dec 16, 2018, 1:07:31 PM12/16/18
to LCZero

Didn't see your previous post !


Cscuile

unread,
Dec 16, 2018, 1:07:35 PM12/16/18
to LCZero
The drive link contains around 200k compressed games. 

I was wondering if you can make this data convertable into NN training data using the training tool. 

Cscuile

unread,
Dec 16, 2018, 1:08:25 PM12/16/18
to LCZero
No problem =D

gvergh...@gmail.com

unread,
Dec 16, 2018, 1:26:31 PM12/16/18
to LCZero

Strange...pgn-extract flagged all the pgns as "invalid fen detected", but the converter is working fine.
Running at about 1000 games in 21 secs -- doing pgn 21000 now...

Once I do the first pgn, I'll upload it..
Try to test asap if it works for you, so I can continue with it.

Cscuile

unread,
Dec 16, 2018, 1:28:18 PM12/16/18
to LCZero
Yeah, unfortunately those games are all bugged since they are shifted over. 

gvergh...@gmail.com

unread,
Dec 16, 2018, 1:33:16 PM12/16/18
to LCZero

btw, are you using the swa training pipeline ?

Cscuile

unread,
Dec 16, 2018, 1:35:05 PM12/16/18
to LCZero
I plan to. But i haven't tested it yet. Would you happen to know what Values swa steps and swa max n I should use? Here is my YAML. 

%YAML 1.2
---
name: 'AntiFish_ID_1_v1'                  # ideally no spaces
gpu: 0                                 # gpu id to process on

dataset: 
  num_chunks: 1000000                   # newest nof chunks to parse
  train_ratio: 0.90                    # trainingset ratio
  # For separated test and train data.
  #input_train: '/ramdisk/dev/train/' # supports glob
  #input_test: '/ramdisk/dev/test/'  # supports glob
  # For a one-shot run with all data in one directory.
  input: 'D:\Leela_Pipeline\Training_Games\!AntiFish_ID_1_v1\AF*\'

training:
    swa: true
    swa_steps: 100
    swa_max_n: 50
    batch_size: 512                   # training batch
    num_batch_splits: 3
    test_steps: 20000                    # eval test set values after this many steps
    train_avg_report_steps: 500        # training reports its average values after this many steps.
    total_steps: 200000                  # terminate after these steps
    checkpoint_steps: 149000          # optional frequency for checkpointing before finish
    shuffle_size: 500000               # size of the shuffle buffer
    lr_values:                         # list of learning rates
        - 0.2
        - 0.02
        - 0.002
        - 0.0002
    lr_boundaries:                     # list of boundaries
        - 50000
        - 100000
        - 150000
    policy_loss_weight: 1.0            # weight of policy loss
    value_loss_weight: 1.0            # weight of value loss
    path: 'D:\Leela_Pipeline\networks'         # network storage dir

model:
  filters: 256
  residual_blocks: 20
...

gvergh...@gmail.com

unread,
Dec 16, 2018, 1:46:12 PM12/16/18
to LCZero

Well, before that, I can tell you the SWA pipeline will not parse this converted training data.

You would need the SE compile of lc0 to do self training.

This converted data works well with the regular training pipeline.

About the YAML, that seems to be a swa yaml.

Anyway, here's the converted data for 1.pgn


I'll await your feedback before proceeding...

Cscuile

unread,
Dec 16, 2018, 1:48:43 PM12/16/18
to LCZero
How did you convert the FEN data into training data? I would love to know how. 

gvergh...@gmail.com

unread,
Dec 16, 2018, 1:53:48 PM12/16/18
to LCZero

I already told you...

The training tool by fernsbery doesn't work on fens.

Cscuile

unread,
Dec 16, 2018, 1:55:13 PM12/16/18
to LCZero
Oh I see, " lczero supervise build". Thank you so much! I wish it worked on windows 10 as well. 

I really owe you one! 

Cscuile

unread,
Dec 16, 2018, 1:58:04 PM12/16/18
to LCZero
In the future, do you mind if I send you the compressed data for all fishtest games? I will need to find somewhere to upload it other than Google Drive since I don't have space there. 

I can send you the data someday here or on the Stockfish Discord. 
Stockfish/AntiFish Discord: https://discord.gg/kfyhvX3

Thank you so much again! This was a really big issue. 

gvergh...@gmail.com

unread,
Dec 16, 2018, 1:58:32 PM12/16/18
to LCZero
 
So does it work ?

Cscuile

unread,
Dec 16, 2018, 2:01:39 PM12/16/18
to LCZero
Yup! I believe so! As long as there aren't any invalid FEN errors this should be perfect.

On Sunday, December 16, 2018 at 1:58:32 PM UTC-5, gvergh...@gmail.com wrote:
 
So does it work ?

gvergh...@gmail.com

unread,
Dec 16, 2018, 2:05:08 PM12/16/18
to LCZero

"In the future, do you mind if I send you the compressed data for all fishtest games? I will need to find somewhere to upload it other than Google Drive since I don't have space there. 

I can send you the data someday here or on the Stockfish Discord. 
Stockfish/AntiFish Discord: https://discord.gg/kfyhvX3

Thank you so much again! This was a really big issue."


You can post the links here and I'll upload the data once done.

Most welcome -- just trying to help where I can.

And you have to thank dkappe for his amazing tool -- I'm just an operatot !!

Cscuile

unread,
Dec 16, 2018, 4:30:34 PM12/16/18
to LCZero
I'm currently 100k games short. Can you please convert the rest of the games above into training data? 

gvergh...@gmail.com

unread,
Dec 16, 2018, 4:46:43 PM12/16/18
to LCZero
7.pgn and 6.pgn had a few games and this sets me back a lot, since I have to redo thr conversion from the start.

gvergh...@gmail.com

unread,
Dec 16, 2018, 4:56:59 PM12/16/18
to LCZero

Typing on the phone is hard !!

7.pgn and 6.pgn had a few bad games and this sets me back a lot, since I have to redo the conversion from the start.

1.2 gb being uploaded now -- will take another 15 min...


Cscuile

unread,
Dec 16, 2018, 4:59:22 PM12/16/18
to LCZero
Sweet! Thanks so much for doing this! Yeah, I found that Fishtest has quite a few variations within their games. 

gvergh...@gmail.com

unread,
Dec 16, 2018, 5:11:20 PM12/16/18
to LCZero

Cscuile

unread,
Dec 16, 2018, 5:13:55 PM12/16/18
to LCZero
Cheers! That's perfect! I can start training AntiFish ID 1 now. 😊

On Sunday, December 16, 2018 at 5:11:20 PM UTC-5, gvergh...@gmail.com wrote:

gvergh...@gmail.com

unread,
Dec 16, 2018, 5:16:17 PM12/16/18
to LCZero

How many iterations are you doing ?

Cscuile

unread,
Dec 16, 2018, 5:20:49 PM12/16/18
to LCZero
Hmm, still not certain. 

Cscuile

unread,
Dec 16, 2018, 5:21:35 PM12/16/18
to LCZero
It mostly just depends on how many contributors we can get. I may do an ID every 50k new games at 800 node playouts. 

Jon Mike

unread,
Dec 16, 2018, 10:25:48 PM12/16/18
to LCZero
Very excited about this project guys!  :)

Cscuile

unread,
Dec 16, 2018, 10:53:38 PM12/16/18
to LCZero
=D AntiFish ID 1 v1 training has begun. I will be releasing the ID on the stockfish discord. 

For anyone who hasn't joined please do. Stockfish will be the central hub for the AntiFish Project. 

Link: https://discord.gg/nv8gDtt

Cscuile

unread,
Dec 17, 2018, 12:31:29 PM12/17/18
to LCZero
At around 100k steps out of 400k, the network is randomly sacrificing pieces for no reason. I have a feeling the Fishtest games may be bugged. 


On Sunday, December 16, 2018 at 5:16:17 PM UTC-5, gvergh...@gmail.com wrote:

gvergh...@gmail.com

unread,
Dec 17, 2018, 1:54:15 PM12/17/18
to LCZero

scs-ben would be the best person to consult regarding 3rd party nets -- he's on discord...

What is the learn rate showing in the console ?

Cscuile

unread,
Dec 17, 2018, 3:46:46 PM12/17/18
to LCZero
0.02, please join the stockfish discord. It's easier to post updates there. I have posted dozens of console values so far. 

gvergh...@gmail.com

unread,
Dec 17, 2018, 4:04:45 PM12/17/18
to LCZero
NN's are really a "black box" tbh...
Error323 mentioned that even after supervised learning training, there wasn't any improvements -- only after self play games are added will there be gains.

Cscuile

unread,
Dec 17, 2018, 5:36:45 PM12/17/18
to LCZero
They are! One question. How confident are you that the FishTest data is not bugged? One of the reasons why AF ID 1 may be so weak is due to the high LR values I'm using. I should have lower it more with such a low batch size. 

gvergh...@gmail.com

unread,
Dec 17, 2018, 7:01:27 PM12/17/18
to LCZero
ASFAIK, the lowest tc of fishtest is 10+ mins and the highest is 60+ -- the quality should be good.
About lr, I would try 0.2 to 0.02 to 0.002, close to the defaults.
And remember, you're training a 20x256, which takes a long time.

I think Gary trained his first 64x6 to 90% accuracy.

Cscuile

unread,
Dec 17, 2018, 7:05:42 PM12/17/18
to LCZero
Here's what I have in plan. After 200k I will stop the training and switch to this updated YAML

%YAML 1.2
---
name: 'AntiFish_ID_1_v1'                  # ideally no spaces
gpu: 0                                 # gpu id to process on

dataset: 
  num_chunks: 656157                   # newest nof chunks to parse
  train_ratio: 0.90                    # trainingset ratio
  # For separated test and train data.
  #input_train: '/ramdisk/dev/train/' # supports glob
  #input_test: '/ramdisk/dev/test/'  # supports glob
  # For a one-shot run with all data in one directory.
  input: 'C:\Users\Cscuile\Documents\Training_Games_C_Drive\AFData*\'

training:
    swa: true
    swa_steps: 100
    swa_max_n: 50
    batch_size: 512                   # training batch
    num_batch_splits: 1
    test_steps: 40000                    # eval test set values after this many steps
    train_avg_report_steps: 100        # training reports its average values after this many steps.
    total_steps: 400000                  # terminate after these steps
    checkpoint_steps: 40000          # optional frequency for checkpointing before finish
    shuffle_size: 500000               # size of the shuffle buffer
    lr_values:                         # list of learning rates
        #- 0.2
        #- 0.02
        #- 0.002
        - 0.0002
        - 0.00002
        - 0.000002
        - 0.0000002
    lr_boundaries:                     # list of boundaries
        #- 100000
        #- 200000
        - 240000
        - 280000
        - 320000
        
    policy_loss_weight: 1.0            # weight of policy loss
    value_loss_weight: 1.0            # weight of value loss
    path: 'D:\Leela_Pipeline\networks'         # network storage dir

model:
  filters: 256
  residual_blocks: 20
...

gvergh...@gmail.com

unread,
Dec 17, 2018, 9:53:26 PM12/17/18
to LCZero

Warning : Long post ahead :)

I checked some of the fishtest games you sent...
Yes, there are dubious moves in them -- maybe those positions are just to test patches and not for gameplay.

Then, I tried an interesting experiment.
From a base of sf vs sf games, 1sec per move, using 5000+ openings (swcr-fq-openings-v4.1), I extracted all e4-e5 wins -- about 76000.
And yes, the base wasn't good as well.
Started training a 64x6 for 40,000 iterations, just using 25,000 games and 5000 from that for testing -- it took 3 hours on my laptop :)

Played against sf8, 2m + 1, e4-e5 start pos...

[Event "My Tournament"]
[Site "?"]
[Date "2018.12.17"]
[Round "1"]
[White "stockfish_8_x64_bmi2"]
[Black "lc0-film"]
[Result "1-0"]
[ECO "C41"]
[Opening "Philidor"]
[PlyCount "31"]
[TimeControl "120+1"]
[Variation "Larsen Variation"]

1. e4 {book} e5 {book} 2. Nf3 {+0.26/21 6.2s} d6 {+0.05/9 2.1s}
3. d4 {+0.41/22 3.8s} exd4 {+0.08/10 1.8s} 4. Nxd4 {+0.37/23 3.7s}
g6 {+0.02/9 4.9s} 5. Nc3 {+0.53/20 1.9s} Bg7 {+0.03/8 3.0s}
6. Be3 {+0.72/21 2.6s} Nf6 {-0.04/9 4.7s} 7. Qd2 {+0.57/20 1.0s}
d5 {-0.11/9 4.5s} 8. exd5 {+1.18/19 1.9s} Nxd5 {-0.07/9 1.4s}
9. Bg5 {+1.37/20 2.0s} f6 {+0.01/8 3.4s} 10. O-O-O {+1.54/21 2.1s}
Kf7 {+0.17/8 3.5s} 11. Bc4 {+4.72/19 1.8s} h6 {-0.09/7 4.1s}
12. Nxd5 {+17.88/19 2.1s} c6 {+0.09/7 4.5s} 13. Nxf6+ {+M21/22 2.1s}
Ke7 {+0.22/7 2.9s} 14. Nf5+ {+M5/110 2.2s} gxf5 {-8.72/5 1.9s}
15. Ng8+ {+M3/127 0.005s} Kf8 {-80.08/3 3.2s}
16. Qxd8# {+M1/127 0.003s, White mates} 1-0

[Event "My Tournament"]
[Site "?"]
[Date "2018.12.17"]
[Round "1"]
[White "lc0-film"]
[Black "stockfish_8_x64_bmi2"]
[Result "0-1"]
[ECO "C24"]
[Opening "Bishop's Opening"]
[PlyCount "34"]
[TimeControl "120+1"]
[Variation "Berlin defense"]

1. e4 {book} e5 {book} 2. Bc4 {+0.04/9 2.1s} Nf6 {+0.07/21 4.5s}
3. d3 {-0.04/10 2.0s} c6 {+0.06/21 2.2s} 4. Qe2 {0.00/9 3.5s}
Bc5 {+0.15/20 3.1s} 5. f4 {+0.08/10 5.2s} d5 {+0.66/18 2.6s}
6. Bb3 {+0.04/9 1.3s} Nbd7 {+0.50/20 6.5s} 7. Bd2 {+0.02/8 4.6s}
O-O {+1.20/18 2.7s} 8. exd5 {-0.03/8 5.1s} Re8 {+2.46/19 1.8s}
9. d6 {+0.02/8 3.5s} exf4 {+6.54/18 1.4s} 10. Bxf4 {+0.12/8 2.4s}
Nh5 {+8.09/22 1.4s} 11. g3 {0.00/8 2.5s} Nxf4 {+12.39/22 1.6s}
12. Qe7 {+0.08/8 5.4s} Rxe7+ {+20.12/19 1.6s} 13. dxe7 {-0.12/9 2.0s}
Qxe7+ {+21.81/25 1.6s} 14. Kd2 {-0.09/8 2.8s} Qe3+ {+M17/26 2.1s}
15. Kc3 {-4.44/6 2.3s} Qe1+ {+M5/127 0.13s} 16. Nd2 {-14.22/7 0.81s}
Qe5+ {+M3/127 0.004s} 17. d4 {-78.47/3 6.0s} Qxd4# {+M1/127 0.003s, Black mates}
0-1

Checking the games, I found the net played for the the highest win rates exactly upto ply 7 -- after that, it became rubbish.
So, it shows it does take time and the base is very, very important.

Which leads to my next question -- why not make a base using the strongest games ever ?
Just CC players 2500+, only wins.
AB engines hardly understand the moves and a strong human with an engine is the best combination for gameplay.
Eventually, it's only an NN that can even process such games.
Gary trained the base lczero net with 60,000 games from kingbase, upto a training accuracy of 90%.
Let me know what you think.

About your yaml...

  # For separated test and train data.
  input_train: '/ramdisk/dev/train/' # supports glob
  input_test: '/ramdisk/dev/test/'  # supports glob
 
  Use seperate testing and training data.
  This way, you can monitor progress and change settings if progress stops or even reduces.
  Just copy 25% of the training data to the testing folder, and the progress will be tested against that data.

   test_steps: 40000                    # eval test set values after this many steps

   This should be lower, imo -- no point training blind. I'd suggest 5000 or 10000
   You can change settings or lr when training accuracy stalls.
   For example, here's the progress of my 3 hour session...

step 1, policy=7.54741 training accuracy=0.0244141%, mse=0.269066
swa step 1, policy=7.52726 training accuracy=0.325521%, mse=0.25
step 10000, policy=1.75066 training accuracy=47.9655%, mse=0.503662
swa step 10000, policy=2.12102 training accuracy=38.4603%, mse=0.504557
step 20000, policy=1.5826 training accuracy=51.4567%, mse=0.494629
swa step 20000, policy=1.66003 training accuracy=50.1465%, mse=0.505452
step 30000, policy=1.54235 training accuracy=52.0508%, mse=0.497396
swa step 30000, policy=1.54725 training accuracy=52.7751%, mse=0.506104

    checkpoint_steps: 40000          # optional frequency for checkpointing before finish

    This should be lower, so you can pause it at any time and still restore the latest model without losing progress.
    I'd do 20000.

       lr_values:                         # list of learning rates
        #- 0.2
        #- 0.02
        #- 0.002
        - 0.0002
        - 0.00002
        - 0.000002
        - 0.0000002

  Checking the web on deep learning, I found many writeups that said anything lower than a thousandth is useless.
  I feel you should stop at 0.002

    lr_boundaries:                     # list of boundaries
        #- 100000
        #- 200000
        - 240000
        - 280000
        - 320000
   
     If you're doing 400,000 iterations, I would probably do this...
     - 100000
     - 300000

     0.2 upto 100000
     0.02 upto 300000
     0.002 upto 400000       
   
     path: 'D:\Leela_Pipeline\networks'         # network storage dir

     This is very important -- a backup of your model.
     And if you restart the session, it'll continue from the latest model found.

Cscuile

unread,
Dec 17, 2018, 10:58:43 PM12/17/18
to LCZero
First off I wanted to say Thank You! You have been the biggest help for me in this project. To be honest, I was losing some motivation behind this project until I read you message. You have given me hope! =D


"I checked some of the fishtest games you sent...
Yes, there are dubious moves in them -- maybe those positions are just to test patches and not for gameplay."

Awesome! This is great news because we can now confirm what is causing the problem! 

"Which leads to my next question -- why not make a base using the strongest games ever ?
Just CC players 2500+, only wins.
AB engines hardly understand the moves and a strong human with an engine is the best combination for gameplay.
Eventually, it's only an NN that can even process such games.
Gary trained the base lczero net with 60,000 games from kingbase, upto a training accuracy of 90%."

Indeed! CCRL 40/40 doesn't have enough games, FishTest has bugged games, and to my knowledge no other website offers hundreds of thousands of high quality games except for one.

Nextchessmove! They play 20,000 games against Stockfish 7 at 30+0.3 time controls. They use a dual CPU Xeon E5-2670 16 core. Stockfish 7 may be a bit weak, but I wonder if you can still use this data to train. 


"Use seperate testing and training data.
  This way, you can monitor progress and change settings if progress stops or even reduces.
  Just copy 25% of the training data to the testing folder, and the progress will be tested against that data.
"

Will do!


"This should be lower, so you can pause it at any time and still restore the latest model without losing progress.
    I'd do 20000."

Yeah 40,000 is a bit too much, I'll do 20,000. 

"
Checking the web on deep learning, I found many writeups that said anything lower than a thousandth is useless.
  I feel you should stop at 0.002"

Thanks for the information! I was unsure about this one.

"
 
     If you're doing 400,000 iterations, I would probably do this...
     - 100000
     - 300000

     0.2 upto 100000
     0.02 upto 300000
     0.002 upto 400000        "

So a good rule of thumb is that the first LR should go up to 25% of the total number of steps, the second up to 75% and the rest will be the last LR. =D


" path: 'D:\Leela_Pipeline\networks'         # network storage dir

     This is very important -- a backup of your model.
     And if you restart the session, it'll continue from the latest model found."

Will do for now on!


So what would you recommend be the plan from here? My idea was to train a network off of NCM games. I'll use more than 500k NCM games that are adjudicated, and then use the 160k generated games that are played to mate. I'll update all information based on what you gave above.

Thank you so much again! This project wouldn't be possible if I did it alone both training wise and game generation wise. Thank you!

gvergh...@gmail.com

unread,
Dec 17, 2018, 11:13:42 PM12/17/18
to LCZero
I think quality of the game base matters more than numbers. I'm in the process of getting games of 2400+ cc players from 2000 to now.
It shouldn't be more than 15000 -- what do you think of training that to about a million iterations, while monitoring training accuracy ?

Cscuile

unread,
Dec 17, 2018, 11:17:02 PM12/17/18
to LCZero
Hmm, a million steps? Sure I can try it but wouldn't overfitting be a major issue?

Cscuile

unread,
Dec 17, 2018, 11:31:03 PM12/17/18
to LCZero
If high quality games should be the focus, here are some possible places to get these games. Ipman chess has around 22k 5 minute games per engine. FastGM has around 1000 60 minute games plus around 3000 10 minute games. Plus, we can start generating games as well. 800 nodes vs 500k should be perfect, with a temperature of 10 and a 30 ply value cutoff. 

gvergh...@gmail.com

unread,
Dec 17, 2018, 11:33:23 PM12/17/18
to LCZero
 
That's why we monitor the accuracy.
You can create 2 yamls -- maybe stage1 and stage2.yaml
Stage1 has lr of 0.2, 0.02, 0.002
Stage2 has 0.1, 0.01, 0.02
Once overfitting is appearing, we add a new dataset.

Gary trained 80,000 games to accuracy of 90%.
ASilver trained 500,000 human games for 1 million iterations.

Once we have a strong base, we can decide where to go next

gvergh...@gmail.com

unread,
Dec 17, 2018, 11:34:47 PM12/17/18
to LCZero
Agreed, but isn't cc games worth more ?
I mean a good human player with a pc ?

Cscuile

unread,
Dec 17, 2018, 11:37:07 PM12/17/18
to LCZero
CC games as in CCCC games? 
It is loading more messages.
0 new messages