Tuning gone awry (or nailed it?)

Discussion of chess software programming and technical issues.

Moderator: Ras

JoAnnP38
Posts: 253
Joined: Mon Aug 26, 2019 4:34 pm
Location: Clearwater, Florida USA
Full name: JoAnn Peeler

Tuning gone awry (or nailed it?)

Post by JoAnnP38 »

After tuning with a sample of 5 million positions, my optimized piece weights end up being:

Code: Select all

    /* opening piece values */
    85, 330, 355, 430, 1065, 0,
            
    /* end game piece values */
    100, 335, 335, 590, 1075, 0,
I suspect these values are encouraging Pedantic to happily exchange two minor pieces for a rook and a pawn and I've been told that isn't a very good idea in most cases. Also, contrary to learned opinion, the relative values between a knight and bishop seem to be reversed for opening/mid-game vs end-game. I like horses, but bishops can cover a lot more ground in the end-game. What do you guys think?
okidoki
Posts: 17
Joined: Thu Jun 30, 2022 12:46 pm
Full name: Kabir Kumar

Re: Tuning gone awry (or nailed it?)

Post by okidoki »

JoAnnP38 wrote: Tue Mar 28, 2023 3:59 pm After tuning with a sample of 5 million positions, my optimized piece weights end up being:

Code: Select all

    /* opening piece values */
    85, 330, 355, 430, 1065, 0,
            
    /* end game piece values */
    100, 335, 335, 590, 1075, 0,
I suspect these values are encouraging Pedantic to happily exchange two minor pieces for a rook and a pawn and I've been told that isn't a very good idea in most cases. Also, contrary to learned opinion, the relative values between a knight and bishop seem to be reversed for opening/mid-game vs end-game. I like horses, but bishops can cover a lot more ground in the end-game. What do you guys think?
Generally speaking two minors are better than rook and pawn.
I don't understand why it would exchange two minors in opening using these values. In end game, again 2 minors very likely be better than r+p.
In my opinion these weights should change depending upon the structures of the pawns.
For example considering this position
[fen]2r1r1k1/1bp3b1/1pNpNp2/pP1P2p1/1pP1Pp2/1P3P2/4R1PP/4R1K1 w - - 0 1[/fen]
Here white knights are dominant over bishops and black would gladly accept the knight for bishop trade.

This is perhaps the one of the most difficult aspect in chess eval.
JoAnnP38
Posts: 253
Joined: Mon Aug 26, 2019 4:34 pm
Location: Clearwater, Florida USA
Full name: JoAnn Peeler

Re: Tuning gone awry (or nailed it?)

Post by JoAnnP38 »

okidoki wrote: Tue Mar 28, 2023 5:04 pm
Generally speaking two minors are better than rook and pawn.
I don't understand why it would exchange two minors in opening using these values. In end game, again 2 minors very likely be better than r+p.
You are right. It's the other way around. There must be some other positional bonus that is causing the exchange to look favorable.
abulmo2
Posts: 465
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: Tuning gone awry (or nailed it?)

Post by abulmo2 »

okidoki wrote: Tue Mar 28, 2023 5:04 pm I don't understand why it would exchange two minors in opening using these values. In end game, again 2 minors very likely be better than r+p.
Well, you can mate with a single rook, you cannot with two knights. I guess a lot of finals are easier to win with a rook than with two minors.
Richard Delorme
User avatar
lithander
Posts: 915
Joined: Sun Dec 27, 2020 2:40 am
Location: Bremen, Germany
Full name: Thomas Jahn

Re: Tuning gone awry (or nailed it?)

Post by lithander »

How are these values used in you engine? E.g. if you use PSTs there's not just one value per piece but 64 based on the square. Or if you add mobility on top of the base value, then the base value for a typically mobile piece like a slider will settle on a lower value.
Minimal Chess (simple, open source, C#) - Youtube & Github
Leorik (competitive, in active development, C#) - Github & Lichess
JoAnnP38
Posts: 253
Joined: Mon Aug 26, 2019 4:34 pm
Location: Clearwater, Florida USA
Full name: JoAnn Peeler

Re: Tuning gone awry (or nailed it?)

Post by JoAnnP38 »

lithander wrote: Tue Mar 28, 2023 9:23 pm How are these values used in you engine? E.g. if you use PSTs there's not just one value per piece but 64 based on the square. Or if you add mobility on top of the base value, then the base value for a typically mobile piece like a slider will settle on a lower value.
I don't add the piece values to the PST like some programs do. I keep the material separate and it is added together in the eval function. I do this because if one side ever gets up by 2-3 pawns I reduce their piece values by 10-20% to encourage trading (or discourage trading if you are behind). This is easier to do if they remain separate. And yes, I also keep mobility separate, because it's not related to the square, but whether or not the piece can move to a square not protected by an enemy pawn. So yeah, everything is separate in Pedantic.
JacquesRW
Posts: 127
Joined: Sat Jul 30, 2022 12:12 pm
Full name: Jamie Whiting

Re: Tuning gone awry (or nailed it?)

Post by JacquesRW »

JoAnnP38 wrote: Tue Mar 28, 2023 10:10 pm I don't add the piece values to the PST like some programs do.
Unless you’re doing something to account for that, the knight for example could have a piece value of 1000 with the piece square tables simply being adjusted accordingly, so the piece values are not necessarily representative of the true value of a piece.
JoAnnP38
Posts: 253
Joined: Mon Aug 26, 2019 4:34 pm
Location: Clearwater, Florida USA
Full name: JoAnn Peeler

Re: Tuning gone awry (or nailed it?)

Post by JoAnnP38 »

JacquesRW wrote: Tue Mar 28, 2023 10:51 pm
JoAnnP38 wrote: Tue Mar 28, 2023 10:10 pm I don't add the piece values to the PST like some programs do.
Unless you’re doing something to account for that, the knight for example could have a piece value of 1000 with the piece square tables simply being adjusted accordingly, so the piece values are not necessarily representative of the true value of a piece.
Yes, exactly. The same as most other programs. A knight could have a value of 137 - 464 depending on which square it is on. However, in my mind whenever you are accounting for the piece weights separately the PST is simple a positional value which is not the same thing.
JacquesRW
Posts: 127
Joined: Sat Jul 30, 2022 12:12 pm
Full name: Jamie Whiting

Re: Tuning gone awry (or nailed it?)

Post by JacquesRW »

JoAnnP38 wrote: Tue Mar 28, 2023 11:05 pm Yes, exactly. The same as most other programs. A knight could have a value of 137 - 464 depending on which square it is on. However, in my mind whenever you are accounting for the piece weights separately the PST is simple a positional value which is not the same thing.
From the pov of the tuner there is no difference from accounting for the piece weights separately as they will simply be absorbed into the psts if removed.

I don’t think you have to worry about the tuner, just rerun it with only material value terms if you want to check that it’s working properly for the relative values of pieces.