Is razoring useless in modern engines ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Alayan
Posts: 550
Joined: Tue Nov 19, 2019 8:48 pm
Full name: Alayan Feh

Is razoring useless in modern engines ?

Post by Alayan »

Razoring is an old technique that often gives nice elo gains early in the life of an engine.

But I've come to think that it's useless in a modern engine with many other pruning techniques.

Results from removing it :

In Stockfish, 10s+0.1 @ 1.6mnps : ELO: -0.35 +-3.2 (95%) LOS: 41.5% - http://tests.stockfishchess.org/tests/v ... 02562bbd34

In Ethereal, 12s+0.12 @ 1.275mnps : ELO | -0.91 +- 1.76 (95%) - http://chess.grantnet.us/viewTest/4325/
In Ethereal, 60s+0.6 @ 1.275mnps : ELO | 0.45 +- 1.82 (95%) - http://chess.grantnet.us/viewTest/4353/

I've also noticed in the release notes of Pedone 2.0 that razoring was removed, so that would be a 3rd engine where it was found to be useless.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Is razoring useless in modern engines ?

Post by Daniel Shawul »

Doesn't stockfish do a really aggressive razoring like depth <= 5 or something like that?
If it worked in the past, maybe it just needs a re-tuning of the margins to make it work again.
I think futility pruning is the only "sound" pruning, the rest is just speculative and probably needs tuning from time to time.
In any case, I would refrain from making general statements for all modern engines based on the experience of a few.
User avatar
Fabio Gobbato
Posts: 217
Joined: Fri Apr 11, 2014 10:45 am
Full name: Fabio Gobbato

Re: Is razoring useless in modern engines ?

Post by Fabio Gobbato »

In Pedone I have removed razoring because it gives nothing and for this reason the margin is very difficult to tune.
Now I have a simpler code and one margin less to tune.
User avatar
Eelco de Groot
Posts: 4565
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: Is razoring useless in modern engines ?

Post by Eelco de Groot »

In Stockfish, I think it is more a case of some overlap with all the LMR rules. Razoring is done at depth < 2 and LMR for depth >= 3 so maybe either of these could incorporate depth = 2 (or LMR more of the razoring depths) Of course these reductions are still different in very many ways/subrules (of LMR especially), but maybe the difference has become smaller now that if i am not mistaken, move number 1 is no longer left alone in LMR rules. Have not really studied that in any detail, just thought I remembered seeing that. I think that change was quite recently and was for a very long time not a good idea. So if that is now changed maybe it's time to try to simplify the code further by removing razoring altogether
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
D Sceviour
Posts: 570
Joined: Mon Jul 20, 2015 5:06 pm

Re: Is razoring useless in modern engines ?

Post by D Sceviour »

The last time I looked at this, there was a relationship between Razoring and ProbCut. Removing either one made little difference to the score, but removing them both showed a deterioration in play. It might be worth re-looking at the interaction between Razoring and ProbCut. Maybe Razoring is a faster alternative to ProbCut?
User avatar
silentshark
Posts: 327
Joined: Sat Mar 27, 2010 7:15 pm

Re: Is razoring useless in modern engines ?

Post by silentshark »

To balance this, for my engine (Francesca - older, weaker than some mentioned), razoring does have a value. I just ran 10000 games of my dev version vs a version without razoring. Version with razoring was +9 ELO.

I don't use probcut.

This has given me a nudge. I'm going to look at razoring again, and tune the margin.
Alayan
Posts: 550
Joined: Tue Nov 19, 2019 8:48 pm
Full name: Alayan Feh

Re: Is razoring useless in modern engines ?

Post by Alayan »

D Sceviour wrote: Wed Jan 22, 2020 7:26 pm The last time I looked at this, there was a relationship between Razoring and ProbCut. Removing either one made little difference to the score, but removing them both showed a deterioration in play. It might be worth re-looking at the interaction between Razoring and ProbCut. Maybe Razoring is a faster alternative to ProbCut?
It might be worth investigating, certainly, but this relationship isn't apparent in the engines I'm familiar with.

In Ethereal, removing ProbCut while keeping Razoring was a ~9 elo loss.
In Stockfish, removing ProbCut while keeping Razoring was a ~10 elo loss.

Now, what wasn't tested was removing both ProbCut and Razoring at once. It might very well be possible that the loss would be worse than the sum of the losses.

Many pruning routines exhibit this kind of synergistic behavior. For example, in Ethereal, all "quiet move pruning" sub-steps together give ~175 elo. The sum of the components removed individually is only ~92 elo.
silentshark wrote: Thu Jan 23, 2020 9:24 pm To balance this, for my engine (Francesca - older, weaker than some mentioned), razoring does have a value. I just ran 10000 games of my dev version vs a version without razoring. Version with razoring was +9 ELO.
Interesting data.

This seems to support the notion that razoring is useful for engines with less sophisticated search techniques elsewhere.
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: Is razoring useless in modern engines ?

Post by elcabesa »

sorry but i don't undersand why you compare razoring with probcut. the former work at low depth, the latter at high depth.
I suspect that razoring ( do a quiscence search at low depth) is very similar to futility pruning ( at low depth, skip a lot of quiet moves).

this is my point of view, but I can be wrong of course.
Alayan
Posts: 550
Joined: Tue Nov 19, 2019 8:48 pm
Full name: Alayan Feh

Re: Is razoring useless in modern engines ?

Post by Alayan »

Yes, futility pruning and razoring are related.
User avatar
Eelco de Groot
Posts: 4565
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: Is razoring useless in modern engines ?

Post by Eelco de Groot »

There is some interaction probably between the two, but at alternate plies in this case, you do probcut when you have a very good position, but nullmove did not work because you need a tactical solution. (nullmoveing not very good if you have tactics) the search is then shortened a lot and your alpha is made higher. For the other side on the next ply, it is now lower but if eval + razormargin is even below that, you still will razor the position with a very short quiescence search. In Stockfish you already have done the quiescence search as a first test so the probcut can be very efficient if both conditions are met: first a probCut and in the following ply just a razoring quiescence search. I always wondered why in ProbCut that first quiescence search could be so effective, thanks to Dennis we now can hypothesize why :)
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan