Site views: 1907995



08-07-2019 - The Contempt-Coherence factor on Stockfish.



It’s been a while since I’m hearing this term “Contempt” but I was unaware of what precisely meant…
Lately I came across an interesting discussion on a forum between two users, one of them claimed that the “drunk acting” of Stockfish and similar engines when analysing was due to the Contempt factor.
This night my mind was all focused on verifying what he said and I have discovered interesting parts of writings around the Internet:


“The Contempt Factor reflects the estimated superiority/inferiority of the program over its opponent. The Contempt factor is assigned as draw score to avoid (early) draws against apparently weaker opponents, or to prefer draws versus stronger opponents otherwise.” – Chessprogramming Wiki


“I am not exactly sure how the contempt setting works. On one site I read that when the engine starts analyzing from a position it gives a “bonus” in the form of the contempt setting to whichever side is on the move. The result that the evaluation keeps bouncing back and forth and, according to the poster, the transposition table is filled with conflicting evaluation scores.
atever is going on, when analyzing with Stockfish 10 I have noticed what one person called “a strange yo-yo-effect especially at the beginning of the game” (also referred to as the “roller coaster effect”) that results in wild fluctuations in the evaluation every time a move is actually made on the board. His explanation was, like previously mentioned, it is because the contempt factor is switched back and forth to whichever side has the move.” – Tartajubow on Chess II blog


So, in the meanwhile of the new Stockfish Polyglot compilation I’ve thought to setup a little match against the latest Raubfisch… The result was surprising.
The MZChess user was right, when the Contempt was disabled the match was in big favour of Stockfish, oppositely enabling the Contempt and setting it to 24 (Stockfish actual standard) made Raubfish win by an even bigger edge!

I have tried also to use Stockfish with Contempt 0 in deep analysis since the move #8 of a game of mine against another player: it was coherent and it showed a very reliable score, bringing the variant to 0 by virtually continuing the game against the Goi 6.1 book (I weared my opponent’s socks and tried to see where he made the mistake just to test the engine with these new settings).

I was right to not completely botch the MZChess forum in times of our war because I saw there were users with a big potential and a big knowledge about chessprogramming, other than alot of interesting material I could use. In my opinion that’s the forum with people with the more experience about this stuff.

I wonder why the Stockfish team releases executables with this flaw (Contempt on, set to 24) although having a very large and powerful testing staff…

Speaking of here, Stockfish Polyglot will be released with Contempt disabled by default for better performances from now on.


Massimiliano Goi.



Stockfish test Contempt 0 and 24.

Download the games


Rate this article: