lichess.org
Donate

using Leela Chess Zero on Lichess for analysis

A note and a bit of a disclaimer: I wanted to say that I myself have worked on making this easy and straight forward! So if you do come to use it, please let me know your experiences with it so I can improve it, and also so I can measure the interest in it to decide whether it’s worthwhile keeping it available and continue working on it. If enough people seem interested, I might end up publishing the source code somewhere and polishing it up a bit more!

I have recently made a page to facilitate using Leela Chess Zero on Lichess for game analysis! <zamfofex.neocities.org/lc0/> It is enough to click the button on the page, then while analysing a game, you can choose Leela on the hamburger menu below the move list under “External Engine”. (More detailed instructions on the page itself.)

Again, please do let me know if you come to use it, and what you think about it!
This is great! Super seamless to use. I would definitely be interested in learning more about how it works.

Edit: actually thinking about it more, I’m very curious about it. I’ve been trying to set up an external engine to do analysis with Stockfish 15, but the process is way more complicated and less convenient than what you’ve made here for lc0. I would love to hear more about it.
Wow, congratulations!! I was waiting for this for a long time. The installation and the activation is smooth! However, having the workload on your server (I suppose) can cause some problems: after some time of usage I got some delays in the evaluations and eventually the message "Error loading engine". It would be great to install a local WASM version of it.

Also, I see that "request a computer analysis" is not affected (it still uses Lichess' Stockfish). I suppose it's not possible to do this with LC0 because all the analysis are saved in Lichess' servers for future and public use. However, your work can possibly encourage an official integration of LC0 in Lichess in the future :)

Keep up the good work!
Maybe a browser extension that could download the game and use Nibbler with Lc0 or Lucas chess to analysis the interested games automatically would be useful.
I'm getting Error loading engine message as well. I would love to use it otherwise.
@kneuner: Thank you for showing interest! I might end up publishing the code somewhere after all. The Lichess API for it was super smooth to use!

@MikaTheCat, regarding Lichess’ server analysis: I think it’s indeed not possible to replace it unfortunately, but at some point, I was considering adding an option to cache game evaluation. The idea would be to evaluate your games while you are playing them, and keep the analysis available cached for several minutes, so that then clicking on a move to evaluate a position would immediately show the cached result. I didn’t go through with the idea at first because it seemed a bit convoluted, and probably not immediately obvious to use.

Regarding loading failures: Besides the fact Lc0 doesn’t support Wasm as far as I know (so I’d have to figure out how easy it is to compile it to Wasm by myself), another big problem is that Lichess doesn’t really have any way to do that! Which I guess is sensible, because letting people run arbitrary code on your Lichess pages seems really unsafe (even though Wasm is supposed to be isolated from the rest of the page). So all I can really do is just run it on my own servers or computers. (In this case, I set it running on a VPS.)

@i-bex: It seems to be working for me now. If it wasn’t working for you, maybe you could try it again now!
@zamfofex I've been playing around with it more today. Looks great! One thing I have noticed—and I'm not sure whether this is due to the Lichess EE API or your implementation—but disconnecting access in Lichess settings seems to sometimes leave a persistent channel open to your server. That is, even after disconnecting it from my account, I can still select Leela Chess Zero from the analysis board and execute analyses. Reconnecting gives a second instance of lc0 available. Not sure what that's about, but I thought I would let you know.

If you do end up publishing source code or any more info about how you went about this, I'd definitely be interested in checking it out. This has a lot of potential!
Very cool! It seems very slow though, I get it to about depth 9 at the same speed as Stockfish takes to reach depth 30. Maybe depth is slightly different for Leela?
@zamfofex Thank you for sharing it! I have been using it somewhat regularly and really like your implementation. Really appreciate you sharing the source code as well; it answered a couple questions I had about how the analysis is executed.

Again, I think this is really great and especially has a lot of potential for future expansion. Just excellent stuff.

This topic has been archived and can no longer be replied to.