To contempt or not to contempt

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

Moderators: hgm, Rebel, chrisw

MOBMAT
Posts: 385
Joined: Sat Feb 04, 2017 11:57 pm
Location: USA

To contempt or not to contempt

Post by MOBMAT »

In general, when solving for mates, what differences/effects would one expect when adjusting an engines contempt value, or disabling contempt?

My anecdotal testing isn't conclusive, nor consistent.
i7-6700K @ 4.00Ghz 32Gb, Win 10 Home, EGTBs on PCI SSD
Benchmark: Stockfish15.1 NNUE x64 bmi2 (nps): 1277K
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: To contempt or not to contempt

Post by Dann Corbit »

MOBMAT wrote: Fri Jul 03, 2020 6:22 am In general, when solving for mates, what differences/effects would one expect when adjusting an engines contempt value, or disabling contempt?

My anecdotal testing isn't conclusive, nor consistent.
I think that almost all the time, contempt is bad for analysis. But there is an exception, mate positions that I call "magnet draws".
Sometimes, there is a position where the side to move is far behind. But there is a drawing move (maybe even something simple like three fold repetition by forced checks). The engine seems immensely happy about this, and ponders on the #1 pv move for ages and then spins through all the other moves in a fraction of a second, only to ponder on the draw again. But because it is likely some composed position, there will be an absurd looking move that gives up a big slab of material and does not produce any fruit for 15 full moves after that. Stockfish is especially prone to this (or was, it seems to have suddenly got better at mate solving so I am not sure it is still true). Anyway, for these magnet draws where a mate is possible it makes sense to me that not only would contempt be good, but enormous contempt (like a queen's worth). Of course, you would not want to play a game with that setting, but if you *know* the positions you are analyzing are checkmates and especially if the engine has been coughing up draws, I think that would be a good place to try it.

So my opinion is that contempt is really good for playing games against weaker players and for solving magnet mates. For engine equal in strength or stronger than the engine contempt is applied to or for general purpose analysis, contempt is bad.
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: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: To contempt or not to contempt

Post by Ovyron »

Dann Corbit wrote: Fri Jul 03, 2020 7:05 am I think that almost all the time, contempt is bad for analysis.
This is true, but it is recent. Before contempt led the engine to the dynamic positions that were very useful, and they worked like a shortcut to interesting lines that turned to be better or equal but with the added component that they were harder to play for the opponent (like moves transposing with best play, but for one of those finding the transposition is harder, and contempt would pick it.)

At some version around Stockfish 11 release the engine by itself was finding those lines anyway, and contempt just added turbulence to the analysis that could make it miss the best move that a lower contempt would have found. This was gradual, from 24 being best to 18, to 12... eventually 0 Contempt became best for analysis and the new paradigm of using different scores for each side disappeared.

0 Contempt became best for analysis since then, I wish there was a way to measure at what version this happened, and why (probably the version before still was better than default with some modest contempt), because the reason for all these observations remain a mystery.
MOBMAT
Posts: 385
Joined: Sat Feb 04, 2017 11:57 pm
Location: USA

Re: To contempt or not to contempt

Post by MOBMAT »

There seems to be a difference between 0 contempt and NO contempt.
i7-6700K @ 4.00Ghz 32Gb, Win 10 Home, EGTBs on PCI SSD
Benchmark: Stockfish15.1 NNUE x64 bmi2 (nps): 1277K
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: To contempt or not to contempt

Post by Dann Corbit »

I made my own special UCI setting to turn off every kind of contempt. They have a dynamic contempt and some other kind (I forget what they call it) and the thing that bothers me most is it skews the score for analysis. So when you analyze a position and you analyze the pv node, they both think they are better (rarely, but it sometimes happens). That goes away mostly when you turn contempt off. Of course, there are situations where one node forward really does see something better.

But (and this is an intentional pun) I personally DESPISE contempt.
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.
corres
Posts: 3657
Joined: Wed Nov 18, 2015 11:41 am
Location: hungary

Re: To contempt or not to contempt

Post by corres »

Obviously not to contempt.
Engines need contempt only in an engine-engine match.
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: To contempt or not to contempt

Post by Dann Corbit »

corres wrote: Fri Jul 03, 2020 11:27 am Obviously not to contempt.
Engines need contempt only in an engine-engine match.
Contempt can help an engine to be adventurous. We do not always want our engine to be adventurous. Tal was adventurous and he won a lot, but he also flamed out eventually
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: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: To contempt or not to contempt

Post by Ovyron »

corres wrote: Fri Jul 03, 2020 11:27 am Engines need contempt only in an engine-engine match.
If a variation is good in engine-engine match it's good for analysis. If many lines are 0.00 with NO contempt but one is 0.01 with 0 Contempt then it's a great tie breaker to check what to investigate.

I've found key variations much faster with negative contempt. Specially in the French, where with NO Contempt all Stockfish sees is 0.00, even with very high depth. With negative contempt from the black side it asks "what if white was adventurous?" and BAM! It finds the line that make the score go to the 0.40s or even 0.60s.

As long as you have NO contempt to compare, contempt has only been a blessing. Its existence has only saved time when having it finds better lines. And, well, lost me games, but that's only because I was taking its scores as truth (user error.)
Frank Quisinsky
Posts: 6808
Joined: Wed Nov 18, 2009 7:16 pm
Location: Gutweiler, Germany
Full name: Frank Quisinsky

Re: To contempt or not to contempt

Post by Frank Quisinsky »

Hi,

Contempt is an interesting topic.
We can make weaker engines in a rating list stronger if we give a negative contempt.
We can make stronger engines in a rating list stronger if we give a positive contempt.

So what is to do?
Contempt = 0 for all.
But we create a new problem with it!!

Engine programmers set such contempt parameters in sources without to give a parameter for it.
Can be see in statistics with move average.

If an engine have no parameters for contempt but a clealy lesser or clearly higher move average at all the others ... in most of cases the reason that the programmer set contempt things directly in sources. And Bingo a problem for a rating list if you set for all the others Contempt = 0.

This is one problem if we are looking on results from a rating list.
So I am looking not on Elo only because I can see nothing about an engine.
I need a lot of different statistics before an engine goes in my personal TOP-10.

Best
Frank
Cornfed
Posts: 511
Joined: Sun Apr 26, 2020 11:40 pm
Full name: Brian D. Smith

Re: To contempt or not to contempt

Post by Cornfed »

Ovyron wrote: Sat Jul 04, 2020 12:49 am Its existence has only saved time when having it finds better lines. And, well, lost me games, but that's only because I was taking its scores as truth (user error.)
You mean...you do not use your brain and your brain only in competition? Shame... :wink: