lichess.org
Donate

Loading the chess engine in analysis mode is a PITA, why?

So, I often like to analyze my blitz games after having played one. As I often don't play my known openings but other lines that leads to types of positions in which I'd like to get better, I launch an analysis after almost every game for a quick check on opening theory as well as checking if the plans were sound.

Everytime I launch analysis, I tick right away the computer analysis mode so that it loads. I allways set it to 4 variations displayed and infinite time. At the start of the review it is in cloud mode. Okay fine. Then I start to look at the game, use the opening explorer to see what's played and less played and try to understand the lines. Then at some point I reach a part in the game where the cloud analysis is not stored anymore and stockfish has to load. It sometimes takes up to 5mn. So I am stuck there and I have to wait. Because if I go back in the analysis in some lines that is in the cloud the loading somehow cancels and I'm back to square one.

Why doesn't the engine just loads when I tick "computer analysis" at the top right corner. It then either displays cloud if available, or calculates if it needs to. Why doesn't the engine stays loaded and I have to spend several minutes just loading the engine each game? I suppose that for the second question it is a limitation of needing to stay on the analysis webpage, so fine. But seriously, why doesn't it preload when I click computer analysis.

Currently, I spend almost as much time loading the engine as I spent playing the game. This is a huge PITA. This is so sad, the feature is amazing, the interface works very well, but the loading times just ruin it all. It takes so much dilligence for me to force myself to stop there and wait the loading to analyze the lines instead of just launching another game and learning nothing.

I'm not sure if this is a design choice, expecting the loading times to be fast enough for most users to not be noticeable, or if this is a limitation, but in case it is the former I decided to let my experience here.

Have a nice day.

Edit: I suppose a solution would be to keep the analysis page open, but I suspect I would get easily flagged as a cheater if I played a game with the engine loaded in another tab, especially if I'm playing anonymously.
It shouldn't take 5 minutes. If NNUE, maybe it's unable to cache the nnue net and has to re-download it on every page load or something. Are you using firefox/chrome/private browsing/extensions/etc.? How's your internet speed? Any details you can provide might help.

Also, you could check out external engine which is basically native stockfish on your system but outside the browser. github.com/lichess-org/external-engine

Let me know if you're interested but need help setting it up.
so we are not talking about the analysis request under the board postgame.. but position per position local browser engine analysis, which will run in the user machine if position not in the cloud cache.

It might depend on op machine... I have a slow machine, and 5min does happen with certain position, but the pattern is often a fast search (in 1 PV mode), and more time when near the final input depth..

It goes through iterative deepening. Note, that in my slow machine, I have fun watching that being visible, in slow motion, as the shallower results are actually showing what the static evaluation is able to see in shallow depths, where we as human can also calculate to some extent... that human horizon story gets lost pretty soon when SF keeps look at deep mostly material rewards or certain classes of near mate positions.

SF in tournaments does not use multiPV, at least not 4... This is a compromise for non-tournament mode usage of it, for humans analytical needs.. It is fast in tournaments because it prunes the search tree to the max, beyond strict AB pruning...

But when using 4 mutlPV everywhere you are forcing it to not prune as much. (my understanding)
Am I wrong?, other licehss users that know about SF internals?

I remember issues on SF github about multiPV giving speed problems even when turned off, that would be a regression in their ELO measure, the main goal of their optimization pipeline... This got fixed, but does tell that it is a load on SF.

i keep to 3 variations, because it is enough to have a sense of how flat the profile of best moves is... But you seem to want to also use the PV themselves as variations to study, not only to judge the best SF PV with respect to its alternate nearest neighbor. I understand, i would do 5 even to get the sense of how bad it can get among the legal candidates, according to SF.

my machine is from 10 years ago.. i use chrome as brower, and 5 minute for 4 PVs, does not sound surprising.
I am using a computer which isn't mine, so setting up an external engine isn't possible. When I'm home I already have engines installed on my system, but there the engine inside lichess loads fast enough that it's not a problem.

Internet speed should not be an issue. Not top of the line but it seamlessly streams youtube videos for example so loading a few MB shouldn't take several minutes. speedtest.net gives a stable 7Mbps. If it matters, CPU is around 20% and memory has around 3Gb free out of 7 (I know, weird max RAM) on a windows 10 enterprise.
On this computer I am using firefox, version 103.0.2 (64 bits). Only extension I have here is qwant lite.

I didn't think about trying to disabling NNUE, but it doesn't seem to change a thing. When I activate the engine it is still spending a lot of time "Loading engine" without the "X MB / Y MB", and also write Stofish 14+ NNUE even though I disabled it.

Let me know if you need more information.
<Comment deleted by user>
@DoctorFuu said in #4:
> When I activate the engine it is still spending a lot of time "Loading engine" without the "X MB / Y MB", and also write Stofish 14+ NNUE even though I disabled it.

Yikes! It should not report NNUE after you disable NNUE! Can we pretend I didn't see that for now? So if you're not seeing X MB / Y MB then it's not really a loading problem. It's confusing, but the browser engine's javascript wrapper shows "Loading engine" whenever it's awaiting the initial batch of results from each request to stockfish. This only involves downloading webassembly binaries or nnue nets from lichess.org (if they're not cached) after a fresh page reload. "Calculating moves" would be a better thing for the UI to say.

> If it matters, CPU is around 20% and memory has around 3Gb free out of 7 (I know, weird max RAM) on a windows 10 enterprise.

I'm at a loss at why your home vs work performance would differ so much (assuming similar setups, firefox etc). You might check with your IT staff at work.. It's a long shot but maybe your enterprise windows deployment has some admin-imposed restrictions or anti-malware that hoses webassembly performance.
You said you're using a borrowed Windows enterprise machine. "enterprise" suggests a business computer... could a company firewall or VPN be blocking the engine download?

I've never even seen the "Loading Engine" message. Must happen pretty darn quick most of the time.

@DoctorFuu said in #4:
> ... and also write Stofish 14+ NNUE even though I disabled it.

After disabling NNUE, you have to reload the page (note the mouseover tooltip on the NNUE slider).
It could be that it is trying to retrieve something off the internet, is failing at that, and times out. After which it uses a default value and still works. Sitting there idle while saying loading without showing a progress bar would suggest that it is waiting for an initial response and not getting it. Might be trying to get something from a blocked site, anywhere that is running enterprise windows is likely to be filtering web access at least somewhat.
@mcgoves said in #7:

> After disabling NNUE, you have to reload the page (note the mouseover tooltip on the NNUE slider).

Thanks, this works seamlessly!

@ProgrammerAngrim said in #8:
> It could be that it is trying to retrieve something off the internet, is failing at that, and times out. After which it uses a default value and still works. Sitting there idle while saying loading without showing a progress bar would suggest that it is waiting for an initial response and not getting it. Might be trying to get something from a blocked site, anywhere that is running enterprise windows is likely to be filtering web access at least somewhat.

It may be something like that. It still ends up loading though so it's not completely blocked. If it's coming from the filtered connection then I suppose it has nothing to do with Lichess. I still find it weird that it doesn't block it completely though.

If the devs confirm that it likely comes from the connection here, and since it works seamlessly when disabling NNUE, I think we can consider this case closed. Thanks guys.
Mostly reproduced on Android/Chrome. I made an 8-move variation, then cleared it from the browser cache (the much maligned new.feature), and it switched to Loading. Could it be that the same browser cache that stores move variations also stores the NNUE. Clearing it wouldn't necessarily even send a fresh download request, hence the long waits. Why it downloads eventually, I don't know -maybe a deadman timer in the code somewhere? I waited 6 minutes without getting anywhere, though a page refresh cleared the problem.

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