Page 1 of 34

Natural TB

Posted: Sun May 29, 2016 4:48 pm
by mcostalba
I have modified current SF+sygyzy in a way that I have called "Natural TB".

The idea is to use TB but avoiding the unnatural TB scores and in particular the DTZ ones (hiding mates, unnatural sacrifices, etc) but retain the 'good play' of syzygy where 'good play' is defined as follow:

If in a given position SF with old syzygy leads to a win, then it should do also now with 'Natural TB'

For people interested in the technical details, let's add that I have implemented two changes to the current behavior:

1) At root, moves that do not preserve the win or the draw are skipped, but the DTZ score of the remaining moves is ignored.

2) At WDL probing time, deep in the tree, instead of returning an adjusted WDL score, only alpha, draw and beta is returned according if the position is loss, draw or win (cursed win and losses at the moment are ignored).

This is still experimental code, so maybe there is some issue moreover for the moment I have not run matches between the 2 versions, I am more interested to see if this version is more "natural" to play than the original but I expect the ELO should be equivalent between the 2 versions.

Sources are here:

https://github.com/mcostalba/Stockfish/ ... natural_tb

Re: Natural TB

Posted: Sun May 29, 2016 5:14 pm
by Dirt
mcostalba wrote:2) At WDL probing time, deep in the tree, instead of returning an adjusted WDL score, only alpha, draw and beta is returned according if the position is loss, draw or win (cursed win and losses at the moment are ignored).
Cursed wins are very rare, so I don't expect any ELO loss over this, but I would be more comfortable with knowing that the engine won't be led down the garden path to a cursed win (draw). Of course, if you are playing someone without DTZ tablebases you might actually improve your results.

Re: Natural TB

Posted: Sun May 29, 2016 6:16 pm
by mcostalba
Dirt wrote: Cursed wins are very rare, so I don't expect any ELO loss over this, but I would be more comfortable with knowing that the engine won't be led down the garden path to a cursed win (draw).
It won't.

Please ignore my previous comment, it was intended for a technical audience, from user point of view nothing changes.

Re: Natural TB

Posted: Sun May 29, 2016 6:41 pm
by jpqy
Thanks Marco.. i will compile it and test it out :!:

JP.

Re: Natural TB

Posted: Sun May 29, 2016 7:29 pm
by hgm
mcostalba wrote:2) At WDL probing time, deep in the tree, instead of returning an adjusted WDL score, only alpha, draw and beta is returned according if the position is loss, draw or win (cursed win and losses at the moment are ignored).
Wouldn't this make the engine always prefer to force a winning conversion over a mate in the current table?

Re: Natural TB

Posted: Sun May 29, 2016 8:27 pm
by mcostalba
hgm wrote: Wouldn't this make the engine always prefer to force a winning conversion over a mate in the current table?
I don't think so, indeed returning alpha or beta drops the concept of order, for the same reason that when 2 moves fail high (or low) you can't really say which is best (or worst) of the 2.

Actually the whole idea is to let TB to say if a move is good or bad but without any other information, in particular without comparing to other moves of the same kind: this is up to the engine to find.

Re: Natural TB

Posted: Sun May 29, 2016 9:30 pm
by syzygy
mcostalba wrote:For people interested in the technical details, let's add that I have implemented two changes to the current behavior:

1) At root, moves that do not preserve the win or the draw are skipped, but the DTZ score of the remaining moves is ignored.
Sheesh, that is exactly what the old code already did EXCEPT that the dtz score was used to check against the 50-move rule. So I suppose you have now removed that. Well, good job once again.

To be clear: if the dtz score is still used to check against the 50-move rule, then this was not a change.
I am more interested to see if this version is more "natural" to play than the original but I expect the ELO should be equivalent between the 2 versions.
Did you EVER look at how the original played? I don't think you did.

The only problem the original had was that it did not switch to using less thinking time once TBs had been entered.

Re: Natural TB

Posted: Sun May 29, 2016 9:36 pm
by syzygy
hgm wrote:
mcostalba wrote:2) At WDL probing time, deep in the tree, instead of returning an adjusted WDL score, only alpha, draw and beta is returned according if the position is loss, draw or win (cursed win and losses at the moment are ignored).
Wouldn't this make the engine always prefer to force a winning conversion over a mate in the current table?
It will make the engine score a TB win as a mate, once beta gets there...

To add to my previous post: there is of course one more problem, namely that hitting a 6-piece TB prevents the engine from continuing to search that 6-piece position and possibly find and report an easy mate. This should not be impossible to fix without hurting engine strength, but seems to require complicated surgery on the search code.

Re: Natural TB

Posted: Sun May 29, 2016 10:03 pm
by hgm
syzygy wrote:It will make the engine score a TB win as a mate, once beta gets there...
That was what I meant. I suppose that by "once beta gets there" you mean in the process of enlarging the root aspiration window. As you keep failing high for any smaller beta.

If you score conversion to a TB win as mate, it would score better than any real mate, as the real mate takes time, and will get a mate-in-N score. So in KQBNK it will shy away from a mate without conversion, and sac a piece to convert to a won successor.

Re: Natural TB

Posted: Sun May 29, 2016 10:06 pm
by jhellis3
I was able to achieve desired results in SF Matefinder with this approach:

https://github.com/jhellis3/Stockfish/c ... 16f7ade6d7


A good test position:

8/2P1P3/3k4/8/8/4K3/P2p1p2/8 b - -