Using Freeware AI and Dynamically Generated Endgame Tablebases

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

zug234zwang
Posts: 20
Joined: Wed Mar 25, 2020 9:41 pm
Full name: Steve Schooler

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by zug234zwang »

Thanks to Dann Corbit, H.G.Muller, and noobpwnftw for your responses.

Part of the challenge for me is restricting the software to freeware. Therefore, Freezer Chess, which costs $80, is not an option. I will definitely examine FinalGen.

The remainder of this response is intended to provoke.

Based on the tablebase-oriented responses that this query has received, it doesn't seem that there is general interest in using Leela Chess Zero (rather than a different engine) to discover the truth about a position. This surprises me. However, it might be explained by noting that this query was posted to the "Programming and Technical Discussions" sub-forum rather than the "General Topics" sub-forum.

Anyway, suppose that dynamic (i.e. on-the-fly) tablebases are excluded, and Leela is restricted to standard 6 man tablebases.

This supposedly means, in effect, that the strategy is restricted to one iteration only. As someone totally ignorant of the power of AI in this scenario, I would have thought that having Leela play 1000 games against itself on a specific position, learning as it goes, would uncover insights generally unavailable to both other engines and (at first sight anyway) humans. Naturally, it would take experience to determine a reasonable compromise between the number of games to be played and the time controls for each game. One option is to double the time controls only for every 10th game.

I said supposedly because suppose that the AI-learning log of [result + moves for each game] is used to programmatically build a database tree. Then you might be able to identify (at a glance) when Leela "learned something about the position" and (for example) the white side started to consistently win rather than draw.

You could then start a second iteration that begins at the critical position rather than the original position. Hopefully, during the second iteration, Leela would have access to all that it had learned in the first iteration. Suppose that during this second iteration a point was reached where (for example) the white side started winning over 98% of the games, and where each white [draw or loss] was followed by many consecutive wins for white.

Hopefully, you could then instruct Leela (both the white and black sides) to consider the critical position as an automatic win, thus "somewhat" replacing the functionality of the dynamic tablebases. You could then start a third iteration where Leela starts from the original position, with no learning, (i.e. starts from scratch) except for the knowledge that (for example) the critical position is a win.

If this is viable, then it seems as if the power of AI-learning without the use of dynamic tablebases has been significantly unlocked. I am naively wondering whether chess grandmasters are underestimating the power of AI-learning over standard chess engines, especially with respect to searching for opening theory novelties. Alternatively, perhaps all chess-AI-learning worshippers are keeping quiet.

I don't see any reason why you couldn't select a position that results after (for example) 10 moves have been played by each side and use that position as the initial starting position. Then you could have Leela play itself from this position for 1000 games (? or more ?).

As described above, you might find a critical subsequent position by manually using the AI-learning log of [result + moves for each game] to programmatically build the database tree. This might allow you to be prepared for any of your opponent's plausible responses.

I am also wondering if AI-learning represents the future of chess grandmasters' search for theoretical novelties.
noobpwnftw
Posts: 560
Joined: Sun Nov 08, 2015 11:10 pm

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by noobpwnftw »

Well, this usually ends up with some very over-fitted networks because you are intentionally limiting its training sample diversity.
Such raw database exists, with billions of positions and most of their moves analyzed at reasonable depth, although I fear it is never going to be enough to train a network that can generalize things good enough. As for endgames, such attempts were made such as Ender networks.
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Dann Corbit »

zug234zwang wrote: Sat Mar 28, 2020 5:15 pm Thanks to Dann Corbit, H.G.Muller, and noobpwnftw for your responses.

Part of the challenge for me is restricting the software to freeware. Therefore, Freezer Chess, which costs $80, is not an option. I will definitely examine FinalGen.
$80 is a deal breaker?
I just spend more than $2000 on disk storage.
;-)

Did you look at this open source project:
https://www.freesoft.org/software/hoffman/
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
zug234zwang
Posts: 20
Joined: Wed Mar 25, 2020 9:41 pm
Full name: Steve Schooler

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by zug234zwang »

To Dann Corbit:

Reasonable point, re cost. Computerized chess analysis is just a hobby for me (e.g. I haven't ever written a chess engine) and it is unclear what will come from this. I'm reluctant to spend money without a strong indication from the computer-programming-chess community that my ideas are viable.

To noobpwnftw

Very interesting response; unfortunately, I am so ignorant of the topic that I didn't understand it.

1. What is an "over-fitted network"?

2. What does "training sample diversity" refer to?

3. Am I limiting the training sample diversity because I have excluded dynamic (i.e. on-the-fly) tablebases, or because 1000 games isn't enough, or because at any meaningful time control, you can't play enough games? How many games is enough?

4. "...it is never going to be enough to train a network that can generalize things good enough." This surprised me. I thought that the professional version of Leela "learned" chess in just a few hours and that subsequently it was at least competetive with a modern engine. Again, I am a total newbie. Can you please amplify your point here?

5. "...Ender networks." I googled "chess ender network" and I couldn't find a basic explanation of what such a
network is supposed to represent. Is the idea that any substantial dynamic endgame tablebase will either take too long to generate or be too large (e.g. > 8tb) to access on a home pc with a simple docking station?

In summary, is your overall point that :
a. You can't get meaningful AI-Learning results without dynamic endgame tablebases.
AND
b. Trying to manage dynamic endgame tablebases will not be practical on a home pc.
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Dann Corbit »

You do not need to have EGTB for meaningful neural network training.
In fact, I think that the google alpha project did not use them, and made a program that was able to drop-kick the best alpha-beta program, which had manually tuned constants requiring thousands of hours of computation.

I just bought 120 TB of disk for $1000 ( a used jbod disk array, fully populated with 3 TB drives).
On this device, I can store the 7 man Syzygy tablebase files.
Now, the interesting thing about that is that even with 6 man files, a search from the root position will start to get EGTB hits after a few minutes on high end hardware.

So I guess what I am saying is if you are going to dedicate a lot of time to it, some money will give you access to information that is very hard to obtain otherwise. Bojun Guo (aka noobftw) did something incredible for us. He generated a perfect 7 man tablebase file set with the programs written by Ronald de Man (and modified jointly to work on 7 man files). If you consider the compute power required (one terabyte of ram is not enough) and the hours of effort expended, I think you may realize that this is very much like the data that you are looking for except that it is complete and not incomplete. Furthermore, he donated the data to mankind rather than charging money for access like the Lomonosov files.

So, I want to encourage you to pursue your analysis goals. But study what has already been done first. You are going to spend some money if you are to be successful. A $500 computer won't work. And the compute hours needed will be large. But the end product might be very intereting,

Maybe you can even become a hero like Bojun Guo and Ronald de Man.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
zug234zwang
Posts: 20
Joined: Wed Mar 25, 2020 9:41 pm
Full name: Steve Schooler

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by zug234zwang »

Thanks Dann, this is just the kind of insight that I was looking for. If it took so much time, ram, computing power and storage to initiate the modern AI-Chess, then (as you indicate) it seems doubtful that a $500 pc containing (for example) a $200 cpu, 32gb ram, 8TB of available storage, and a time expenditure (for example) of 48 hours will get anywhere.

Is the information publicly available re the actual time (including time spent with preliminary tuning), ram, computing power and storage actually involved in initiating the modern AI-Chess?
noobpwnftw
Posts: 560
Joined: Sun Nov 08, 2015 11:10 pm

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by noobpwnftw »

To simplify what I said, or I understand you correctly about the approach:

Take a position with a few pieces, a bit more than(or within) existing EGTB coverage, and start generating games, train on the resulting games and try to improve the next iteration until it can predict the correct move with high accuracy.

This will work, but you will very likely end up with a network specialized on certain given initial positions and it usually does not generalize. Reason being that given the complexity of the game, any meaningful network training requires training games in millions of not billions, a few thousand games will not train a network that makes sense and they will hardly influence anything on a network that has been properly trained, while the likelihood of different positions you may encounter containing certain material to begin with are usually random, if you derive your training from the selected few seeding positions, the resulting networks would in turn specialize in those cases and may not perform well on other conditions. This makes those networks over-fitted comparing to those that are neutral to input positions. One can then go into two directions: either train on more positions with the same network so that covers more cases, this was done here, or one can train more of these individual networks each targeting certain predefined criteria, this has not been tried, probably the best way to check if it works is to try doing so on existing EGTB files, where you have a finite number of possible positions and exact outcome for each of them, essentially that would be a compression method of the data with probably a bit of accuracy loss. The amount of information(entropy) is one way or the other constant if you want to accurately describe something.
zug234zwang
Posts: 20
Joined: Wed Mar 25, 2020 9:41 pm
Full name: Steve Schooler

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by zug234zwang »

To noobpwnftw:

Thank you for a very educational (eye-opening) response. "...millions if not billions...". Really, WHOA.

I examined https://github.com/dkappe/leela-chess-w ... ndgame-Net and was fascinated by what steps were needed to have AI master QvR without egtb.

Trying merely to master/replicate Endgame Net looks daunting.
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Ovyron »

zug234zwang wrote: Sat Mar 28, 2020 11:40 pm What is an "over-fitted network"?
NNs are trained so that they play better chess generally, over-fitting means that they'd be only good in the specific positions you feed it. As probably you'd want to produce something useful for everyone and not something only good for those specific positions, the approach wouldn't work.
zug234zwang
Posts: 20
Joined: Wed Mar 25, 2020 9:41 pm
Full name: Steve Schooler

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by zug234zwang »

To Ovyron:

Illuminating and ironic:
You're responding from the experienced/informed perspective while I am querying from the inexperienced/uninformed perspective. My intent was that meaningful insights re a complex many-piece middle game could be obtained on a budget pc (i.e. =~ $500) over a weekend by performing several AI-Learning iterations that relied very heavily on learning rather than standard engine analysis or egtb results. I presumed that each iteration would involve somewhere between 1000-5000 games.

My intent was that results so obtained would only be relevant to the original middle game position. This means that I intended that the generated neural networks would be overfitted. If this were plausible, then everyone could start doing it with respect to any complex middle game. Thus, standard (on-the-fly) investigative tools would no longer be limited to engines + egtb's, but would also include AI-Learning.

Other responses to my query have seriously disabused me of this approach. Perhaps my idea is several decades premature. Anyway, you touch upon an interesting issue: assuming that the top professional version of the chess-AI-Learning has a reasonable comprehensive (i.e. not overfitted) neural network as its history (i.e. what it has "learned"), what exactly is its algorithm for evaluating a move in a specific position? That is, how does its selection algorithm integrate its learned history with standard chess engine analysis?

I'm going to indulge in uninformed speculation and I welcome corrections. I speculate that the AI's learning (i.e. history) is merely used to fine tune the parameters of relative piece value + piece mobility + (for example) middle game king-safety + endgame king-mobility, based on the characteristics of a given position. This means that the algorithm is extremely fluid and is constantly changing its evaluation parameters as the characteristics of the game position changes. This suggests (for example) that the algorithm is sophisticated enough to know that in the late middlegame, it should devalue ending up with a rook pawn + wrong colored bishop.