In what file I can find stockfish's evaluation?

Discussion of chess software programming and technical issues.

Moderator: Ras

JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: In what file I can find stockfish's evaluation?

Post by JohnWoe »

It's a valid concern. When you run Make script Stockfish starts downloading something from somewhere. If you don't have internet access your Stockfish build is w/o evaluation.
And if you setup smt like Horde position the NNUE evaluator simply crashes. It shows bad evaluation for example KQkr. HCE should always be in the chess engine as the default evaluator.
User avatar
hgm
Posts: 28499
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: In what file I can find stockfish's evaluation?

Post by hgm »

Well, these engines are not designed to be useful.
jp
Posts: 1490
Joined: Mon Apr 23, 2018 7:54 am

Re: In what file I can find stockfish's evaluation?

Post by jp »

Uri Blass wrote: Mon Mar 25, 2024 5:54 pm...
The questions are serious.
I think that people are allowed to ask questions that they do not know the answer for them and I do not see what is the problem with it.

It is not something that I could find by myself in a few minutes and I do not plan to spend many hours to try to find the answer by myself before asking a question.
Yes, I too prefer an environment where people are comfortable asking "simple" questions. After all, no individual is forced to answer if he thinks the question is beneath him.

And sometimes the question may not be as simple as many assume; e.g. past discussion about turning off the 50-move rule in Stockfish. It appears that one has to edit a particular section of code in SF and recompile, i.e. there is no setting you can just change using a standard, available .exe, and 50-move settings in the GUI are misleading -- they do not affect how SF evaluates.


Now, my simple question: Can one, in any version of SF, find (in the HCE) parameters corresponding to the material value of pieces that one can change manually? If not SF, what are the strongest engines where you can? (e.g. Ethereal?) This would be handy for experimenting with material values in a quick and painless way.
User avatar
Eelco de Groot
Posts: 4710
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: In what file I can find stockfish's evaluation?

Post by Eelco de Groot »

jp wrote: Tue Jul 16, 2024 7:47 am
Uri Blass wrote: Mon Mar 25, 2024 5:54 pm...
The questions are serious.
I think that people are allowed to ask questions that they do not know the answer for them and I do not see what is the problem with it.

It is not something that I could find by myself in a few minutes and I do not plan to spend many hours to try to find the answer by myself before asking a question.
Yes, I too prefer an environment where people are comfortable asking "simple" questions. After all, no individual is forced to answer if he thinks the question is beneath him.

And sometimes the question may not be as simple as many assume; e.g. past discussion about turning off the 50-move rule in Stockfish. It appears that one has to edit a particular section of code in SF and recompile, i.e. there is no setting you can just change using a standard, available .exe, and 50-move settings in the GUI are misleading -- they do not affect how SF evaluates.


Now, my simple question: Can one, in any version of SF, find (in the HCE) parameters corresponding to the material value of pieces that one can change manually? If not SF, what are the strongest engines where you can? (e.g. Ethereal?) This would be handy for experimenting with material values in a quick and painless way.
Hi Jean Paul, I think the programs with human crafted eval are a bit of a dying breed by now. Rodent comes to mind, but it is also NNUE now. Kookaburra from Dorsz or CorrChess from Ivan, no material.cpp that I can find right now in the sources. The last one may have been Crystal 6 PMT. Still strong also with HCE but I don't know if you lose much with HCE or if this is important to you?
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
User avatar
Brunetti
Posts: 424
Joined: Tue Dec 08, 2009 1:37 pm
Location: Milan, Italy
Full name: Alex Brunetti

Re: In what file I can find stockfish's evaluation?

Post by Brunetti »

jp wrote: Tue Jul 16, 2024 7:47 am Now, my simple question: Can one, in any version of SF, find (in the HCE) parameters corresponding to the material value of pieces that one can change manually? If not SF, what are the strongest engines where you can? (e.g. Ethereal?) This would be handy for experimenting with material values in a quick and painless way.
All Stockfish versions but last one have HCE (you can even disable NN via UCI option) and editable material values (in types.h).

Alex
Viz
Posts: 223
Joined: Tue Apr 09, 2024 6:24 am
Full name: Michael Chaly

Re: In what file I can find stockfish's evaluation?

Post by Viz »

Material piece values exist in sf even after they general handcrafted eval was deleted.
They are used in multiple search heuristics, namely SEE and futility pruning.
https://github.com/official-stockfish/S ... pes.h#L158
ehenkes
Posts: 48
Joined: Sun Feb 14, 2021 4:58 pm
Location: Germany
Full name: Erhard Henkes

Re: In what file I can find stockfish's evaluation?

Post by ehenkes »

I now use Stockfish 15.1 dev as the data source for my Chess Cockpit program. This engine is only slightly weaker than Stockfish 18. It works perfectly. This way, I get important metrics such as king safety, mobility, threats, ...
https://www.amazon.de/Chess-Thinking-Ag ... B0GSH54B9F
ehenkes
Posts: 48
Joined: Sun Feb 14, 2021 4:58 pm
Location: Germany
Full name: Erhard Henkes

Re: In what file I can find stockfish's evaluation?

Post by ehenkes »

Stockfish has two separate NNUE-related parts.

First, the NNUE code is in the main Stockfish source tree, mainly under src/nnue. That is where you find the implementation of the network architecture, accumulator logic, feature transformation, and related evaluation code.

Second, the actual network files are stored separately in the official official-stockfish/networks repository.

So, in practice:

src/nnue = the NNUE implementation in the engine source
official-stockfish/networks = the trained network files

Also important: in modern Stockfish versions, the strongest network is often already embedded in the binary. The engine can use the UCI option EvalFile, and in some builds you can also export the embedded net with export_net.

If you want to study how NNUE is connected to evaluation, evaluate.h is also a useful entry point.
chrisw
Posts: 4909
Joined: Tue Apr 03, 2012 4:28 pm
Location: Anywhere but the Western Empire
Full name: Christopher Whittington

Re: In what file I can find stockfish's evaluation?

Post by chrisw »

syzygy wrote: Mon Apr 15, 2024 12:56 pm
Uri Blass wrote: Mon Mar 25, 2024 6:16 pmI wonder if every evaluation that humans can understand is called HCE (hand craft evaluation) even if people did optimizations to have better weights in the evaluation.
HCE just means hand-crafted, it does not mean that humans can "understand" it.

And what is not to understand about a simple neural network? Just 1 type of calculation, whereas a complex HCE has dozens or hundreds of different kinds of calculation. And in all cases all weights are the result not of human "intuition" but of hundreds of thousands of hours of calculation.

But do you understand how Carlsen evaluates? Not even Carlsen does.
You can however interrogate Carlson on various aspects of various positions and he will be able to give you some sort of reasoned explanation in human understandable terms. Not so with NNUE.
ehenkes
Posts: 48
Joined: Sun Feb 14, 2021 4:58 pm
Location: Germany
Full name: Erhard Henkes

Re: In what file I can find stockfish's evaluation?

Post by ehenkes »

Based on my Chess Cockpit and its connection to an AI webchat I try to explain NNUE diff values. These values are delivered by Stockfish calculating the difference in NNUE total by looking at the position with and without a piece. This evaluation is done for all pieces except the King. It is a first step to understand the NNUE a little bit better.

https://www.amazon.de/Chess-Thinking-Ag ... B0GSH54B9F
https://www.amazon.de/Schachcoach-Schac ... B0GM7M5Y21