Stockfish no longer has contempt

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Madeleine Birchfield
Posts: 512
Joined: Tue Sep 29, 2020 4:29 pm
Location: Dublin, Ireland
Full name: Madeleine Birchfield

Stockfish no longer has contempt

Post by Madeleine Birchfield »

https://github.com/official-stockfish/S ... b5cfd35785
This patch removes the UCI option for setting Contempt in classical evaluation.

It is exactly equivalent to using Contempt=0 for the UCI contempt value and keeping
the dynamic part in the algo (renaming this dynamic part `trend` to better describe
what it does). We have tried quite hard to implement a working Contempt feature for
NNUE but nothing really worked, so it is probably time to give up.

Interested chess fans wishing to keep playing with the UCI option for Contempt and
use it with the classical eval are urged to download the version tagged "SF_Classical"
of Stockfish (dated 31 July 2020), as it was the last version where our search
algorithm was tuned for the classical eval and is probably our strongest classical
player ever: https://github.com/official-stockfish/Stockfish/tags

Passed STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 72904 W: 6228 L: 6175 D: 60501
Ptnml(0-2): 221, 5006, 25971, 5007, 247
https://tests.stockfishchess.org/tests/ ... eb8bcab18d

Passed LTC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 45168 W: 1601 L: 1547 D: 42020
Ptnml(0-2): 38, 1331, 19786, 1397, 32
https://tests.stockfishchess.org/tests/ ... eb8bcab1bb
Never understood why they had contempt in the first place, as it interfered with the accuracy of stockfish's evaluation by artificially inflating it by 24 centipawns, especially when it comes in a gui that does not allow the user to change uci options, such as the Lichess Stockfish interface.
Cornfed
Posts: 511
Joined: Sun Apr 26, 2020 11:40 pm
Full name: Brian D. Smith

Re: Stockfish no longer has contempt

Post by Cornfed »

Madeleine Birchfield wrote: Tue Jun 22, 2021 10:16 pm https://github.com/official-stockfish/S ... b5cfd35785
This patch removes the UCI option for setting Contempt in classical evaluation.

It is exactly equivalent to using Contempt=0 for the UCI contempt value and keeping
the dynamic part in the algo (renaming this dynamic part `trend` to better describe
what it does). We have tried quite hard to implement a working Contempt feature for
NNUE but nothing really worked, so it is probably time to give up.

Interested chess fans wishing to keep playing with the UCI option for Contempt and
use it with the classical eval are urged to download the version tagged "SF_Classical"
of Stockfish (dated 31 July 2020), as it was the last version where our search
algorithm was tuned for the classical eval and is probably our strongest classical
player ever: https://github.com/official-stockfish/Stockfish/tags

Passed STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 72904 W: 6228 L: 6175 D: 60501
Ptnml(0-2): 221, 5006, 25971, 5007, 247
https://tests.stockfishchess.org/tests/ ... eb8bcab18d

Passed LTC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 45168 W: 1601 L: 1547 D: 42020
Ptnml(0-2): 38, 1331, 19786, 1397, 32
https://tests.stockfishchess.org/tests/ ... eb8bcab1bb
Never understood why they had contempt in the first place, as it interfered with the accuracy of stockfish's evaluation by artificially inflating it by 24 centipawns, especially when it comes in a gui that does not allow the user to change uci options, such as the Lichess Stockfish interface.
Because...accuracy wasn't really the 'name of the game'...it was to rack up points in competition against weaker opponents - go after more elo.

We humans do it all the time, especially in the weekend swiss. When playing weaker opponents, we do not always play the technically "correct" move...but rather play the 'optimal move'...that is to say, the one that puts our opponents under more pressure and thus more likely 'go wrong' and give us better chances to outplay them. If they respond well...5 moves later we may make it difficult on them again...a bit of game theory really. Carlsen does it all the time against might strong players...but you can have that kind of ego when you are that good :wink:
Madeleine Birchfield
Posts: 512
Joined: Tue Sep 29, 2020 4:29 pm
Location: Dublin, Ireland
Full name: Madeleine Birchfield

Re: Stockfish no longer has contempt

Post by Madeleine Birchfield »

Cornfed wrote: Wed Jun 23, 2021 12:41 am
Madeleine Birchfield wrote: Tue Jun 22, 2021 10:16 pm https://github.com/official-stockfish/S ... b5cfd35785
This patch removes the UCI option for setting Contempt in classical evaluation.

It is exactly equivalent to using Contempt=0 for the UCI contempt value and keeping
the dynamic part in the algo (renaming this dynamic part `trend` to better describe
what it does). We have tried quite hard to implement a working Contempt feature for
NNUE but nothing really worked, so it is probably time to give up.

Interested chess fans wishing to keep playing with the UCI option for Contempt and
use it with the classical eval are urged to download the version tagged "SF_Classical"
of Stockfish (dated 31 July 2020), as it was the last version where our search
algorithm was tuned for the classical eval and is probably our strongest classical
player ever: https://github.com/official-stockfish/Stockfish/tags

Passed STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 72904 W: 6228 L: 6175 D: 60501
Ptnml(0-2): 221, 5006, 25971, 5007, 247
https://tests.stockfishchess.org/tests/ ... eb8bcab18d

Passed LTC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 45168 W: 1601 L: 1547 D: 42020
Ptnml(0-2): 38, 1331, 19786, 1397, 32
https://tests.stockfishchess.org/tests/ ... eb8bcab1bb
Never understood why they had contempt in the first place, as it interfered with the accuracy of stockfish's evaluation by artificially inflating it by 24 centipawns, especially when it comes in a gui that does not allow the user to change uci options, such as the Lichess Stockfish interface.
Because...accuracy wasn't really the 'name of the game'...it was to rack up points in competition against weaker opponents - go after more elo.

We humans do it all the time, especially in the weekend swiss. When playing weaker opponents, we do not always play the technically "correct" move...but rather play the 'optimal move'...that is to say, the one that puts our opponents under more pressure and thus more likely 'go wrong' and give us better chances to outplay them. If they respond well...5 moves later we may make it difficult on them again...a bit of game theory really. Carlsen does it all the time against might strong players...but you can have that kind of ego when you are that good :wink:
That would make sense if the only thing Stockfish does is compete in engine tournaments like TCEC and CCCC. However, the vast majority of people use Stockfish on sites like lichess and chess.com to analyse their own games, rather than in engine vs engine tournaments, so contempt does have an impact on evaluations. And in many cases, there is no uci options to turn contempt off.

The proper analogy would be if a human coach were helping you analyse your game, but the human coach was purposely overevaluating the position in favour of white if it is white's turn, and in favour of black if it is black's turn.
Cornfed
Posts: 511
Joined: Sun Apr 26, 2020 11:40 pm
Full name: Brian D. Smith

Re: Stockfish no longer has contempt

Post by Cornfed »

Madeleine Birchfield wrote: Wed Jun 23, 2021 1:18 am
That would make sense if the only thing Stockfish does is compete in engine tournaments like TCEC and CCCC. However, the vast majority of people use Stockfish on sites like lichess and chess.com to analyse their own games, rather than in engine vs engine tournaments, so contempt does have an impact on evaluations. And in many cases, there is no uci options to turn contempt off.

The proper analogy would be if a human coach were helping you analyse your game, but the human coach was purposely overevaluating the position in favour of white if it is white's turn, and in favour of black if it is black's turn.
Except that...they were really only interested in getting the greatest gains in elo. I think that claim stands. This IS done in testing relative to other engines.

I really don't think your argument holds up. Stockfish on chess.com is neutered anyway...depth of 18 I think; probably so at lichess (haven't been there in a couple of months) and spends a fraction of a second on a move. So, the default contempt has always been perfectly good for picking out tactical misses and there has to be a considerable difference in evaluation to even merit a mention. Surely you can't expect more from an engine under those situations? No one who would benefit from 'serious analysis' uses engines ON those sites for that purpose.

I always set my Stockfish contempt to zero...within Chessbase, for the very reasons you say. But then I use my engines more seriously than most. If I play something I want to keep and analyse, I download it to chessbase and spend some time on it.

Even here, it seems like most people are interested in either: Testing or pushing engines around against people using other engines...probably with an eye on multi-pv.
Cornfed
Posts: 511
Joined: Sun Apr 26, 2020 11:40 pm
Full name: Brian D. Smith

Re: Stockfish no longer has contempt

Post by Cornfed »

See for example, AdminX's post referencing the Chess DoJo video, especially starting about 3 min in.
User avatar
M ANSARI
Posts: 3707
Joined: Thu Mar 16, 2006 7:10 pm

Re: Stockfish no longer has contempt

Post by M ANSARI »

[/quote]
Carlsen does it all the time against might strong players...but you can have that kind of ego when you are that good :wink:
[/quote]

Yes it really is incredible what Carlsen will play and for fun and he doesn't really care who is on the other side. He played an online Lichess bullet tournament where he repeatedly played the Bongcloud opening where he moves out with his king the first few moves and repeatedly beat some incredibly strong GM's. But more impressive is that he also did it against non other than Wesley So in a much slower blitz with increment time control and beat him! When he explained his thinking he said that players tend to want to "punish" you when they see you waste a bunch of tempi with your king and lose castling rights ... which tends to make the player over push and over sacrifice. He almost made the Bongcloud seem like a very good opening :D
User avatar
Nordlandia
Posts: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: Stockfish no longer has contempt

Post by Nordlandia »

Bongcloud is just a online fad or thing that has grown in popularity just because some of the elite players have used it online. Carlsen would never do 2. Ke2 OTB.

People experiment with all kind of openings online but as OTB is more formal and official, it doesn't allow for such silly things.
User avatar
Harvey Williamson
Posts: 2010
Joined: Sun May 25, 2008 11:12 pm
Location: Whitchurch. Shropshire, UK.
Full name: Harvey Williamson

Re: Stockfish no longer has contempt

Post by Harvey Williamson »

Nordlandia wrote: Thu Jun 24, 2021 5:59 pm Carlsen would never do 2. Ke2 OTB.
Are you sure?
User avatar
Nordlandia
Posts: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: Stockfish no longer has contempt

Post by Nordlandia »

Harvey Williamson wrote: Thu Jun 24, 2021 7:40 pm
Nordlandia wrote: Thu Jun 24, 2021 5:59 pm Carlsen would never do 2. Ke2 OTB.
Are you sure?
OTB = Over the board play.
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: Stockfish no longer has contempt

Post by syzygy »

Madeleine Birchfield wrote: Tue Jun 22, 2021 10:16 pmNever understood why they had contempt in the first place, as it interfered with the accuracy of stockfish's evaluation by artificially inflating it by 24 centipawns, especially when it comes in a gui that does not allow the user to change uci options, such as the Lichess Stockfish interface.
Stockfish does not include a GUI, so it is not clear what you are talking about.

If the Lichess developers didn't want contempt, they could have trivially set it to 0 themselves.

The SF contempt implementation worked great with the classical evaluation. You can discuss about the default value (but the default value surprisingly did improve self-play) and even more about how to deal with the contempt value in analysis mode. But in match play against weaker (= all other) engines it cunningly exploited the fact that being Stockfish gave the engine an inherent advantage which was higher the more material was still on the board.

However, SF's approach to contempt is incompatible with NNUE.