Using Freeware AI and Dynamically Generated Endgame Tablebases

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Alayan
Posts: 306
Joined: Tue Nov 19, 2019 7:48 pm
Full name: Alayan Feh

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Alayan » Sun Mar 29, 2020 6:12 pm

zug234zwang wrote:
Sun Mar 29, 2020 5:32 pm
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.
While this can in theory produce new insights, as stated by others, the amount of computing required to make it work is much higher than you expected at first. To overperform regular leela nets in the positions you are interested in, you'd want at the very least hundreds of thousands, more likely millions, of training games.

noobpwnftw
Posts: 430
Joined: Sun Nov 08, 2015 10:10 pm

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by noobpwnftw » Sun Mar 29, 2020 7:39 pm

Well there is the problem: people so far have no meaningful way to describe how those networks work. Currently networks contain huge number of parameters and they correlate in mysterious ways to produce the outputs, that is also why large numbers of games are needed to train those networks so that the networks are recognizing some general patterns instead of recognizing the inputs. If the networks are not recognizing some general patterns, then their knowledge do not transfer to other sets of inputs, therefore they would not be useful in practice. Reason why they are not useful is because if they only work on particular inputs, why bother using the networks to describe what that trained them?
Networks are in essence what people use when they want to reduce the amount of information needed to describe something too complex, at the cost of some accuracy, sometimes this accuracy loss can be ignored because we do not know the truth anyways. So that the only important thing is to make it recognize some general patterns, and by that it means large numbers of training games.

User avatar
Ovyron
Posts: 4230
Joined: Tue Jul 03, 2007 2:30 am

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Ovyron » Mon Mar 30, 2020 6:52 am

zug234zwang wrote:
Sun Mar 29, 2020 5:32 pm
I presumed that each iteration would involve somewhere between 1000-5000 games.
1000-5000 games would bring nothing of value. Specifically, 1000-5000 games would not bring something that played better chess in that specific position than the AI that generalized over any chess position that we already have.

If you want to know more about how Neural Networks work, I recommend you start watching videos that explain the process, here's a good one:

https://www.youtube.com/watch?v=aircAruvnKk

But the ultimate answer is that they're a "black box". After Leela is trained for millions of games it produces a file, and nobody really can tell you the contents of the file, or manually adjust its contents to fix issues. In a normal open source chess engine you can see a behavior, and change it by tweaking readable human code. In the case of NNs, we don't know the contents of the box.

This is how a typical Network file looks like on the inside:

Image

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

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by zug234zwang » Mon Mar 30, 2020 6:44 pm

To noobpwnftw : More interesting insights; thanks.
To Ovyron : Thanks for the tip on NN youtube videos.

To Ovyron and noobpwnftw : The plot thickens; I'm going to have to object here.

noobpwnftw indicates that
"people so far have no meaningful way to describe how those networks work",
while Ovryon describes the contents of the NN as a "black box."

I watched the specific youtube video suggested by Ovyron; this video focuses on the complexity of associating data (e.g. the image of a number, or a specific chess position) with a certain pattern (e.g. an actual digit, or a specific chess pattern).

I am comfortable regarding the Chess-AI methods/content as a black box with respect to how the Chess-AI determines when a chess position is associated with a specific chess pattern, and with respect to what the actual contents of a NN is.

However, I want to focus on how the NN's are strategically used by the Chess-AI.

In the last paragraph of my previous post, I speculated that the (top professional) Chess-AI recognizes the characteristics of a position and uses it to adjust (on-the-fly) the parameters it uses in computing the "best move". Example parameters would be relative piece value, piece mobility, middle game king-safety, and endgame king-mobility.

Either my speculation is accurate or it is not. Assume that I am wrong.

When the Chess-AI is computing its "best move" what algorithm is it using???

If I am interpreting noobpwnftw's last response correctly, the Chess-AI's [learned history] is used to associate the current position with one (or perhaps more than one) chess pattern(s) and (somehow) uses this association to compute the "best move". However, this computation must be nothing more than the application of a mathematical formula.

If the formula is not a parameterized mathematical formula, with the parameters adjusted based on the pattern(s) that the Chess-AI associates with the current position, then what else could possibly be going on? How else could the Chess-AI be attempting to capitalize on its categorization of the current position by the pattern(s) that it fits?

Dann Corbit
Posts: 11143
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Dann Corbit » Mon Mar 30, 2020 7:30 pm

RE: "When the Chess-AI is computing its "best move" what algorithm is it using???"

The algorithm is a neural network. There is a file of floating point numbers. The learning phase decided what features from the rules of chess and the configuration of the board are important. It writes these floating point values to a file.

It is not something as simple as a dot product where features vector is multiplied by scores vector.
Nobody knows what the nodes written to disk mean except LC0.

If you read Matthew Lai's thesis you will get an explanation of what is going on. He originally wrote it for a CPU, but it was translated to TPUs for google, then the effort was mirrored for GPUs by the LC0 project.

https://arxiv.org/abs/1509.01549
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.

User avatar
Ovyron
Posts: 4230
Joined: Tue Jul 03, 2007 2:30 am

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Ovyron » Mon Mar 30, 2020 8:38 pm

zug234zwang wrote:
Mon Mar 30, 2020 6:44 pm
How else could the Chess-AI be attempting to capitalize on its categorization of the current position by the pattern(s) that it fits?
If someone could figure that out, they'd be able to create an engine with "normal programming" (the way chess engines were made before NNs) that played like Leela, without needing a network file and skipping the training. But in some position, even though Leela can give us all the information about what she gathered from the Network, and a list of all the playable chess moves, how much she likes them, and the performance she'd expect to have by playing them, nobody knows how to replicate that data any other way.

And if a new position appears, nobody has an algorithm, mathematical formula, or possible method to predict what the AI will come up with. The only way is to run the AI, as the AI is the only one that can know.

User avatar
hgm
Posts: 24565
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by hgm » Mon Mar 30, 2020 9:28 pm

Well, a neural network is nothing but a mathematical formula. Problem is that it is a rather complex formula, having millions of terms, each controlled by a parameter (the 'weight'). It is a non-linear function of a non-linear function of a non-linear function.... (and so on, 40 times), each of some 10,000 variables (and delivering as many).

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

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by zug234zwang » Mon Mar 30, 2020 10:40 pm

Thanks to Dann Corbit, Ovyron, and H.G.Muller for these "eye-openers".

This is bizarre. From your responses, I'm forced to question my intuition. I've just started reading the pdf that Dann referenced, so I'll see where this leads.

Normally, I wouldn't push this, but the more bizarre this appears, the more intriguing.

Consider the following scenario. Chess-AI programmer apparently makes no error in setting up the software to initiate Chess-AI. Further, the corresponding hardware works okay both when setting up the Chess-AI and when the Chess-AI is playing games. The Chess-AI plays 100 games against an inferior engine, winning 99 and
losing 1.

The programmer, in consultation with a chess grandmaster, examines the game that the Chess-AI lost and spots the losing move. Then, the programmer and grandmaster examine the position and conclude that there was no rational way that the Chess-AI should have made that move (i.e. probability of winning the game was clearly less after that move).

The programmer and chess grandmaster conclude that something has gone wrong and that there is a subtle bug in the Chess-AI's original programming that has made its way into the Chess-AI's neural network. Together, the programmer and chess grandmaster review the original code, line by line, but can not find the error.

As a retired professional programmer, I would now start experimenting, making alterations to see which alteration eliminated the error. But, if I understand correctly, the Chess-AI programmer can't really do that, since the original
programming is a package, and the Chess-AI needs the whole package to start its training (original learning).

What does the Chess-AI programmer do?

......................................

Separate scenario that I can't really resist exploring.

It seems as if 5 years from now, all conventional chess engines will be deemed inferior to a neural network based Chess-AI, even if the conventional chess engines are designed (somehow) to run on hardware that is approximately equivalent in computing power to the hardware + neural net that the Chess-AI runs on. Do you agree?

Continuing this scenario, the programmers involved with a conventional chess engine decide to strike back! They examine every game that the Chess-AI won, looking for moves that their engine disagreed with. During this exploration, they start to reverse engineer what the Chess-AI's evaluation parameters must have been in each of the critical positions in each game. Then they go head to head with Chess-AI. Would you expect the engine to now do approximately as well as the Chess-AI?

Continuing this scenario, the programmers involved with a conventional engine decide to strike back further! They identify situations where the Chess-AI would make a move that their engine would not. They then reverse engineer what the evaluation parameters must have been in that situation. Then they look for chess positions where the Chess-AI will make such a move (e.g. perhaps being overly aggressive with a theoretically unsound sacrifice, a la Tal), and try to program their engine to steer for such a position.

Is this a feasible anti Chess-AI strategy? Assuming not, is there a feasible anti Chess-AI strategy that the programmers of a conventional engine can adopt?

User avatar
Ovyron
Posts: 4230
Joined: Tue Jul 03, 2007 2:30 am

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Ovyron » Mon Mar 30, 2020 11:55 pm

zug234zwang wrote:
Mon Mar 30, 2020 10:40 pm
What does the Chess-AI programmer do?
Train the AI with more games, and hope that eventually, after enough millions of playouts, the necessary changes to the network happens, and the AI does no longer make a losing move in that situation. But there's no guarantees, and the AI may just improve generally, but not specifically, for this problem.

Other methods include starting from scratch with different starting parameters (or network sizes), but there's no way to pick ones guaranteed to work beforehand. The AI itself is in charge to examine its own results and make changes to the network to increase her performance, not the programmers. The latest significant improvements have come from modifying the AI's settings so it uses the network's contents better, but never to make it play or avoid playing certain moves in certain positions.
zug234zwang wrote:
Mon Mar 30, 2020 10:40 pm
It seems as if 5 years from now, all conventional chess engines will be deemed inferior to a neural network based Chess-AI, even if the conventional chess engines are designed (somehow) to run on hardware that is approximately equivalent in computing power to the hardware + neural net that the Chess-AI runs on. Do you agree?
Not necessarily. The future has proven very hard to predict, nobody was expecting Alpha-Zero, some people had predicted that an engine of 3400 ELO in the CCRL scale would not lose any games, others that the exponential nature of chess would eventually lead to diminishing returns, making the 50 elo jump from Stockfish 10 to 11 seem incredible.

It's possible a new approach appears that makes chess engines without networks like Stockfish reach new heights that keep their strength over NNs, or that a mixed neural alphabeta approach like the Komodo team is developing becomes the answer, or maybe some learning algorithm that allows several users to distribute chess analysis is put in place and with that you can query a position and get a chess move that can't be improved by other methods (putting an end to the problem.)

At some point neural networks seemed like the clear future, but traditional methods have managed to keep up the pace.

Angrim
Posts: 82
Joined: Mon Jun 25, 2012 8:16 pm
Location: Forks, WA
Full name: Ben Nye

Re: Using Freeware AI and Dynamically Generated Endgame Tablebases

Post by Angrim » Sun Apr 05, 2020 1:14 am

zug234zwang wrote:
Mon Mar 30, 2020 10:40 pm

The programmer, in consultation with a chess grandmaster, examines the game that the Chess-AI lost and spots the losing move. Then, the programmer and grandmaster examine the position and conclude that there was no rational way that the Chess-AI should have made that move (i.e. probability of winning the game was clearly less after that move).

The programmer and chess grandmaster conclude that something has gone wrong and that there is a subtle bug in the Chess-AI's original programming that has made its way into the Chess-AI's neural network.
Then they don't know what they are talking about. A neural net can make mistakes with code that is entirely bug-free because
a neural net isn't code, it is data. When it learns, there is no change to the code, only to the data.

To deal with that, you add the lost game to the training set of games. Which will change the data, and might result in the ai not repeating that mistake.
But who knows, it might repeat it, neural nets are as hard to predict as humans sometimes.

Post Reply