Page 1 of 2

Total noob Leela question

Posted: Wed Jun 03, 2020 10:57 pm
by hgm
So far I have payed zero attention to the LeelaChess Zero project, as I have no good GPU. But now I want to do some testing at ultra-low node count, and I suppose a CPU-only version would be good enough for that.

What would I have to do to run a game with LC0-CPU as UCI engine? I downloaded an archive leela-zero-0.17-win64.zip and assumed that the leelaz.exe in there was the engine, but when I try to run it, I get an error for a missing DLL routine. Must I download other stuff, and if so, what? Are there instructions on line somewhere? The README.txt file in the archive contained no useful info at all.

Re: Total noob Leela question

Posted: Wed Jun 03, 2020 10:58 pm
by Dann Corbit
What DLL did it way was missing?

Re: Total noob Leela question

Posted: Wed Jun 03, 2020 11:57 pm
by zullil
hgm wrote: Wed Jun 03, 2020 10:57 pm So far I have payed zero attention to the LeelaChess Zero project, as I have no good GPU. But now I want to do some testing at ultra-low node count, and I suppose a CPU-only version would be good enough for that.

What would I have to do to run a game with LC0-CPU as UCI engine? I downloaded an archive leela-zero-0.17-win64.zip and assumed that the leelaz.exe in there was the engine, but when I try to run it, I get an error for a missing DLL routine. Must I download other stuff, and if so, what? Are there instructions on line somewhere? The README.txt file in the archive contained no useful info at all.
0.17?

https://lczero.org/play/download/

Re: Total noob Leela question

Posted: Thu Jun 04, 2020 1:29 pm
by Gian-Carlo Pascutto
hgm wrote: Wed Jun 03, 2020 10:57 pm So far I have payed zero attention to the LeelaChess Zero project, as I have no good GPU. But now I want to do some testing at ultra-low node count, and I suppose a CPU-only version would be good enough for that.

What would I have to do to run a game with LC0-CPU as UCI engine? I downloaded an archive leela-zero-0.17-win64.zip and assumed that the leelaz.exe in there was the engine, but when I try to run it, I get an error for a missing DLL routine. Must I download other stuff, and if so, what? Are there instructions on line somewhere? The README.txt file in the archive contained no useful info at all.
Did you download the Go engine instead of the chess one?

I'm still curious what DLL was supposedly missing.

Re: Total noob Leela question

Posted: Thu Jun 04, 2020 1:39 pm
by hgm
Oh, perhaps I did. I just Googled the name, and clicked a link to Github, paying more attention to whether it said 'CPU' than whether it said 'Chess'. It complains about clReleaseDevice in OpenCL.dll. There is nothing in the archive that suggests whether it is for Go or Chess, but I suppose that it says leelaz.exe instead of leelacz.exe should have been a warning to me. :oops:

Anyway, Louis, thanks for the link; this one worked out of the box. Interesting thing is that, first game I tried with it, it lost against Fairy-Max! At some point it had an enormous lead, and then it bungled it, and even managed to lose. (And it flagged as well, in the first 40-move session, but I did not have autoFlag on, so the game just continued):

[pgn][Event "Computer Chess Game"]
[Site "MAKRO-PC"]
[Date "2020.06.04"]
[Round "-"]
[White "LeelaChess Zero"]
[Black "Fairy-Max 5.0b6"]
[Result "0-1"]
[TimeControl "40/30"]

1. e4 {+0.17/2} c5 2. Nf3 {+0.19/3 0.7} d6 3. d4 {+0.27/2 0.7} cxd4 4. Nxd4
{+0.26/3 0.7} Nf6 5. Nc3 {+0.23/4 0.7} a6 6. Be3 {+0.24/4 0.8} e6 7. f3
{+0.27/3 0.8} b5 8. Qd2 {+0.33/4 0.7} b4 9. Na4 {+0.35/3 0.7} Qa5
{+0.06/7 0.7} 10. b3 {+0.54/2 0.7} d5 {-0.02/6 0.5} 11. e5 {+0.49/3 0.7}
Nfd7 {+0.02/8 1.1} 12. f4 {+0.42/5 0.7} Be7 {+0.04/7 0.7} 13. Bd3
{+0.71/3 0.8} O-O {+0.08/7 0.9} 14. O-O {+1.05/3 0.7} Bb7 {+0.02/8 2.1} 15.
Rf3 {+1.28/3 0.7} Nc6 {+0.20/7 0.6} 16. Rh3 {+1.10/4 0.7} h6 {+0.08/7 0.6}
17. Qe2 {+1.43/3 0.8} Nxd4 {+0.13/8 0.5} 18. Bxd4 {+1.16/4 0.7} Bc6
{+0.21/8 0.5} 19. Qg4 {+2.74/4 0.7} Bxa4 {+0.04/8 1.9} 20. Rxh6
{+2.48/4 0.7} f5 {-0.46/8 2.0} 21. exf6 {+2.47/5 0.7} Nxf6 {-0.51/8 0.7}
22. Qxe6+ {+1.43/4 0.8} Rf7 {-0.61/8 1.0} 23. Bh7+ {+1.46/4 0.7} Nxh7
{-1.04/9 0.9} 24. Rxh7 {+0.64/4 0.7} Bf8 {-0.94/8 0.4} 25. bxa4
{+1.96/3 0.8} Qc7 {-1.39/7 1.1} 26. Qh3 {+4.53/3 0.7} Rf6 {-6.24/8 0.4} 27.
Bxf6 {+7.89/3 0.7} Qb6+ {-3.28/6 0.5} 28. Kh1 {+11.56/4 0.7} Qxf6
{-3.49/8 0.6} 29. Rf1 {+11.58/2 0.7} g5 {-3.14/7 0.5} 30. Rh5
{+10.93/3 0.7} Ra7 {-4.37/7 0.5} 31. Rxg5+ {+9.50/2 0.7} Rg7 {-4.44/8 0.5}
32. Rxg7+ {+11.33/1 1.3} Bxg7 {-3.96/9 0.5} 33. Qc8+ {+10.10/1 0.7} Bf8
{-4.33/9 1.6} 34. Qg4+ {+9.44/2 0.7} Bg7 {-3.94/9 1.2} 35. f5 {+8.98/1 0.8}
d4 {-4.02/9 0.7} 36. h3 {+9.55/1 0.7} Kh7 {-4.14/9 0.7} 37. Qe4
{+9.70/1 1.2} a5 {-4.16/8 0.6} 38. g3 {+9.50/1 0.5} Bh6 {-4.19/8 0.7} 39.
Qb7+ {+9.01/1 1.4} Kg8 {-4.50/7 0.5} 40. Qf3 {+9.92/1} Kh7 {-4.19/8 0.4}
41. Re1 {+9.61/1 2.2} Be3 {-3.87/9 0.7} 42. Kg2 {+10.92/2 2.1} Qf7
{-4.31/9 1.2} 43. Re2 {+10.42/2 2.0} Bg5 {-3.81/8 0.6} 44. h4
{+10.50/2 2.0} Be3 {-4.12/9 0.8} 45. Re1 {+10.49/2 1.9} Qxa2 {-3.78/8 0.5}
46. Re2 {+10.15/3 1.8} Qf7 {-3.43/9 1.0} 47. Kh1 {+10.39/1 1.7} Kg7
{-3.39/9 0.7} 48. g4 {+10.90/2 1.6} b3 {-3.10/8 0.6} 49. cxb3
{+10.90/3 1.2} Qxb3 {-3.72/8 0.6} 50. Kg2 {+10.96/3 1.4} Qxa4 {-3.35/8 0.9}
51. f6+ {+10.99/2 1.3} Kf7 {-4.16/9 1.3} 52. Qb7+ {+29.29/2 1.2} Kxf6
{-2.97/8 0.9} 53. g5+ {+9.44/3 1.1} Ke5 {-3.03/8 0.5} 54. Qf3 {+9.03/3 1.0}
Qc4 {-2.19/9 1.1} 55. g6 {+6.83/3 0.9} Qc1 {-2.51/9 1.4} 56. Qg3+
{+8.29/3 0.8} Kf6 {-1.89/8 0.6} 57. Qf3+ {+7.40/3 0.7} Ke5 {+0.00/16 0.7}
58. h5 {+9.79/4 0.5} a4 {-2.16/8 0.7} 59. Qg3+ {+6.25/3 0.6} Kf6
{-2.17/7 0.6} 60. Re1 {+1.59/3 0.5} Qc2+ {-2.05/7 0.4} 61. Kh1
{+0.85/4 0.4} Qf5 {-1.78/8 0.8} 62. Qd6+ {+0.62/3 0.4} Kg7 {-0.73/8 0.4}
63. Qe7+ {+0.70/2 0.3} Kh6 {-0.02/10 0.4} 64. Qh7+ {+0.19/3 0.3} Kg5
{-0.01/12 1.9} 65. Rg1+ {+0.18/3 0.2} Bxg1 {+0.11/10 0.5} 66. Kxg1
{-0.31/1 0.2} d3 {+0.58/11 0.6} 67. Qe7+ {-0.09/2 0.2} Kxh5 {+0.62/13 0.7}
68. g7 {-0.28/1 0.2} Qg6+ {+0.57/12 0.5} 69. Kf2 {-0.01/2 0.1} d2
{+0.10/13 1.2} 70. Qe2+ {+0.00/1 0.1} Kh6 {+0.73/13 0.4} 71. Qxd2+
{+0.00/1 0.1} Kxg7 {+0.27/13 0.5} 72. Qc3+ {+0.00/1 0.1} Qf6+
{+8.45/20 0.6} 73. Qxf6+ {-4.37/1 0.1} Kxf6 {+8.57/18 0.7} 74. Ke2
{-57.72/1 0.1} a3 {+8.48/15 0.4} 75. Kd2 {-112.43/1 0.1} a2 {+8.55/14 0.5}
76. Kc2 {-118.88/1 0.1} a1=Q {+1000.13/13 0.5} 77. Kd3 {-121.98/1 0.1} Ke5
{+1000.07/12 0.7} 78. Ke2 {+0.00/1} Qc3 {+1000.05/14 0.5} 79. Kf1
{-101.64/1} Qc2 {+1000.04/21 0.4} 80. Kg1 {-94.28/1} Ke4 {+1000.03/28 0.2}
81. Kf1 {-99.96/3 3} Kf3 {+1000.02/28} 82. Ke1 {-99.98/2 2.9} Qe2#
{+1000.01/28}
{Black mates} 0-1
[/pgn]

Re: Total noob Leela question

Posted: Fri Jun 05, 2020 1:25 pm
by hgm
Second game I played also had an unexpected result: repetition draw!
[pgn][Event "Computer Chess Game"]
[Site "MAKRO-PC"]
[Date "2020.06.04"]
[Round "-"]
[White "LeelaChess Zero"]
[Black "Fairy-Max 5.0b6"]
[Result "1/2-1/2"]
[TimeControl "40/30"]

1. e4 {+0.17/3} c5 2. Nf3 {+0.19/3 0.8} Nc6 3. Bb5 {+0.20/4 0.7} d6 4. O-O
{+0.27/2 0.7} Bd7 5. Re1 {+0.25/3 0.7} Nf6 6. c3 {+0.27/4 0.7} a6 7. Ba4
{+0.24/4 0.7} b5 8. Bc2 {+0.31/4 0.7} e5 9. d4 {+0.28/5 0.8} exd4
{+0.20/8 1.1} 10. cxd4 {+0.36/5 0.7} Be7 {+0.09/7 1.0} 11. dxc5
{+1.15/4 0.8} dxc5 {-0.19/8 0.7} 12. e5 {+1.67/5 0.7} Ng4 {-0.20/7 0.7} 13.
h3 {+1.54/5 0.7} Nh6 {-0.22/7 1.2} 14. Bxh6 {+2.25/6 0.7} gxh6
{+0.03/8 1.4} 15. Nc3 {+2.17/5 0.7} Be6 {+0.24/7 1.0} 16. Qc1 {+2.00/5 0.8}
Bg5 {-0.08/8 2.5} 17. Nxg5 {+3.07/5 0.7} hxg5 {-0.68/8 0.7} 18. Ne4
{+5.33/4 0.7} h6 {-0.77/7 0.6} 19. Nxc5 {+5.92/3 0.8} Bd5 {-1.01/8 0.9} 20.
Rd1 {+13.32/2 0.8} Ne7 {-1.05/7 0.8} 21. Be4 {+13.04/2 0.7} Rc8
{-1.00/8 0.8} 22. b4 {+11.53/3 0.7} a5 {-1.61/8 1.3} 23. a3 {+11.29/3 0.7}
axb4 {-1.17/8 0.7} 24. axb4 {+11.89/2 0.7} Rg8 {-2.08/7 0.7} 25. Bxd5
{+11.92/1 0.8} Nxd5 {-2.98/8 0.6} 26. Ra6 {+13.65/2 0.7} Rg6 {-3.08/9 1.0}
27. Rxg6 {+17.87/1 1.2} fxg6 {-3.91/10 0.5} 28. Qc2 {+12.64/1 0.7} Rc6
{-3.89/9 0.5} 29. Qe4 {+10.08/1 0.9} Rb6 {-4.08/9 0.5} 30. Ra1
{+11.60/1 0.7} Ne7 {-1.39/8 0.4} 31. Ra8 {+10.51/1 1.6} Rb8 {-2.02/11 0.7}
32. Ra6 {+8.88/1 0.6} Qd1+ {-1.28/8 0.4} 33. Kh2 {+11.53/3 0.6} Qd2
{-1.54/9 0.7} 34. Rf6 {+12.76/3 0.6} Qd5 {-1.65/7 0.5} 35. Qe3
{+11.19/1 0.6} Nf5 {-1.27/8 0.7} 36. Qe2 {+8.20/3 0.6} Nh4 {-1.52/8 1.1}
37. f3 {+6.13/3 0.6} Qc4 {-1.49/8 0.6} 38. Qf2 {+6.99/4 0.6} Rd8
{-1.38/8 1.4} 39. Ne4 {+7.93/3 0.6} Qd4 {-0.95/7 0.3} 40. Qa2 {+1.37/3 0.6}
Qd5 {-1.51/8 0.6} 41. Qb2 {+4.19/4 2.2} Qd4 {-1.05/8 0.7} 42. Qb3
{+2.38/5 2.1} Qd5 {-1.23/8 1.0} 43. Qc3 {+8.95/4 1.6} Ra8 {-2.45/7 0.7} 44.
Nd6+ {+14.34/4 2.0} Kd7 {-1.85/8 0.9} 45. Rf7+ {+3.88/4 1.9} Ke6
{-0.52/7 0.7} 46. Rf6+ {+4.12/6 1.3} Kd7 {+0.00/15 0.6} 47. Ne4
{+6.84/5 1.2} Ke8 {+0.00/11 0.5} 48. Qc7 {+11.90/4 1.7} Rd8 {-7.14/9 0.8}
49. e6 {+28.40/3 1.7} Rd7 {-15.75/11 0.8} 50. exd7+ {+30.01/4 1.5} Qxd7
{-1000.08/11 0.9} 51. Qxd7+ {+11.15/4 1.5} Kxd7 {-5.95/16 0.8} 52. Ra6
{+10.59/1 1.3} Ke8 {-5.14/9 0.4} 53. Re6+ {+10.66/2 1.2} Kf7 {-5.16/11 0.7}
54. Ra6 {+10.72/3 1.0} Ke8 {+0.00/15 0.6} 55. Nf6+ {+9.45/1 1.7} Kd8
{-5.14/10 0.6} 56. Ne4 {+0.82/2 0.7} Ke8 {+0.00/15 0.4}
{XBoard adjudication: repetition draw} 1/2-1/2
[/pgn]
It seems to know it is going for a draw, as the score of its last move is pretty low. But it is a bit weird that it doesn't know anything better to do in the repeated position, such as gobbling up an unprotectable Pawn to create a passer. Surely the NN evaluation must have learned that it is in general better to have a Pawn than not have it, and that having passers is even better?!?

Is there something I am doing wrong? I am just running it with its default settings, at 40 moves / 30 sec. It cannot be completely broken, as it reaches a huge advantage in the middle-game. Even in the final position it is a clean Rook ahead, but it thinks repeating is better than just going to any unrepeated position with a Rook advantage.

Re: Total noob Leela question

Posted: Fri Jun 05, 2020 2:46 pm
by fohristiwhirl
Although the net might have some feelings about triple repetition, I think that's normally detected by the search code. If you have no GPU, and are running at super-fast time control, it's possible Leela isn't getting enough nodes.

This can be made a bit better with some UCI options, the defaults for which are terrible for CPU. Try:

Code: Select all

setoption name MinibatchSize value 4
setoption name MaxPrefetch value 0
Or alternatively, make a file in Leela's folder called lc0.config containing

Code: Select all

--minibatch-size=4
--max-prefetch=0
Still I'd recommend giving it a few seconds per move, at least.

I'd be curious what nps you get running ./lc0.exe benchmark

Re: Total noob Leela question

Posted: Fri Jun 05, 2020 3:05 pm
by fohristiwhirl
Also, I suppose you're running with a UCI adaptor - presumably it does pass the full move history and not merely the current FEN?

Testing locally, the only way I was able to actually get Ne4 to be played was deleting the history. Then it becomes the #1 move for a time.

Re: Total noob Leela question

Posted: Fri Jun 05, 2020 3:30 pm
by zullil
fohristiwhirl wrote: Fri Jun 05, 2020 2:46 pm

I'd be curious what nps you get running ./lc0.exe benchmark
Might want to make that

./lc0.exe benchmark --num-positions=1

Otherwise 34 positions will be searched, which will take a long time. :wink:

Re: Total noob Leela question

Posted: Fri Jun 05, 2020 7:01 pm
by hgm
Well, the 34 positions did not take that long. I got the following result:

Total time (ms) : 366835
Nodes searched : 84435
Nodes/second : 230

And yes, the adapter (Polyglot) passes the entire game history. Leela new this move would draw, you can see the score in the PGN. On the previous occasions the score was much higher, so there is no doubt it sensed the history. The strange thing is that it didn't see any move that would not draw, while a Pawn is up for grabs.

One can blame the low node count, but it should not need to expand many nodes to hit something that isn't a draw. Only very few positions in the perft tree would be repetitions, and only a small fraction would get rid of the advantage of a full Rook. Even if it just searched 10 nodes, it would be very strange if all those 10 nodes were Rook sacrifices or repetitions.

I took the fast TC because I am really interested in what happens at very low node counts. I heard stories that a one-node Leela is rated over 2000 on some server, (playing against humans, no doubt), and I want to see that before I believe it. Does it support "go nodes"?