lightvector / KataGo

GTP engine and self-play learning in Go
https://katagotraining.org/
Other
3.34k stars 550 forks source link

why the training games of kata1 have many board size? #454

Open l1t1 opened 3 years ago

l1t1 commented 3 years ago

19 x16,18x 18 etc

l1t1 commented 3 years ago

and what the different game type means?

Friday9i commented 3 years ago

Because 1) KataGo can play on different board sizes 2) it's a very nice feature 3) playing on different sizes probably help it generalize concepts better 4) in order to play well on different board sizes, it must be trained on different board sizes

Note: while trained on board sizes from 7x7 to 19x19, KataGo can also play well on board with sizes somewhat out of this range, as it generalized quite well ;-). Eg it understands with low visit than a 20 komi is not enough for white on 5x5, and it is still extremely strong on 25x25: almost certainly weaker than if it were trained with selfplay on these sizes, but still very strong

cryptsport commented 3 years ago

I really want to play on boards up to 37x37! will we ever see at least one release?

Friday9i commented 3 years ago

From the default KataGo, if you compile it with Large Board Size feature ("USE_BIGGER_BOARDS_EXPENSIVE" in CMake), I know you can play up to 25x25, and if your GUI handles bigger boards, I think you can play up to 37x37. I tested a long time ago (1 year?) a game on 25x25 and ~15 handicap, and I lost (I'm around 1k KGS): so KataGo was very strong on 25x25, probably around pro level or more. I don't know on bigger sizes, but it's probably weaker when you go way very far from 19x19?

cryptsport commented 3 years ago

@Friday9i thanks for the answer! unfortunately I do not know how to do it. if anyone could do this for windows I would be very grateful! I compared memory consumption for different board sizes, and as the size increases, the memory consumption does not grow much https://lifein19x19.com/viewtopic.php?p=259426#p259426

Friday9i commented 3 years ago

I compiled it last week for Windows, with Large Board Size and OpenCL, here it is. katagoLBSU.zip You should unzip it and you can rename it simply katago. LBSU means Large Board Size + the fact it includes latest Uncertainty modification of MCTS by lightvector :-)

Otherwise, if you prefer, there is an official version from lightvector (but it is from last year): https://github.com/lightvector/KataGo/releases/tag/v1.6.1%2Bbs29

cryptsport commented 3 years ago

@Friday9i thanks, I know about the version up to 29x29, I launched katagoLBSU, this is also up to 29x29: "boardsize 31 2021-03-29 14:27:05+0400: Controller: 2 boardsize 31 2021-03-29 14:27:05+0400: ?2 unacceptable size (Board::MAX_LEN is 29, consider increasing and recompiling)" can you make a version up to 37x37? (better version eigenavx2)

Friday9i commented 3 years ago

Sorry but I don't know how to compile KataGo for 37x37... I'll take a look at the code to see: if there's some easy-to-change parameter, I'll do it...

Edit: I found these lines in CMakeLists.txt: if(USE_BIGGER_BOARDS_EXPENSIVE) target_compile_definitions(katago PRIVATE COMPILE_MAX_BOARD_LEN=29) endif() I'll try to change it from 29 to 37 and then I'll recompile it, I hope it should work : -)! @lightvector: do you think it'll work?

Friday9i commented 3 years ago

Is this version working on 37x37? Hopefully yes :-). It's an OpenCL version (never compiled Eigen...) katago37x37.zip

cryptsport commented 3 years ago

@Friday9i today is a wonderful day !!! thanks a lot!!! works at 35x35 !!! q5go does not support 37x37 :(

cryptsport commented 3 years ago

@Friday9i please compile eigenavx2. maybe it will work. OpenCL at me terribly freezes

Friday9i commented 3 years ago

Ok, done, here it is: katago37x37-Eigen.zip

cryptsport commented 3 years ago

@Friday9i I am immensely grateful to you!!!

everything is fine, it works !!!

Friday9i commented 3 years ago

cool :-) I just tried it too, and with a (very) good CPU, it's reasonably fast! Enjoy!

By the way, how is it playing on 35x35, is it strong too? Any fancy opening moves (eg 5x5 corner moves)? I doubt it, but who knows ;-)

cryptsport commented 3 years ago

I'm still euphoric ... but, first impression, a network of 10 blocks, 5 playouts, nothing strange (played 2 networks ). but I just watched and was happy! I've been waiting for this for many years!

cryptsport commented 3 years ago

the opening moves are likely to be similar on boards of any size, unless there has been training on them. strength in my opinion change little KataGo s730 5 playouts - KataGo s730 5 playouts 35 X 35 https://lifein19x19.com/viewtopic.php?p=264288#p264288

cryptsport commented 3 years ago

@Friday9i if the compilation takes a little time, could you make a version with no board size limit, or up to 100x100 or 255x255? I want to experiment!

Friday9i commented 3 years ago

Here it is, but no guarantee at all: above 37 is clearly ouside of the scope it was designed for... Compilation worked, but I doubt it'll be technically able to play such large boards, and if it can, if it makes sense at all. You'll tell us! katago-Eigen-100x100.zip

Note: there is possibly/probably an issue regarding board moves, coded IIRC by letters from a to z then A to Z ... That makes 52 letters (and I think i is not used), so possibly a limit at 50... I guess it should crash above that (?)

cryptsport commented 3 years ago

thank you so much!!! works at 35x39 !!! q5Go yesterday updated to 52x52, but there is no Windows version yet ... waiting again, this is terrible!

cryptsport commented 3 years ago

@lightvector made the numbering, as far as I understood, up to 650x650. it was soon implemented in the q5Go

cryptsport commented 3 years ago

possible only up to 52x52 https://lifein19x19.com/viewtopic.php?p=255925#p255925 but you can continue to 650x650

Friday9i commented 3 years ago

Ok, 100x100 should do the job for the moment, possibly up to 52x52 if coding moves is an issue. Then, if all is well and 100x100 works and is not enough, I'll be in a position to compile it for larger boards :-). Enjoy!

cryptsport commented 3 years ago

Sorry! it turned out that the 100x100 version takes a very, very long time to load. probably the fact is that memory is reserved for this. if it's easy, please make a 52x52 version. probably it will be perfect

cryptsport commented 3 years ago

for a 36x36 board and a network of 10b katago37x37-Eigen starts in a second, but also, for a 36x36 board and a network of 10b katago100x100 starts in 3 minutes. unclear. maybe 52x52 will work fine? 36x52 works!

Friday9i commented 3 years ago

Here is the 52x52 version: katago-Eigen-52x52.zip

cryptsport commented 3 years ago

started right away! very grateful !!!

cryptsport commented 3 years ago

There is a reason why boards larger than 52x52 will not be popular in the foreseeable future - the modern sgf format is only up to 52x52. unless suddenly something amazingly interesting, new, is found on large boards!

cryptsport commented 3 years ago

KataGo b10-s114 5 playouts - KataGo b10-s114 5 playouts 36 X 52 https://lifein19x19.com/viewtopic.php?p=264301#p264301 on the first games it seems that the 10b network is better "suited" for very large boards than the 40b s730 network

cryptsport commented 3 years ago

@Friday9i please make OpenCL version 52x52! I'm going to install a new video card the other day

lightvector commented 3 years ago

Keep in mind that that part of the reason the flag for larger board sizes by default caps to 29 is that all of the neural networks don't generalize upward too much farther than that before losing quality. The largest they're trained on is 19x19, and they seem to continue to be good-quality up into board sizes in the twenties, and to some degree the thirties, but beyond that, the evaluations start to become corrupted. Almost certainly by size 50+, the board evaluation is not going to behave sanely any more.

lightvector commented 3 years ago

If you wanted though, you could try adding a couple months of training on board sizes up to the 20s and 30s. That would probably stabilize the behavior and allow decent play up to 40s and 50s. You might need to adjust some parameters down (like batch size, so that you don't run out of memory due to the larger boards on the training GPU) and maybe on the training side there's a few 19s that need to be generalized, but I bet it almost just works. I'll leave for now that as a project for others like @Friday9i or anyone else who knows how to run the training. :)

cryptsport commented 3 years ago

the game on 36x52 even with 10b, 5p was interesting to watch! sometimes you want to see something new! and I love it! thank you very much, @lightvector, for KataGo again!!!

Friday9i commented 3 years ago

Yeah, that's one of my projects in the medium term! Unless @lightvector switches the main kata1 run with selfplay up to 29x29 or 37x37 in the mean time!

But for now, I'm running an Igo Hatsuyoron's net and will go on for some time... So not before 2022 probably on my side. I'm very curious to see if selfplay on very large boards (VLB) will induce some changes in opening style and global strategy: eg will it play larger encloser moves (ie more 4-5, possibly 4-6 or 5-5), tengen move (is that good on VLB?), will it change its style on 19x19 from experience on VLB, etc?

AI-hit commented 3 years ago

Question about Platinum Dragon’s territory line https://senseis.xmp.net/?LargeBoards

cryptsport commented 3 years ago

@Friday9i please make OpenCL version 52x52

Friday9i commented 3 years ago

Here it is: Windows OpenCL 52x52 :-) katago-52x52-OpenCL.zip

cryptsport commented 3 years ago

@Friday9i I am full of joy and gratitude !!!

cryptsport commented 3 years ago

I ran "katago-Eigen-100x100" on the command line, boardsize 63, the first move KataGo made a pass, I answered "c4", he went "BK60"! (opposite corner) I didn't expect, but KataGo works!

lightvector commented 3 years ago

I'm very curious to see if selfplay on very large boards (VLB) will induce some changes in opening style and global strategy: eg will it play larger encloser moves (ie more 4-5, possibly 4-6 or 5-5), tengen move (is that good on VLB?), will it change its style on 19x19 from experience on VLB, etc?

Probably no. :)

It seems simple to say "the center is bigger, therefore more influential and center-oriented moves become better". But except for ladders, a stone's influence only radiates so far, and 19x19 is surely big enough that the effect of just one a move in one corner has reduced to almost nothing by the time it hits the other side of the board, in terms of points. Making the board any bigger is just adding more and more space that the stone already doesn't affect. Meanwhile, 5-5 and 4-6 we know are very inefficient for the corner they are near (at the highest levels of play).

And making the center bigger shouldn't make a random center move around tengen any better either. It still lacks the efficiency bonus that the corner and sides gives. Compared to empty space, you can think of the edge as being a border made out of stones that are neither yours nor the opponent's (they fill both you and your opponent's liberties). But if you have a few stones near the edge, then the edge helps you and not the opponent - the edge automatically acts like a border for your territory or eyespace the almost same way an edge made of your own stones would.

You can also reverse the argument. If making the board bigger were to make higher move like 5th-line optimal, then surely making the board smaller would make lower 3rd-line moves optimal? Nope. From 19x19 all the way down to 7x7 (beyond which the 4th line stops existing), on every board size one of 3-4 or 4-4 appears to be best. The optimal move doesn't become lower (3-3 point or 2nd line moves) even though the board size is shrinking - so this again suggests that the line that you should play on has nothing to do with the size of the center and everything to do with the local efficiency relative to the edge.

The only exception is 9x9, in which 5-5 is playable because it's the 5-5 point for all corners at once, even though 5-5 is normally worse than 4-4 in all other cases. But even then, it's not better, it's merely equal to 4-4. So ironically, the only time that 5-5 is appears finally be equal to other moves is the opposite of the board being large - rather, it's when the board is small, so that 5-5 is also near enough to more edges!

So my guess is: regardless of bigger board size, very likely 4-4 and 3-4 are going to remain the top moves. If 5th line turns out to be better, it will be a big surprise, which is contrary to the way so many people almost seem to expect it.

Friday9i commented 3 years ago

Yeah, I agree with your convincing and well stated arguments regarding corner moves: classical corner moves (3-4, 4-4 and sometimes 3-3, 3-5 and 4-5) will very probably remain the best moves for Very Large Boards. I'd like to be surprised, but I doubt it'll be the case.

Where I'm a bit less clear is the last question I asked " will it change its style on 19x19 from experience on VLB"? I would rather guess NO also: there may be some changes, but if there are some, it'll probably won't be discernable compared to regular changes in style we see months after months in kata1's run, where changes come from additional training.

A last question I have: will selfplay on VLB make KataGo better on 19x19? I guess the answer is yes and no :-):

But of course, it'll be better on VLB, no doubt about that!

Friday9i commented 3 years ago

Katrain works for Very Large Boards ;-))) Here is a KataGo vs KataGo game I generated with the 52x52 OpenCL version, on a 52x7 board size! 2021-04-02 VLBS-52x7.zip It seems KataGo played the game very reasonably, the score remained balanced almost all along (between -4 and +4) excepted a short unbalanced view (-14 I think) during a fight: quite incredible that KataGo can play well on this board size!!!

Note: you need to select F8 in Katrain for settings and indicate the path to KataGo executable where you indicate the 52x52 KataGo version, and it works! Here is Katrain: https://github.com/sanderland/katrain

Edit: and a 19x52 game of KG vs KG, reasonably balanced, with 500 visits: 2021-04-02 VLBS-19x52.zip

cryptsport commented 3 years ago

@Friday9i please make katago 63x63 - eigenavx2. version 100x100 takes a very long time to load, and reserves a lot of memory. 15b the network seems to work fine at 63x63, but I want to check it out

Friday9i commented 3 years ago

Here it is, 2-in-1 :-):

KataGo-63x63.zip

cryptsport commented 3 years ago

@Friday9i Thank you so much !!! loads much faster !!!

cryptsport commented 3 years ago

15b net plays normally on 63x63 board !!! I've tracked over 100 moves! I used twogtp.py https://lifein19x19.com/viewtopic.php?p=264534#p264534 https://github.com/pasky/pachi/blob/master/tools/twogtp.py

cryptsport commented 3 years ago

https://github.com/hope366/Lizzie-improvements/issues/16#issue-860174190

Friday9i commented 2 years ago

Here are OpenCL and Eigen versions of KataGo1.9.1 for large boards, 37x37 and 52x52 Enjoy :-) katago191-LargeBoards.zip

HackYardo commented 2 years ago

I want to ask whether 52x52orAbove.sgf is the perfect extend of 1x1to19x19.sgf? You know, i I l L are hard to identify.

cryptsport commented 2 years ago

@Friday9i Please make Eigen AVX2 versions 63x63, 100x100 and 120x120 lizzieyzy works on boards up to 100x100! https://github.com/yzyray/lizzieyzy/issues/4

Lizzieyzy-2.4.4 https://github.com/yzyray/lizzieyzy/releases support for games on boards up to 100x100 and saving these games in sgf !!!

cryptsport commented 1 year ago

@Friday9i Please make new versions 37x37!