Wednesday, September 11, 2019

Leela (Lc0)

At the end of 2017 I mentioned on my blog about the first +50 year old player breaking the 2700 barrier. However most people expect that this record will be smashed very soon by former worldchampion Viswanathan Anand. In December he will be 50 and today he still has a sky-high rating of 2765.

The young Dutch topgrandmaster Anish Giri already expressed his admiration for him in a recent interview at chess.com. Anand is a fascinating phenomenon. Contrary to his contemporaries he is still young of heart. Most people of his age aren't willing to make changes. They stop downloading the last software or they don't renew the apps like young people do. Anand however is still up to date with the apps on his smartphone. Fact that he still belongs to the world-top is the merit of continuously reinventing oneself.

That motivation is lacking for older players is something I see regularly confirmed around me. In the most recent Vlaanderen Schaakt Digitaal the publisher talks about Fritz. I used that engine 20 years ago to analyze my games. If you use today still Fritz while there exist free and much stronger engines then you definitely aren't ambitious anymore. However worse is when an author whom everybody considers absolute the best in his domain of opening-books, isn't up to date with the latest developments. In a recent interview the Israeli grandmaster Boris Avrukh confessed that he didn't use the best software to check his analysisHis repertoire-books are very popular so it is a shock to hear that he was still using an old version of Stockfish and never had worked with Leela.

It seems this 41 year old player has lost its appetite for chess. Therefore it wasn't a real surprise when he announced at the introduction of this most recent book that he would stop writing any new books. Just like the 44 year old former worldchampion Kramnik whom stopped his professional chesscareer a couple of months ago, he expressed his wish to make a career-change. Many new plans and challenges are already waiting. So there will be no time for being bored and in the end it is of course up to the individual how to live your own life.

I am in the same age-category as them but I am definitely not tired yet of chess. Contrary as this year I will play (much) more. End of this month I will play again chess abroad which has been more than a decade ago. Together with my son Hugo we will play in the same team for Axel Landau in the Dutch interclub. I am also again reading some new opening-books which was even 2 decades ago when I last bought such book (see e.g. statistics). Finally I am also closely following all chess-developments via different chess-sites. About 1 of those new kids in town I want in this article to elaborate a bit.

About the rise of Alphazero and later Lc0 I already wrote a number of times on this blog but I guess this wasn't very interesting for the average amateur. What is the sense to talk about something which you can't use yourself? Well this is not correct (anymore). 4 months ago I managed to install Lc0 on my PC and meanwhile I have become a real fan of it. Since beginning of 2018 I complained that our best engines are too similar which made it doubtful if it still made sense to use something else beside Stockfish see to analyze using a computer part 3. Lc0 is a game changer. It very often gives a totally different view which is definitely valuable.

So Lc0 is available for everybody. Many grandmasters are using it already for some time see e.g. a recent interview of the French grandmaster Iossif Dorfman but I only hear very rarely amateurs do. Nevertheless I think also for them this engine can be very useful. Often classical engines offer very complex and tactical solutions for some opening-questions. On the other hand it is not seldom that Leela chooses for a much more quiet alternative based on solid positional moves which are easier to understand and remember. In my most recent game-preparations of the last edition of Open Brasschaat I used regularly Leela to make some quick choices. A lovely example was below opening which was part of my preparation against  Guy Baete.
[Event "Preparation against Guy Baete"] [Site "?"] [Date "2019.??.??"] [Round "?"] [White "?"] [Black "?"] [Result "*"] [ECO "C41"] [PlyCount "23"] [EventDate "2019.??.??"] [Sourceversiondate "2019.09.08"] [CurrentPosition "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"] 1. e4 e5 2. Nf3 d6 3. d4 Bg4 4. dxe5 Bxf3 5. Qxf3 dxe5 6. Qb3 {(I started recently to use Leela when I want a quick answer in a game-preparation for an early opening-position which I didn't analyze before. In comparison with classical engines like Stockfish, Leela finds Qb3 immediately. Qb3 is slightly more accurate than Bc4 which almost anybody plays.)} 6... b6 7. Bc4 Qf6 8. Nc3 c6 {(In the megadatabase I found 3 games of the same amateur of 1700 elo with this positon. Only in the last game his opponent was clearly prepared for it as it was the only time out of 31 games with this position in the megadatabase that this strong move was played. 9.Nd5 is again a typical invisible move for a human. Finally I also want to warn people that you are never safe for preparations. Some people think wrongly that a low rating protects them for it. We all have engines so expect people to use them.)} 9. Nd5 {(However tactics are still quicker found by the classical engines. Contrary to Leela, Stockfish finds this killer immediately. The conclusion is that we should combine both engines to work efficiently.)} 9... cxd5 (9... Qd8 10. Nxb6 Qxb6 11. Bxf7+ Kd8 12. Bxg8 +-) 10. Bb5+ Nd7 11. Bxd7+ Kxd7 12. Qxd5+ +- *
Openings played by amateurs are often ignored by grandmasters so it is for sure good to have Lc0 around to consult as a backup.

Also in the middlegame Leela performs very well. I checked my analysis made in the most recent years with Leela and Leela found practically all critical moves. Some readers will maybe still remember my article the horizon published in 2014 in which I indicated that engines like Houdini and Stockfish couldn't find the best move f3 even after 1 hour of calculations. Well Leela only needs 19 seconds on my desktop today.
The last release of Stockfish finds f3 now also very fast. It just proofs once more that the strength of the best engines have improved dramatically last couple of years.

Finally the endgame is maybe the phase in which Leela can demonstrate the greatest difference compared to the traditional engines. Especially when engines don't use tablebases I notice that Leela is far more accurate with the evaluation. Time over time this allowed Leela to escape from some very difficult to defend positions. A nice example is an extract from a game out of a match with Komodo against Lc0.
[Event "DESKTOP-VE6O9HB, Rapid 15m+10s"] [Site "DESKTOP-VE6O9HB"] [Date "2019.05.28"] [Round "44"] [White "Komodo 11 64-bit"] [Black "Lc0 v0.21.0"] [Result "1/2-1/2"] [SetUp "1"] [FEN "8/3b4/3P1kp1/3R3p/1r5P/6K1/5P2/3B4 b - - 0 53"] [ECO "A10"] [PlyCount "47"] [EventDate "2019.??.??"] [Eventtype "rapid"] [CurrentPosition "8/3b4/3P1kp1/3R3p/1r5P/6K1/5P2/3B4 b - - 0 53"] 53... Ke6 {(Black is a pawn down but it is no disaster as white's pawns are shattered. However now Leela chooses for a very remarkable road.)} 54. Rg5 Be8 55. Bc2 Kxd6 56. Bxg6 Bxg6 57. Rxg6+ Ke7 58. Rg5 Kf6 59. Rxh5 {(The well-known rookendgame of f and h-pawns. It is theoretically a draw but in practice not so easy to defend.)} 59... Kg6 60. Rg5+ Kh6 61. f4 Rb1 62. Kg4 Ra1 63. Rd5 Kg6 64. h5+ {(None of my engines uses tablebases. Stockfish and Komodo show an evaluation of approximately +2 for white. Leela on the other hand shows surprisingly 0.0. and never deviates from it. With surprisingly I mean not a wrong evaluation but something I don't expect from an engine without tablebases. )} 64... Kg7 65. Rd7+ Kh6 66. Rd6+ Kg7 67. h6+ Kh7 68. f5 Rf1 69. Kg5 Rg1+ 70. Kf6 Rf1 71. Re6 Rf2 72. Re3 Ra2 73. Rh3 Ra1 74. Rh4 Ra2 75. Kg5 Rg2+ 76. Rg4 Rxg4+ {(It struck me that the evaluation of Leela was very often more accurate than the classical engines without tablebases. It allowed Leela to escape from many bad positions with a draw.)} 1/2-1/2
Then the next question is of course: "how strong is Leela exactly". I could refer to the most recent superfinal of TCEC which Leela won from Stockfish with 53,5- 46,5 but that would give on my PC a distorted picture. TCEC uses different hardware which allows Lc0 to play much stronger than on my 2 year old desktop (an AMD FX(tm)-6300 6 core processor 3,5Ghz with a Nvidia Geforce GTX 960 graphic card).  On CCRL it is a similar story as they don't compare the engines on the same hardware. In the end I decided to compare myself the engines on my PC. 1 of the 3 Leela-releases which I tested, managed to score a very nice 50-50 against Komodo (my only commercial engine which I still use today for analysis) in a match of 100 rapid games (more about this in the next article). I believe with a slower tempo Lc0 further gains some strength compared to the competition which is what CCRL also shows in its benchmarks.

So even on my modest hardware Leela performs approximately at the same level as recent releases of Stockfish and Komodo. I expect it would surpass them on faster hardware. Unfortunately I am not rich and unexpected expenses this year are forcing me to put on hold my dream of more powerful hardware.

Ok everybody is convinced that Lc0 is a must but I still need to explain how to install Lc0 on your own PC so we can all start to use it. For people willing to find this out themselves see Getting Started. However I warn that it is not so simple. On my 5 year old portable it didn't even manage. I guess it has to do with missing a good graphic card. Without a Nvidia graphic card it makes little sense.

First you need to download the engine and put it in a directory. You can choose between different versions. I chose lc0-v0.22.0-windows-opencl.zip as it is the most recent one and it works for my Nvidia graphic card. The cuda-version is stronger but I couldn't get it work on my PC probably because I don't have the right drivers or because my graphic card is too old. If you have stronger hardware then you should definitely try the cuda-version.

Next you need to download a network and put it in the same directory as the engine. You can choose between hundreds of networks. The site recommends network 42700 but I use at this moment 42820. It is possible that another network is still a couple of points stronger but it makes little sense to spend hours of testing to find this out.

Next double click on the Lc0 file after which normally a command prompt should pop up. Type "go nodes 100" and press enter. Wait till the command is executed. If you see on the last line "bestmove ..." then you can close the window.

Now go to Chessbase and start the application "Create UCI Engine" under the tab "Engine". Select Lc0 and click on ok. If everything went ok then you can now choose Lc0 as engine and start to analyze with it. I also want to warn that you need a bit of adjustment with Lc0. Lc0 will only give a first evaluation after some seconds contrary to the classical engines which give instantaneously an answer. Also don't be afraid of the low number of positions Lc0 checks. It is fully normal to see Lc0 calculating 1000 times slower than Stockfish. It won't play worse due to it.

Voila we are again up to date but the developments are not stopping. New neural networks are at the doorstep. Of course Chessbase wants a piece of the pie and has recently proposed fat fritz. More interesting I think are the new engines which are now competing in the mastergroup of TCEC season 16. Some new names like Alliestein, Scorpio and Stoofvlees are already infiltrating at the top. Yes stoofvlees also made me smile. The author is the Belg with Italian roots Gian-Carlo Pascutto preferring to eat stoofvlees instead of pizza.

Brabo

3 comments:

  1. Allie is also an interesting engine in its own right.

    ReplyDelete
  2. How to download it? leela or allie also can. But when i download my leela on chessbase, he can't works! How can someone help me?

    ReplyDelete
    Replies
    1. Did you follow the steps in my article? I believe they are still valid today. It recently worked again for me when I downloaded a stronger network. Also readers told me that my article helped them to install leela.
      Do you have the right graphic card?
      Finally for people really not willing to go through the hassle and have money, you can buy https://shop.chessbase.com/en/products/fritz_17#. Fat Fritz is the same strength and is very similar to leela.

      Delete

Note: Only a member of this blog may post a comment.