Monday, June 25, 2018

Contempt

Earlier this year I wrote about how wrong it would be to shed Stockfish after his defeat against Alpha Zero (see to analyze using a computer part 3). In the last TCEC season 11 it became clear for everybody that this engine will still play a very important role at chess in the nearby future. First Stockfish qualified for the superfinal 7 points ahead of the number 2 Houdini. Then we saw a remarkable for this era of super-advanced engines a very one-sided battle. The convincing victory of Stockfish with 20 victories against 2 losses (for the rest only draws) was something we hadn't met anymore in the last decade.

The supremacy of Stockfish was probably the best shown in the double victory during the super-final when the Mar del Plata variation of the Kings Indian had to be played. First Stockfish won with the white pieces.
Next as for all chosen openings in the super-final, the colors were reversed for the engines (so no engine is privileged by the opening-choice). Again Stockfish won so this time with the black pieces.
After the match there was naturally a lot of talk about how Stockfish could make so much progress in such short notice. Hereby people quickly pointed to a new parameter of Stockfish: the contempt-factor. That needs a bit more explanation. First this parameter isn't new at all. Such contempt-factor exists for a long time but only recently the developers of Stockfish decided to use it intensively. The advantage is neither always obvious. In the previous TCEC season Stockfish made a bit too many draws against weaker engines which caused it to miss the final. As anti-dote the engine was adapted by playing moves leading to less exchanges of pieces so keeping the tension longer in a position which creates more scope for errors. Concretely this means Stockfish doesn't always play the best moves of its algorithms within an acceptable margin (defined by the contempt) to create more winning-chances. Besides this strategy is well-known in practical chess between humans see my article playing the man. However engine-play is very different.

The gain against weaker engines may not generate more losses against the strong engines. Nowadays a lot of experiments are done with a dynamic contempt instead of a pure static contempt see tests of Stockfish. They adapt the size of the contempt to the evaluation of the position. You could allow exchanges more quickly in an inferior position or the opposite.

So engines continue to develop. Also don't expect that Stockfish will rule the world alone in the future. Last month there was big news for its main-rival Komodo. The engine was acquired by chess.com see this announcement which will definitely boost the engine. The prediction already starts to materialize in the currently ongoing TCEC season 12 in which Komodo qualified as first engine and started the super-final with a win against the latest release of Stockfish.

For sure fans of engine-chess have something to look forward. Still this is and remains a niche which we see translated in the number of visitors. Stockfish is many hundreds of points stronger than the reigning world-champion Magnus Calsen. Nevertheless Magnus' games are 1000 more often viewed. For the regular chess-player an engine is only used to get an evaluation of a position or to make some analysis. As a consequence most just take the strongest available engine to do this job. Naturally it is a bonus that today this strongest engine so Stockfish comes without any charges.

However very few know that you need to be careful when using the latest version of the engine for the analysis. The evaluations are less accurate than previous releases of the same engine or of other top-engines if not interpreted correctly. That is because of the contempt-factor which influences the evaluations. When white's move avoids exchanges then a bonus of 0,2 is giving to white. For black such type of move would generate a negative bonus of -0,2. Such manipulations of the evaluation cause some strange yo-yo-effect especially at the beginning of the game. Even when no mistakes are made then we notice fluctuations of almost a half pawn. By applying the evaluation-profile of the Fritz-interface on a game with no serious errors, this becomes very visible.
Stockfish 9 with contempt (10 seconds per move)









These swings disappear in the first 20 moves when we make an evaluation-profile with the Fritz interface after resettting the contempt of Stockfish to 0. Below screenshot makes this again very clear.
Stockfish 9 without contempt (10 seconds per move)







This is our normal evaluation-pattern we need as base to comment games see annotations or to make some deep opening-analysis see to study openings part 2. For the analysis we want mainly an objective evaluation of how strong the moves are and not which moves create the best winning chances for Stockfish against other engines.

To eliminate the contempt can be done in the Fritz interface by looking up the settings of Stockfish. You only need to change the contempt-value from 20 to 0 see screenshot below.
Stockfish parameters
The only issue of this solution is that the Fritz-interface doesn't allow you to save this setting as default. So each time you start up Stockfish, you have to redo this. That is fine if you only use the engine sporadically but for intensive usage this is very annoying. On the internet I searched for a better alternative which I eventually found see stockfish 9 for analysis. There you can download a special compiled version of Stockfish more appropriate for analysis. In that version you don't need to reset each time anymore the contempt-parameter to 0.

It is not the only limitation of the default-settings in the Fritz-interface. I also don't manage to get the interface remember that it should not add my name as annotator. Each time I save any analysis, I have to remove manually my name. It is only 2 seconds work but in a couple of months this happens sometimes 1000 times so I am still wasting quite some time.
Another flaw in the default-setting is in the new application automatic analysis of the games played online at playchess. Recently I am playing again more blitz online (due to a lack of serious competitions). However when I want to check the openings of the blitz-games with an engine using the Fritz-interface see my article the (non-)sense of blitz then I am always disturbed by pop-up windows about tactical blunders spotted by the engine-trainer. It is today impossible to switch off this trainer forever.





There exist today other interfaces than Chessbase for engines but none can compete as they all have much less functionality. So Chessbase has an absolute monopoly which isn't good for the end-user. Today we see that the developments mainly happen around more functionality for the large community so they are persuaded of buying newer releases of their products. It is not financially interesting to optimize existing functionality for the few intensive users (they only make a couple percentages of the total customer-base). Besides few or no Chessbase-programmers are today active strong tournament-players see e.g. the interview with Matthias Wuellenweber in 2018. Playing professional chess and programming is a very difficult combination.

Brabo