3

Per title. As I understand contempt, it's a setting in the eval function that adds a bonus for material remaining on the board. This makes the engine favor positions with more material (i.e. more complex, i.e. more scope to outplay the opponent). It is meant to make the engine avoid quick draws against inferior opposition.

Stockfish recently implemented NNUE eval, and I am unsure if NNUE eval can include contempt. If yes, how does it work? The description above doesn't seem to work anymore.

4

I'm not sure if you understanding of contempt is right, but in any case; I just compiled SF12 and it seems you don't have two versions of SF (the standard and the NNUE) but you can set your SF12 to behave standard or NNUE. In the configuration screen for SF12 you can enable NNUE, and also the contempt value.

So the short answer to your question is yes, SF12-NNUE has contempt implemented.

1

Contempt is implemented. But your understanding is not correct. Evaluation is already counting all possible factors which engine considers. But it does not understand the idea of risk. So "Contempt" switch is like "should I insist on evading of 3-rep/50-move rules when my eval says to repeat the move?" and it is typically on/off. With contempt=on, engine will not repeat position 3 times, effectively dropping the line of repeating right away. Most of engines already have contempt=on. This switch comes with little "margin" function which basically says "Am I losing that much to call for a draw?". If it does not see any losing, effectively it will not draw by itself. That function is very rarely used actually. Typically engines will always try to beat the opponent even if it will make them lose more. Most of the time engines don't have "draw offering" implemented.

4
  • This answer looks incorrect. I'm not familiar with Stockfish code, but from emdio's answer, contempt is a number. It ranges from -100 to +100, i.e. it is not "on" or "off". – Allure Sep 4 '20 at 21:58
  • When engine is at disadvantage, opponent engine won't let it to draw by 3-rep. So number is practically not used. It is just theoretical value to tweak the feature itself. – sanaris Sep 4 '20 at 23:34
  • I know Stockfish plays very differently when c = 100 as opposed to the default c = 24, so I can't believe that's the case. – Allure Sep 4 '20 at 23:40
  • I think contempt is simply always added to the evaluation score. If contempt is 100 (or one pawn), then a position of -0.5 "looks like" 0.5, and therefore threefold repetition is avoided because it is worse than 0.5. If the choice is between repeating or a -1.5 position, then it still repeats. – RemcoGerlich Oct 2 '20 at 14:06
1

No source, but I eventually found out (from other computer chess viewers) that Stockfish NNUE does not have contempt per se - it's not clear how to implement contempt in NNs. However, Stockfish NNUE does use the handcrafted eval in certain positions, so there is still a contempt setting. Apparently, however, the effect is minuscule. Before NNUE, contempt=100 Stockfish plays a vastly different game from c=0 Stockfish; now they're similar (which shouldn't be surprising since handcrafted eval is not used often).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.