lkaufman wrote:BubbaTough wrote:jdart wrote:
Don't you have to do eval on the last four mainsearch plies in order to do futility pruning?
IIRC Crafty does futility based on material score only.
--Jon
Additionally, for programs with lazy eval (not Stockfish) most calls to eval in the last few ply are really very similar to simple material balance checks.
-Sam
That is a very interesting observation. This could account for some of the NPS gap between SF and IH. What I still don't understand is why lazy eval helps the ippos (and Rybka) but does not help Stockfish or Komodo. Previously I thought maybe we were missing something, but now it seems to me that the Ippos are doing something wrong if lazy eval helps them. I think lazy eval is the solution for the lazy programmer! He should really cover every case where it is used separately. But I don't quite get why lazy eval works in Ivanhoe, since it seems they already do have margins for each separate case.
I can only see a few ways lazy eval doesn't help.
(1) it is done incorrectly and has too much error. That is, you lazy exit too frequently, and get evals that are simply wrong.
(2) it is done incorrectly and has too much error. That is, you lazy eval almost never, because your margins are too conservative, and you see no savings in time (but of course, you also get no errors).
The benefit comes when you get the margins right, so that you save the effort when it won't help, while keeping the error rate low enough that the overall speedup makes the program stronger. This is a direct influence on NPS, plain and simple. One can do lazy eval with zero error. Ferret did this. I didn't like the complexity and discovered that a tuned margin was just as good, and less complicated, and more importantly, did not need adjusting every time an eval term is modified, added or deleted...
If your eval is so entangled that you can't safely take an early exit and you end up doing most of the eval code before you can exit, then the savings are going to be small, as will the elo gain. I suppose I could turn lazy eval off to see what the gain/loss is. I'll start that test right now, just for information...
Here's a quick speed test for comparison:
log.001: time=36.15 mat=0 n=64797986 fh=93% nps=1.8M
log.002: time=48.42 mat=0 n=64299103 fh=94% nps=1.3M
The second has no lazy exit. Significant change in search speed (.5M nps slower) not much change in tree size. scores and PV are the same:
20-> 36.15 -0.11 1. ... Bxe4 2. Bxe4 Qxc4 3. Qxc4 Rxc4
4. Nxb6 Rxe4 5. Nxd7 Nxd7 6. Rac1 Nb6
7. Bd4 Rb8 8. Rc6 Nd5 9. b6 Rxd4 10.
Nxd4 Rxb6 11. Rxb6 Nxb6
20-> 48.41 -0.11 1. ... Bxe4 2. Bxe4 Qxc4 3. Qxc4 Rxc4
4. Nxb6 Rxe4 5. Nxd7 Nxd7 6. Rac1 Nb6
7. Bd4 Rb8 8. Rc6 Nd5 9. b6 Rxd4 10.
Nxd4 Rxb6 11. Rxb6 Nxb6
A note. We have two lazy exits in Crafty. With different margins. The last exit is the one that skips all the individual piece loops (except for pawns) as that is where most of the heavy lifting is done, looping over all the pieces and such. A significant speed advantage.