Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different eval parameters for smallnet and psqtOnly #5122

Conversation

gahtan-syarif
Copy link
Contributor

@gahtan-syarif gahtan-syarif commented Mar 18, 2024

Gives different eval scaling parameters for the three different nets (bignet, smallnet, psqtOnly smallnet).

Edit: Special thanks to maintainer @Disservin for making the code more easily readable by refactoring the code to use lambda functions.

Passed STC:
https://tests.stockfishchess.org/tests/view/65f4b0020ec64f0526c4a3bd
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 168064 W: 43507 L: 42987 D: 81570
Ptnml(0-2): 662, 19871, 42445, 20393, 661

Passed LTC:
https://tests.stockfishchess.org/tests/view/65f6be1a0ec64f0526c4c361
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 162564 W: 41188 L: 40604 D: 80772
Ptnml(0-2): 120, 18112, 44216, 18732, 102

Bench: 2113576

Passed STC:
https://tests.stockfishchess.org/tests/view/65f4b0020ec64f0526c4a3bd
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 168064 W: 43507 L: 42987 D: 81570
Ptnml(0-2): 662, 19871, 42445, 20393, 661

Passed LTC:
https://tests.stockfishchess.org/tests/view/65f6be1a0ec64f0526c4c361
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 162564 W: 41188 L: 40604 D: 80772
Ptnml(0-2): 120, 18112, 44216, 18732, 102

Bench: 2113576
@gahtan-syarif gahtan-syarif changed the title Smallnetdiffscaling3 Different eval parameters for smallnet and psqtOnly Mar 18, 2024
Copy link

github-actions bot commented Mar 18, 2024

clang-format 17 needs to be run on this PR.
If you do not have clang-format installed, the maintainer will run it when merging.
For the exact version please see https://packages.ubuntu.com/mantic/clang-format-17.

(execution 8339489068 / attempt 1)

@vondele
Copy link
Member

vondele commented Mar 18, 2024

I suggest you make a function for

        // Blend optimism and eval with nnue complexity and material imbalance
        optimism += optimism * (nnueComplexity + std::abs(simpleEval - nnue)) / 513;
        nnue -= nnue * (nnueComplexity + std::abs(simpleEval - nnue)) / 32395;

        npm = pos.non_pawn_material() / 64;
        v   = (nnue * (919 + npm + 11 * pos.count<PAWN>()) + optimism * (145 + npm)) / 1036;

        // Damp down the evaluation linearly when shuffling
        shuffling = pos.rule50_count();
        v             = v * (178 - shuffling) / 204;

and call it with different parameters, instead of copying it 3 times.

@Disservin
Copy link
Member

Yeah, probably make small lambda function instead of a free function to avoid passing the nnue and other variables in the function call.

@gahtan-syarif
Copy link
Contributor Author

gahtan-syarif commented Mar 19, 2024

refactored using arrays, special thanks to @cj5716 for the suggestion.

Edit: seems to fail the test for riscv64

reformat the code to use arrays. prevents code redundancy

Bench: 2113576
XInTheDark added a commit to XInTheDark/Stockfish that referenced this pull request Mar 20, 2024
@Disservin Disservin added the to be merged Will be merged shortly label Mar 20, 2024
@Disservin Disservin closed this in 1a6c22c Mar 20, 2024
linrock pushed a commit to linrock/Stockfish that referenced this pull request Mar 27, 2024
Gives different eval scaling parameters for the three different types
of evaluation (bignet, smallnet, psqtOnly).

Passed STC:
https://tests.stockfishchess.org/tests/view/65f4b0020ec64f0526c4a3bd
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 168064 W: 43507 L: 42987 D: 81570
Ptnml(0-2): 662, 19871, 42445, 20393, 661

Passed LTC:
https://tests.stockfishchess.org/tests/view/65f6be1a0ec64f0526c4c361
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 162564 W: 41188 L: 40604 D: 80772
Ptnml(0-2): 120, 18112, 44216, 18732, 102

closes official-stockfish#5122

Bench: 2113576
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functional-change 🚀 gainer Gains elo to be merged Will be merged shortly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants