domenica, agosto 12, 2018

A word about the AI hype in chess

Some months ago, many of you have probably heard how a neural network trained from scratch in an afternoon by Deep Mind defeated the strong chess engine in the world, Stockfish.

Deep Mind get the hype started

This legit hype was started by Deep Mind, a subsidiary of google strong in artificial intelligence, published the paper "Mastering Chess and Shogy by Self-Play with a General Reinforcement Learning Algorithm".
In this paper, they demonstrate a general learning algorithm which was able to train a a neural network which would power a Monte Carlo Treee Search based chess engine to such a level to be competitive in chess with top notch engines. They measured competitiveness in chess by letting their engine playing a 100 games match against the back then latest release of Stockfish, Stockfish 8, the world-leading chess engine, maintained by a team of volunteers (disclaimer: I am part of this team) . It won by a convincing margin of 28 wins, 72 draws and 0 losses, in their own words, 
calling into question the widely held belief that alpha-beta search is inherently superior in these domains

I do now want to dispute this call by the Deep Mind team, but it could be done based on the match condition. It can be observed that, if one of the goals of this claim was to generate a hype, then it succeeded.

Open source takes over

Following this paper, a team of developer decided to start an open-source project to replicate the results. The ultimate goal was (and is) to show that this calling into question is a well-founded claim. They had of course some work to do: the paper by Deep Mind contained many details, but not all of them. Also, one of the criticisms was the Deep Mind engine was not a real UCI-compliant chess engine, and wouldn't have been able to participate in chess computer tournaments. So they had to replicate the scientific part of the paper, and also make a real chess engine out of it, being able to compete in chess tournaments. In that, they were supported by nonetheless than Gary Linscott, the gifted programmer who built Stockfish testing framework, see a previous post.
One very important remark: this neural network based engines need GPUs to work well, as the generic type of neural network used there are specifically designed to make use of the massive matrix multiply capabilities of GPUs.

LC0 go to TCEC

After some weeks in the project, the LC0 team (this is the name of the open-source project) was invited to send their program to TCEC. TCEC stands for top chess engine competition: it is a league where all chess engines can compete on standardized hardware. When invited, they start in division 4 and they can work themselves up to division 3,2,1,premier. The first two engines in division premier fight a titanic superfinal over 100 games. Last season (number 12) was won by Stockfish 9. Since the divisions are played out serially, for an engine it is possible, in principle, to start in division 4 and, in the same season, climb up all the divisions and win the Superfinal. TCEC management, however, decided not to invest in a GPU, yet as they were not sure of whether LC0 would keep existing and also for the speed in which they had to organize it. To make the story short, LC0 finished last.

LC0 hype grows

This did not discourage the team. They knew that the lack of a GPU would seriously cripple the engine and so they continued working, recruiting tester around the world for playing millions of games. In the meanwhile, private people would test the engine and publish the results online. In particular, kingcrusher, a well known and respected chess expert with 100k youtube follower, decided to back the project posting videos and analyses of this awesome new engine. The were invited back to TCEC, which was able to organize access to a server with 2 high-end GPUs. It was predicted that LC0 would rush through the divisions and challenge Stockfish itself. To add more drama, some days before the start of Season 13, it was announced that a second neural network engine would enter division 4. After some speculations it turned out that it was a more or less a derivative of LC0 and arguments followed. Nevertheless, this second engine, DeusX, was allowed to enter TCEC too. Expectations were running high for the new era of computer chess. The hype was at its maximum.

Full power neural network at TCEC

As I write now, division 4 ended some days ago. With a sort of an anticlimax, after some games, it was clear that, although LC0 and DeusX were very strong engines, they would not rush through divisions. LC0 finished first, and DeusX second, qualifying by 0.5 point margin for division 3. Division 3 is in course now: between the divisions, the admin of the site was started, and the new one had some experience with LC0 itself and was able to improve the settings of the dedicated server to give the two neural networks some more power. They also submitted updated engines. In spite of the efforts, after 20% of division 3 played out, they float in the mid-range of the league. It is somewhat expected that the division will be won by Ethereal, another very young, though classical engine, developed by a 2 persons team. The second slot for qualification is still open. Currently it seems plausible though not sure that one of both neural engines will win a ticket.

What do we learn from the hype

Maybe neural networks are the future of computer chess. Maybe not. Time will say. As usual, there is no free lunch and you shouldn't run where they say you get one. And by the way, don't do momentum trading. Avoid diets. And most important, if you start from scratch, don't expect to succeed soon.

lunedì, agosto 06, 2018

The dose makes the democracy

So you want democracy. This is a good thing; remember, though, that the dose makes the poison, as Paracelsus put it.

Democracy as a form of government

What is democracy, for a starter? In classical Athens, it denoted the fact that important decisions were taken by normal citizens, possibly picked by a lottery. Yes, by a lottery. The main parliament in early Athenian direct democracy was not composed of citizens chosen by vote, but by chance. This was thought to be important as it was known (back in 6th century BC, mind you) that elections tend to be dominated by wealthy individuals. Today's typical representative democracy refers to the fact that countries are run by bodies of individuals which are elected among the population. Again, it is well known that, although to candidate for a political role should be open for everybody, in fact a reasonable amount of resources should be invested in it in order to have a realistic chance to be elected. The specific regulations change from country to country, but they do not change the overall view.

Democratic principles all over the place

Given that, it must also be said that often we talk of groups, institutions, communities as to be run by democratic principles. Or not, of course, this latter being considered harmful. A larger participation in decisions is often advocated even in private companies. Many techniques and social hacks from the agility culture aim to improve direct participation in decisional processes, think of planning poker and the like. In general, when we talk about communities, we refer to democratic principles as a cultural meme describing the aim of extending participation to decisional processes to the broader masses. It is thought that this should improve identification with the community, productivity if talking about companies and in general to be a good thing. 
But is it so? 
Although of leftist tendencies myself, I always suspect of things which are always good, even if this is democracy and sharing of power. Nothing can be always good; a standard tactics to prove this claim in different contexts is indirect proof (or reductio ad absurdum). If democracy is always good, then it must also be good to held general votes about what kind of size must be allowed for the southernian kiwi-kale. The latter is obviously false, so the premise must be false, too. I know, this is dirty, more on this in a latter post. For now, let us accept this and consider the fact: what are the criteria which make democratic principles necessary?

Democracy is the more important the less you can walk away 

For the sake of the discussion, let us assume that we are looking at a community whose honest goal is to make possible to its members to be happy. Since its members are nevertheless humans, it makes sense to have somebody running the show to avoid things going to the dogs. Or does it? In fact, if in your community everybody can walk away without any negative effects on her, then you wouldn't need any democracy. This must be intended strictly: if your walking aways damage the remaining members of the community, then it will have a negative influence on you (since they could sue you and so on). I think the most clear example is that of an amateur sport team with a large basis, say football: there is a trainer, and he decides. Since they are amateurs, there is nothing at stake, so if a player walks away and join another team, nothing will actually happen. Such a team can have a concentration of power in the trainer or instructor. In fact, if he messes up, all players will leave and the community will be disbanded. I am in a yoga class in which we experienced this kind of scenario on a significant level some times ago. It was stressful for the teachers, for us it went very smooth. Much different is the case in which members of the community cannot realistically walk away. This is thy typical case of a country: if you are born in a country, you could in principle move to another one, but this comes with much discomfort. Not to have a democracy here is risky: if you have a dictator, and he is bad, people will be forced to stay. Nobody will be happy here, and we missed our goal. What about an average case? Say a team manager in a company making some important decisions. If the decisions impact everybody, you better involve them. If you mess up, they will be unhappy; they could even be unhappy if you don't mess it up, because they were not involved. The amount of autocracy you can allow depends directly on how easily people can actually walk away; interestingly, if you are in a hot market, people will be able to change employer fast, if with a bit discomfort. You can allow some autocracy here; in a stagnant markert autocracy will automatically generate unsatisfactory feelings in everybody. In general, in a company, you will allow less autocracy than in the football team example, but more than in the country example. This of course only takes into account satisfaction of the members, and not quality of the decisions. But this is another story.