How to Run Leela Chess Engine (LCZero) in Arena at a Specific ELO

Leela chess is an open fork of AlphaZero. Unfortunately, Google didn’t let us have the program, but they released a paper detailing how they did it , and Leela is the result. Since no single person has the resources of Google, this is a distributed project where Leela trains herself across hundreds of computers. We make up in numbers, what we lack in sheer power.

If you want to contribute your GPU to helping Leela chess get stronger, visit the project page and get started! You can also play an online version of Leela at her strongest current strength at http://play.lczero.org/.

However, the great thing about Leela is that you can also download the engine and play her at lower ELOs. This is a completely different compared to playing an engine like Stockfish at half strength. Modern chess engines will artificially lower their strength by blundering unnaturally and then play like a GM for the rest of the game. Leela’s games at lower ELOs are much more “human”, making her an excellent sparring partner!

In this tutorial, I’ll show you how to set up Leela on your local PC and plug her into a chess GUI like Arena.

Step 1: What you Need

Here’s what you need to have/know in preparation for Leela:

  1. The Arena chess program. Available here.
  2. You need to know what “rating” you want to play Leela at (more on this later)

Step 2: Determining your Rating

As Leela trains herself, she keeps increasing her rating – with a rating of “0” being random moves. Unfortunately, these self play ratings don’t translate directly into “human” ratings. As of this writing, Leela’s self play rating is 4343. But her ELO as understood by us is ~2000.

So to download a version of Leela that matches your ELO, use the following formula:

x = (y+511.7)/0.6

where:

x = Leela’s self play rating and
y = Your rating/the ELO you want to play Leela at

So for example, if I want to play a version of Leela at ELO 1500, her self calculated rating at that level will be:

(1500+511.7)/0.6 = 3352

Step 3: Download the Appropriate Network Weight

With the rating you obtained in Step 2, head over to Leela’s network weights page. This page contains the snapshots of Leela as she gets stronger. Each snapshot is represented by an ID. You can see her self play ELO in column 3. Scroll down till you find the ID that most closely corresponds to the self play ELO you calculated in step 2.

In this case, network ID 19 has an ELO of 3319, which is pretty close to 3352 which I calculated in the previous step. So I’ll use that one.

Click the link and it’ll download a file onto your desktop. This is a compressed file, that needs a program to open it. To get your software to recognize it as compressed, you need to rename it with a “.gz” extension. Like this:

Once your computer recognizes it, decompress the contents.

It will be a single file. Make a note of its location.

Step 4: Download the Leela Engine Bundle

Get the latest engine bundle for your system from the project download link. I’ve chosen the CPU version for Windows, because that’s my system configuration.

This will be a zip file. Unzip the contents into a folder called “Leela”.

Step 5: Put the Files Together into the “Engine” Folder in Arena

Now you have two downloads. Namely:

  1. The network weight file you downloaded in step 3
  2. The Leela engine (lczero.exe) that you downloaded in step 4

Put all these files in the same folder. Call the folder “Leela”, or “LCzero”, or whatever name you want to appear in Arena. Now transfer this entire folder into the “Engines” directory of Arena. This is the folder structure with the files:

Now it’s time to configure Arena with Leela!

Step 6: Installing the Leela LCZero Engine in Arena

Open the Arena program, click the “Engines” tab on top and click “Manage”

In the resulting window, click the “Details” tab and click the “New” button as shown here:

This will open a dialogue box asking for the location of the engine. Navigate to the “Leela” folder you created in step 5, and select “lczero.exe” as the engine.

In the next box, select “UCI” as the type of engine:

After selecting the engine, we need to enter the command line parameters in the box provided. Here, use the network weight file you extracted in step 3, in the following:

-w 209032b7

Replace the text in bold, with the name of your network weight file.

Then click “Apply” and then the button “Start this engine right now!”

And you’re done! The dialogue box will vanish, and Leela will now be the engine in Arena, running at the ELO strength you selected. Here’s a sample output from the Queen’s Gambit Accepted line.

What if the Above Doesn’t Work?

Sometimes the above steps fail for some reason. Leela just won’t start. So here’s something that has worked for a lot of people.

Step 1: Go to your engines folder in Arena

Step 2: Create a “lczero.bat” file and open it for editing

Step 3: Type the following into it:

@lczero.exe -w [network weight name]

Make sure you replace the section in square brackets with the network weight name you downloaded and unzipped in Step 3.

Step 4: Now go set up the engine again. This time, instead of choosing lczero.exe, click the drop down box labelled “Files of type” and select “Batch files (*.bat) instead.

Step 5: Now lczero.bat should be visible. Click on it and choose it as the engine.

Now just run your engine! Wait for a while for it to load and do its thing. No need to enter any command line parameters like before. These steps have helped a lot of people when just using lczero.exe directly didn’t work.

I hope these instructions make it easy for people to get started with running and experimenting with Leela. If you have a GPU, you can also use the bundled “client.exe” file to contribute your own GPU cycles for training games to help make Leela better!

What do you think of this post?
  • Agree (55)
  • You're an asshole (25)
  • Don't Agree but Interesting (12)

40 thoughts on “How to Run Leela Chess Engine (LCZero) in Arena at a Specific ELO”

  1. Finally someone who posts a tutorial on this! I like it! F*ck github and their jargons. This is the format they should have used to explain their stuff.

    Reply

  2. Thanks, these instructions is very clear. However, I am not sure I succeeded completely, because when I click the Analyze button in Arena (as I do with other engines when I want infinite analysis) Lczero seems to run for a few instants, in which moves get typical “pawn valuations” (as we see in your screenshot). But in less than a second that is replaced by 0%-100% Leela valuations for each move, and the GPU stops working, so I know Leela is not thinking further. When I make a new move on the board the same thing happens: a peak in GPU usage, pawn valuations, and the GPU stops. I know Leela is not an engine, so maybe this is expected behaviour. But then, when we play Leela online and choose “hard”, it plays better because it takes longer, right? Can’t I make it ponder each move as long as I like in Arena?

    Thanks!

    Reply

    • In reply to zeycus

      I think you’re right. I don’t know how to force the engine itself to think for longer other than setting it in Arena. This might just be the way the engine works…I don’t know. Sorry!

      Reply

  3. Thanks, great job!
    I Can’t run it in arena, I don’t have gpu and use windows 32 bits, i get this message: 64 bit engines do not run on 32 bit OS, is there a 32 bit version of Leela?

    Reply

  4. Thank you for a wonderful tutorial!
    lczero’s claimed strength is certainly no means 4000+ yet. However, where did you get the formula for the “human equivalent” for its palying strenght? I mean x = (y+511.7)/0.6 )?…
    Btw, there are changes that the formula might need some adjustment given that the strength of the engine grows continuously.

    Reply

      • In reply to bhagwad

        Thank you very much for this very valuable link! Bookmarked….
        I hope to be able to download a weight file that would make lczero play closer to my strength (whici is around 2000, more or less, perhaps…less).
        As a side note, it is just amazing how fast Leela is learning.

        Since this page is meant more for instructing people on how to use Leela as a UCI engine, it might worth mentioning that it can be also played in ChessBase/Fritz etc. For those willing to play Leela using CB, please be aware that you need to use a program named “InBetween”, which basically acts as a wrapper (translator) for other engines which seem incompatible with UCI. In fact lczero works just fine as an UCI engine, provided that you fill in the parameters in the ini file used by inbetween (just google for it, and you will find it on the first search). There are two versions of “Inbetween”. Use the first one.

        Here is a sample of what you should put into inbetween.ini:

        CommandLine := “D:/Arena/Engines/Leela/lczero.exe” -w d3cd3f9362e2c72bbc0bd63f945c3be08a4dfa312eafb92a01f54e82f170119e –uci -t8 -q

        It is very important that you use “/” and not “\” in the path to lczero.exe.
        Another mandatory parameter is the weights file. Other parameters are less relevant, but you can query and adjust them too (type in lczero -?).

        Btw – the same approach for Lucas Chess.
        This at least worked for me. Greetings to you chess friends!

        Reply

  5. Hi Bhagwadhjee
    Your Tutorial was very instructive and easy to follow, compared to the one posted on the LCZero Google Groups.
    Could you also post a Tutorial about using it in Fritz GUI and also enabling it to use Syzygy EGTBs ?
    Regards
    Anil

    Reply

  6. Hi Bhagwad,

    Long time no see. I was worried for a second after you vanished. Good to know you’re fine and well!

    Yes, I just tried playing this game, and damn, even the easiest part is difficult! But that’s because I never played chess for a very long time, so it was natural for me to lose within a few minutes of playing even the easiest level!

    I just tried it out on the website, I’ll be downloading and playing this game later today or tomorrow.

    By the way, are you in India? Or are you still in the US/Canada? Or elsewhere? Never mind if you want privacy and safety.

    Thanks.

    Reply

    • In reply to Iniyavel

      Hi! Good to hear from you too :)

      I’d stopped writing for so long, because I figured I had nothing left to say! All the new issues that cropped up were rehashed versions of older stuff, and I didn’t feel that I could bring new insights to the table…

      I’m currently in the US. Not sure what the future holds for me though!

      Reply

      • In reply to bhagwad

        That’s great to know!

        Addressing redundant issues is boring like you say, however they might give new learning insights to those who are interested. I mean, like different ways of seeing things.

        Thanks.

        Reply

Leave a Comment