Tablebase suggestion

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
Ajedrecista
Posts: 2188
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: Tablebase suggestion.

Post by Ajedrecista »

Hello:

Here is other example with an invented position in a B+P vs. 4P endgame, where these 8-man online EGTB also work, as it should be:

[d]8/1B5p/6p1/5p1k/4p2P/6K1/8/8 b - - 0 1

All moves draw except h6? I give a possible continuation and the variation with the losing blunder, where white can force a checkmate in few moves beginning with Bc6 or Bd5:

[pgn][Event ""]
[Site ""]
[Round ""]
[Date "2026.01.27"]
[SetUp "1"]
[FEN "8/1B5p/6p1/5p1k/4p2P/6K1/8/8 b - - 0 1"]
[Result "1/2-1/2"]

1...e3 (1...h6? 2.Bc6 {(Also 2.Bd5 with the same idea)} 2...f4+ 3.Kh3! f3 4.Bd7 g5 (4...f2 (4...e3 5.Bg4# 1-0) 5.Bg4# 1-0) 5.Be8# 1-0) 2.Kf3 Kxh4 3.Kxe3 g5 4.Kf3 g4+ 5.Kf4 Kh3 6.Kxf5 h5 7.Kg5 h4 8.Kf4 g3 9.Kg5! (9.Ke3? Kh2! 0-1) 1/2-1/2[/pgn]

9.- Kg5 in the main line is the only move to draw. One must be aware anytime! The checkmate after 1.- ..., h6? is also curious, with the bishop being able to deliver the checkmate here and there depending on which pawn black moves. What a discovery these EGTB! :-)

Regards from Spain.

Ajedrecista.
Ender8pieces
Posts: 9
Joined: Wed Jan 21, 2026 9:16 am
Full name: JS

Re: Tablebase suggestion.

Post by Ender8pieces »

Ajedrecista wrote: Tue Jan 27, 2026 7:09 pm Hello:

Here is other example with an invented position in a B+P vs. 4P endgame, where these 8-man online EGTB also work, as it should be:

[d]8/1B5p/6p1/5p1k/4p2P/6K1/8/8 b - - 0 1

All moves draw except h6? I give a possible continuation and the variation with the losing blunder, where white can force a checkmate in few moves beginning with Bc6 or Bd5:

[pgn][Event ""]
[Site ""]
[Round ""]
[Date "2026.01.27"]
[SetUp "1"]
[FEN "8/1B5p/6p1/5p1k/4p2P/6K1/8/8 b - - 0 1"]
[Result "1/2-1/2"]

1...e3 (1...h6? 2.Bc6 {(Also 2.Bd5 with the same idea)} 2...f4+ 3.Kh3! f3 4.Bd7 g5 (4...f2 (4...e3 5.Bg4# 1-0) 5.Bg4# 1-0) 5.Be8# 1-0) 2.Kf3 Kxh4 3.Kxe3 g5 4.Kf3 g4+ 5.Kf4 Kh3 6.Kxf5 h5 7.Kg5 h4 8.Kf4 g3 9.Kg5! (9.Ke3? Kh2! 0-1) 1/2-1/2[/pgn]

9.- Kg5 in the main line is the only move to draw. One must be aware anytime! The checkmate after 1.- ..., h6? is also curious, with the bishop being able to deliver the checkmate here and there depending on which pawn black moves. What a discovery these EGTB! :-)

Regards from Spain.

Ajedrecista.
Thank you, That's very interesting.
Do you familiar with positions stockfish has troubles to handle? Maybe the 7 pieces can give him enough power
User avatar
Ajedrecista
Posts: 2188
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: Tablebase suggestion.

Post by Ajedrecista »

Hello:
Ender8pieces wrote: Wed Jan 28, 2026 8:54 pmThank you, That's very interesting.
Do you familiar with positions stockfish has troubles to handle? Maybe the 7 pieces can give him enough power
No, I do not know. I guess that positions with few pieces OTB are generally well evaluated by SF excellent search+eval... there are crazy, extreme DTM>100 positions that will not handle well and EGTB help, of course. I also do not know about positions with more wood OTB.

Regards from Spain.

Ajedrecista.
User avatar
Kirill Kryukov
Posts: 519
Joined: Sun Mar 19, 2006 4:12 am
Full name: Kirill Kryukov

Re: Tablebase suggestion

Post by Kirill Kryukov »

syzygy wrote: Fri Jan 23, 2026 10:42 amMaybe you could also try to calculate the number of positions in a single 8-piece tablebase (say KRBPvKRNP) and calculate the time you need to evaluate each position for say 10ms. Let's have 1000 CPUs working on them in parallel. How long does it take?
Hi. This caught my attention. The KRBPvKRNP endgame has precisely 64,513,180,757,427 unique legal positions, which makes it only 59-th largest 8-piece endgame. The largest one is KRBNPvKBN with 87,076,702,767,652 unique legal positions. Of course this is the lower bound, the number of positions that will be indexed with a particular indexing method will be still larger. Hope it helps a little. :-)
syzygy
Posts: 5872
Joined: Tue Feb 28, 2012 11:56 pm

Re: Tablebase suggestion

Post by syzygy »

Kirill Kryukov wrote: Fri Jan 30, 2026 1:43 am
syzygy wrote: Fri Jan 23, 2026 10:42 amMaybe you could also try to calculate the number of positions in a single 8-piece tablebase (say KRBPvKRNP) and calculate the time you need to evaluate each position for say 10ms. Let's have 1000 CPUs working on them in parallel. How long does it take?
Hi. This caught my attention. The KRBPvKRNP endgame has precisely 64,513,180,757,427 unique legal positions, which makes it only 59-th largest 8-piece endgame. The largest one is KRBNPvKBN with 87,076,702,767,652 unique legal positions. Of course this is the lower bound, the number of positions that will be indexed with a particular indexing method will be still larger. Hope it helps a little. :-)
Thanks!
So searching each position single-core for 10ms and running 1000 cpu cores in parallel will take 20.44 years just for this table. Not very practical :-)
syzygy
Posts: 5872
Joined: Tue Feb 28, 2012 11:56 pm

Re: Tablebase suggestion

Post by syzygy »

syzygy wrote: Fri Jan 30, 2026 2:59 am
Kirill Kryukov wrote: Fri Jan 30, 2026 1:43 am
syzygy wrote: Fri Jan 23, 2026 10:42 amMaybe you could also try to calculate the number of positions in a single 8-piece tablebase (say KRBPvKRNP) and calculate the time you need to evaluate each position for say 10ms. Let's have 1000 CPUs working on them in parallel. How long does it take?
Hi. This caught my attention. The KRBPvKRNP endgame has precisely 64,513,180,757,427 unique legal positions, which makes it only 59-th largest 8-piece endgame. The largest one is KRBNPvKBN with 87,076,702,767,652 unique legal positions. Of course this is the lower bound, the number of positions that will be indexed with a particular indexing method will be still larger. Hope it helps a little. :-)
Thanks!
So searching each position single-core for 10ms and running 1000 cpu cores in parallel will take 20.44 years just for this table. Not very practical :-)
Turns out Urban Koistinen already suggested how, at least in theory, this could be done somewhat efficiently (I'm linking to my explanation of his suggestion):
viewtopic.php?p=952933#p952933

So it's not totally infeasible. But for probing you still need to do the same expensive search on the position being probed. The point of doing a tablebase probe, at least of WDL tables, is to avoid searching the position.
Also, an evaluation score returned by a 10-ply search or so isn't the most ideal type of information for improving compression.
petero2
Posts: 734
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: Tablebase suggestion

Post by petero2 »

syzygy wrote: Fri Jan 30, 2026 4:13 am
syzygy wrote: Fri Jan 30, 2026 2:59 am So searching each position single-core for 10ms and running 1000 cpu cores in parallel will take 20.44 years just for this table. Not very practical :-)
Turns out Urban Koistinen already suggested how, at least in theory, this could be done somewhat efficiently (I'm linking to my explanation of his suggestion):
viewtopic.php?p=952933#p952933

So it's not totally infeasible. But for probing you still need to do the same expensive search on the position being probed. The point of doing a tablebase probe, at least of WDL tables, is to avoid searching the position.
Also, an evaluation score returned by a 10-ply search or so isn't the most ideal type of information for improving compression.
Another problem is that the 10-ply search must be full-width alpha-beta in order to match the search scores computed during generation. You could speed it up using a hash table, but it would have to be a "correct" hash table as typically used in non-engine programming. An approximate hash table typically used in chess engines that allows grafting and incorrect results for hash collisions would not be good enough if the goal is for the probing code to always return correct results.
syzygy
Posts: 5872
Joined: Tue Feb 28, 2012 11:56 pm

Re: Tablebase suggestion

Post by syzygy »

petero2 wrote: Fri Jan 30, 2026 7:52 pm
syzygy wrote: Fri Jan 30, 2026 4:13 am
syzygy wrote: Fri Jan 30, 2026 2:59 am So searching each position single-core for 10ms and running 1000 cpu cores in parallel will take 20.44 years just for this table. Not very practical :-)
Turns out Urban Koistinen already suggested how, at least in theory, this could be done somewhat efficiently (I'm linking to my explanation of his suggestion):
viewtopic.php?p=952933#p952933

So it's not totally infeasible. But for probing you still need to do the same expensive search on the position being probed. The point of doing a tablebase probe, at least of WDL tables, is to avoid searching the position.
Also, an evaluation score returned by a 10-ply search or so isn't the most ideal type of information for improving compression.
Another problem is that the 10-ply search must be full-width alpha-beta in order to match the search scores computed during generation. You could speed it up using a hash table, but it would have to be a "correct" hash table as typically used in non-engine programming. An approximate hash table typically used in chess engines that allows grafting and incorrect results for hash collisions would not be good enough if the goal is for the probing code to always return correct results.
Indeed. 10 ply will be too slow to be useful. And there's also the problem of what to do with the result. You don't want to have to do a search for each position 0...N-1 in a compressed block of data to extract the value of position N.

So you would use it to reorder W/D/L of a position in order of likelihood before you map the W/D/L value of the position to the 0/1/2 value stored in the compressed tablebase file. It will help a bit but I don't think it will do wonders.

But if someone wants to try for say 5-piece tables... it would be interesting to know what can be gained.
Instead of an N-ply search, I would probably try to come up with a (cheap) custom static predictor that is trained for each table on a sample of positions.
User avatar
hgm
Posts: 28457
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Tablebase suggestion

Post by hgm »

What good would searching do in an EGT you already have? The EGT can already be considered to represent the result of an infinitely deep search all the way to checkmate (or for DTZ, winning conversion). The 'search' process proposed by Koistinen is exactly what retrograde analysis already does.
syzygy
Posts: 5872
Joined: Tue Feb 28, 2012 11:56 pm

Re: Tablebase suggestion

Post by syzygy »

hgm wrote: Sat Jan 31, 2026 4:30 pm What good would searching do in an EGT you already have? The EGT can already be considered to represent the result of an infinitely deep search all the way to checkmate (or for DTZ, winning conversion). The 'search' process proposed by Koistinen is exactly what retrograde analysis already does.
Koistinen's idea was to evaluate the positions (with a regular evaluation function) to estimate whether they are won, drawn or lost, and then somehow use this information to compress the tables better. (I do not think this is a great idea, but it always comes up.)
Koistinen wrote:One idea is to build an evaluator by defining lots of properties of a position and then correlate them with the actual values.
Find some way to combine it all and then find out if searching a few ply helps any.
I guess having one evaluator per endgame class might help.
I don't know which way is best, I just find the question interesting.
It is also possible to have uncertainty part of the evaluation and then decide whether to look up the value based on uncertainty.
To store exceptions I think a multilayered approach is best, but testing is needed.
Same idea might work for dtz50, say having an evaluator which gives a range of dtz50 values.
The possible ways to do it are many, maybe you need some luck to find a good way.
So the proposal there was a custom evaluation function per table plus an N-ply search and then somehow encode in the tablebase file the delta with what this predictor produces.

Alternatively, if you generate DTZ tables, you could choose to set all positions with dtz <= N for some N to "don't care" for compression (for the DTZ table or even for the WDL table) [my generator actually has an option for this for DTZ tables; I don't think it saved that much space though]. Then you need to do a full-width N-ply search with a trivial evaluation function (returning +/-n if dtz = n <= N and 0 otherwise) before probing to check if dtz <= N. If so, you don't need to access the table. If not, the table will store the correct dtz value.

Syzygy tables more or less do this with N=1. If there is a winning capture, then you don't need to access the table. (And if there is a drawing capture, it also uses this information to improve compression). It does not do this for direct mate-in-1s, though.
DTZ pawnful tables also require the probing code to check whether there is a winning pawn move, which again means dtz=1 (and this can be done by probing WDL, obviously). WDL tables do not (because access speed is more important for WDL than for DTZ).