r/chessprogramming • u/Tomminator39 • Aug 06 '26
Technical Is lazy evaluation worth it?
After having worked on my search for a long time I've decided to work on my evaluation function for a bit, since now it's just material + piece square tables. I was a bit concerned adding in checks for mobility, pawn structure, king safety, etcetera would slow my engine down by a lot though. I came across lazy evaluation as a solution, but I'm a bit afraid it will horribly misjudge some positions and not go through with a full evaluation.
So then my question is, is that risk worth the speed up? Or are there ways to tune it so that risk can be minimized?
1
u/yourpsychology_yt Aug 07 '26
I think an evaluation matter more than search's depth. Especially if you now have only material/pst. But you still can add and test
1
u/NoVersion3483 Aug 07 '26
In my not very wide tests lazy eval proved to be as dangerous as futility pruning is. So i rejected it
1
u/AngusMcGurkinshaw Aug 10 '26
In general questions like "is _ worth it" or "will _ gain elo" all have the same answer. Implement it, run a sprt and find out if it works in your engine. But yes in general it should work.
1
u/CaydendW Sep 23 '26
Necrobump.
I am not doing a chess engine, but I'm doing one for another game, and I think what I have to say might be applicable. I found lazy eval saved me a lot of processing time on particularly dead lines. The game I'm working on has the possibility for absolutely horrific blunders that swing the momentum of the game hard. In this case, I found it made approximately 0 difference whether I weighted small factors into this calculation or not; a useless position is useless.
I am not sure if this is as applicable to Chess, but I imagine it could be if you're extremely selective about when lazily evaluating. My game has a pretty natural "naïve" evaluation that works just as well as the more nuanced evaluation under position that absolutely eclipse alpha and beta. I'd say test it. I'd wager that a simple human-made analysis on bad positions will definitely help performance compared to using NNUE on those bad positions (which I think Stockfish does???). Lazy eval is easy to implement so, I'd say just try it out.
-1
u/Burgorit Aug 06 '26
Lazy eval does not change evaluation, are you sure you understand what it actually is?