Winning starts with what you know
The new version 18 offers completely new possibilities for chess training and analysis: playing style analysis, search for strategic themes, access to 6 billion Lichess games, player preparation by matching Lichess games, download Chess.com games with built-in API, built-in cloud engine and much more.
When Alpha Go, and then Alpha Go Zero, was released, it cracked one of the most challenging strategic games in the world, and one that experts all over had thought would resist for at least another decade. It was the result of a powerful artificial intelligence technique known as deep reinforcement learning, which built a neural network combined with the Monte Carlo Tree Search that allowed the program, equipped with just the barebones rules of the game, to play itself millions upon millions of times, learning as it went until it reached, as was the case, superhuman playing strength.
All the more remarkable was that the Deep Mind group published peer-reviewed papers that detailed exactly how it was achieved. In a sense, this was the equivalent of IBM creating the world-beating Deep Blue, and then publishing blueprints the very same day so that anyone could build their own. As a sidenote, Feng Hsu and the Deep Blue team did eventually publish papers describing the entire thing inside and out. Nevertheless, it was believed that while a game such as Go, might fit this form of software engineering, it would never really work for a chess program. At least not at the highest level. After all, Go is less about calculating exact lines, and more about extensive pattern recognition, while chess is highly tactical and seeing just a single extra move ahead can make or break a program.
Then along came Deep Mind, who poured in their resources and built a world-beating engine that learned the game itself within 24 hours. Naturally, there were plenty of special conditions in play, such as having access to thousands of incredibly powerful processors to help develop its ability in such a short time, but they did it. Consider that if Murray Campbell and Co. had thought that just piling in special hardware would somehow solve chess for them in 24 hours, they would have done it. Deep Blue had a system performance of 12 GFLOPS, while the horsepower DeepMind used easily exceeded 40 million GLOPS.
DeepMind's professor David Silver explains the new 'Zero' approach in AlphaGo Zero, which preceded Alpha Zero (chess)
The new Alpha Zero chess program lead to an astounding media frenzy, and just as much controversy in the chess world. Much was made about the conditions of the match against a 64-thread version of Stockfish used to test its strength, but this was to completely overlook the important aspect of it all: a new world-class engine, using a completely new method and technique, had been developed in 24 hours. What was more, anyone was invited to make their own.
The paper "Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm" at Cornell University
This was not nearly as easy as might seem. For one thing, a single person could hardly do it at home with a single machine, or even a room full. Then there is the matter of trying to translate Deep Mind’s explanations in their paper into concrete computer code.
But some programmers took up the challenge, and after developing a Go program, Leela Zero, the strongest one publicly available now, based on community effort and contributions, it has been transferred to chess.
Leela Chess Zero is based on the seminal Alpha Zero paper, using the same self-learning techniques and the same Monte Carlo Tree Search technique. It is hosted at the LCZero site and there one can not only find the engine but the latest version of the neural networks — the brain if you will.
The project is still in its infancy, having only really started two months ago. As it depends very much on help by others to contribute computer time, the beginning was slow as time was needed for word to get around, tools developed to make it easy, etc. Because of the unique nature of the engine’s design, using a huge evaluation function (over 80MB), it gains exponentially in strength when used with a good graphics card.
Without a graphics card, using only my CPU, I barely get 20% the performance I get with the GPU (graphics processing unit). On a laptop equipped with a quad-core i7 and a fast GTX980M graphics card, it plays at around 2700 Elo or so. Remember that this is after just two months of self-learning. However, the engine’s play is quite different from anything I have seen or tested before, and I am speaking from over 20 years experience.
Without exception, until now, an engine’s strength was clearly determined by its speed and tactics. Sure an engine could compensate a slight tactical deficiency with more knowledge, but not by much, and more often than not, the ‘dumber but faster’ engine would compensate its ignorance with slightly deeper calculations. This give and take has defined engines on the PC since the beginning of computer chess.
Therefore you can imagine what I thought after the following: I gave a fairly weak engine — Firefly (rated 2250) — a basic tactics test of 100 positions, a set so easy I would expect myself to score 100, and it scored 94/100. I then fed it to Leela Zero, which barely scored 41/100. I grimaced, knowing this meant Leela was going to get trounced, but still decided to play a small match of 10-minute games just to gauge its play. I found myself forced to stop the match early after it was 10-0 for…. Leela!?! I check and triple-checked the settings to make sure everything was fine.
Master Class Vol.4: José Raúl Capablanca
He was a child prodigy and he is surrounded by legends. In his best times he was considered to be unbeatable and by many he was reckoned to be the greatest chess talent of all time: Jose Raul Capablanca, born 1888 in Havana.
I then tried another engine, Delphil 3.2 (rated 2494) with the same 10-minute conditions, and stopped it after 20 games with Leela bullying it 15½-4½. What on earth was going on?? I never heard of an engine compensating hundreds of Elo of tactical gaps with pure positional play. That is a human thing, not a machine. Eventually, it found its match with Nebula, a 2700+ engine with a 14½-14½ score, enough to suggest this is about where it stands.
With a description of an engine compensating tactical weaknesses with massive positional play, you might expect games that looked like Carlsen or Capablanca, with controlled complications, and then a boa constrictor win later, right? Not even close! Leela Zero makes Topalov, the king of exchange sacrifices, look like a timid milkmaid. It plays a ton of speculative moves, readily giving up pawns, exchanges and more for activity and play. Please note the word speculative, because I doubt very much these are all correct. However, they do make for very entertaining games, and what is more, it plays the endgame impressively well.
Take a look at the following game, which sort of illustrates some of the surprises it can come up with:
Williams main teaching method behind this set of two DVDs is to teach you some simple yet effective set ups, without the need to rely on memorising numerous complicated variations.
Bear in mind that while it misses some easy tactics it also catches some hard ones very quickly.
In the position above, White (Leela) played the lovely 38.c5!! And went on to win after 38…dxc5 39.Rd7!
I caught up with Gary Linscott (pictured), the person who spearheaded the Leela Chess Zero project and helped make it what it is today. (Please note that another interview with Gian-Carlo Pascutto, creator of Leela Zero — which led to Leela Chess Zero — will appear soon.)
Albert Silver: Hi Gary, congratulations on the fascinating project. How did it come into existence? Concept, execution, etc
Gary Linscott: The AlphaZero paper was a landmark — it was the first time traditional techniques had been defeated in over 20 years. I had wanted to learn about reinforcement learning, and this provided a great motivation. I even started a small version of this project in python with a co-worker, but we weren't generating anywhere near enough games to make reasonable progress. Then, Leela Zero really started to take off. A user named benediamond got the ball rolling with a non-working prototype of chess support for Leela Zero. It needed a fair bit of additional work, which I did, and then coded up the server and client in Go [the coding language, not the game -Ed.] to learn more about that language. Then, I launched it on Talkchess, and the support has been incredible since then!
AS: How is Leela Chess Zero being developed? Is it just you, or others, or...?
GL: There is an extremely active community! Folkert Huizinga (Error323) was one of the earliest to join and has been the driving force behind the training process, which generates the new networks. It's an extremely hard, and time-consuming part of the project, and he's done an amazing job. We got a donation of the training hardware as well, which has been fantastic. Then a bunch of great developers have stepped up to help out as well, special mention to Andy Olsen (KillerDucky) and Alexander Lyashuk (mooskagh).
AS: How close is it to Alpha Zero, or how different?
GL: It's quite close to AlphaZero in concept. The paper doesn't really reveal all the little details, so we aren't 100% sure. For example, there is a critical change in the network architecture that was required for chess that wasn't in the paper (the number of layers in the policy head for the technically inclined).
AS: What has been the biggest challenge so far in creating/developing it?
GL: Keeping up with the community! There is a lot of passion, but it's a part-time project on my side. Others have really stepped up and made huge contributions thankfully.
AS: Roughly how strong is Leela Chess Zero right now in FIDE Elo terms?
GL: It depends (smiley). It's very sensitive to the hardware, and the time control used. However, in recent blitz/bullet matches, it was able to defeat human IM/GMs convincingly. Against other machines, it's still a long ways from the top — estimates vary between 2600 and 2800, while something like Stockfish is ~3300.
AS: How much strength does a decent video card add?
GL: A huge amount! For example, the TCEC competition is playing it on ~40 cores, and it would be roughly the same speed on a 1080Ti. We will also improve the efficiency significantly on GPU as time goes on, with things like CUDNN, and TensorRT.
AS: What has been the biggest surprise so far?
GL: How much interest and passion there is around this project. It's been fantastic to watch the community really get excited, and all the chess personalities who have tried playing it.
AS: While testing the engine in Fritz, I noticed a number of very strange tactical oversights, even in fairly simple positions. Is this normal, and if so, when would they be overcome?
GL: Definitely normal, the network is still learning tactics, especially at low depths. Also, we are on a much smaller network than DeepMind used (10x128 instead of 20x256).
AS: How many games did AlphaZero need to be trained to its famous level, and how many has Leela Chess Zero used? Also, at the current rate of development, how long would it take to reach that level (presuming similar hardware)?
GL: From their paper, 44 million if I recall correctly, while we are at 8.2 million as of this email. However, we've also had some significant bugs during the training process, and have been learning a lot as we go. I wouldn't be surprised if our run took longer.
AS: Can you tell a bit about yourself
GL: I've always loved the combination of distributed systems and chess. A few years back I also developed "fishtest", which helped take Stockfish to number one on the rating lists (although these days, a wonderful community has taken it on). My professional work is on developing autonomous cars, which is extremely fun and challenging.
Leela Chess Zero can be installed as a UCI engine in Fritz or ChessBase, though it does require a few extra steps. Also, you most definitely want a video card to run it properly. The faster the better, but anything beyond Intel integrated graphics should be a plus.
1) Download the latest Windows build (there are Mac versions too), it comes with the needed DLLs: https://github.com/glinscott/leela-chess/releases.
If you have a discrete GPU (graphics card), get the gpu-win.zip version instead
Unzip into a folder of your choice. I created one called \LCZero.
2) You may also need to download and install the VC Redistributable 2015 x64. Many other programs rely on this library so you may have it already.
3) You will now need to double-click on the LCZero.exe engine one time. It is vital this be done before trying to install it as a UCI engine.
4) Go to the Network page and download the latest network file. Naturally, you can download any version really, even when it was rated a big fat zero. Right-click on the blue Network number and save.
You then unzip it to the main Leela folder. Now you will have a very large file with a long name that looks like a secret code. Rename it to weights.txt
5) If you have a GPU, then I strongly suggest you download this .bat file and unzip it in the same folder as Leela and then run it. This is a simple command that will have the computer run a full tuning of your computer to get best results with Leela. It may take 20-30 minutes, so be patient.
Running the script will do a full tune of your graphics card to get optimal results. Please note this can improve performance to almost double even!
You are now ready to install it in Fritz/ChessBase!
6) In Fritz/ChessBase, select Create UCI engine
The multiple computer chess world champion comes in a new and yet more powerful version. Thanks to co-author US Grandmaster Larry Kaufman, Komodo is the strategist among the top chess programs!
Then find LCZero.exe file, and that is it!
When you want to update the neural network with the latest version, all you need to do is download the newest Network file, and rename it again.
If you would like to contribute some of your computer time to help Leela, just double-click on the client.exe file in the folder. It will start running self-play games, and send them to the site. To stop the process, just close the window. For more information, please see the Getting Started page.
If you are having trouble with Leela, or have any questions or suggestions, be sure to check out the official forum for it.