An annoying problem I've noticed with Blunder, even in recent development versions, is that the king safety is often much too weak in situations where it should have much more influence. For example, in this position:
[fen]r1bqr1k1/1ppnpp1p/p2p1npQ/6N1/3PP3/2N5/PPP2PPP/R3KB1R w KQ - 3 10[/fen]
Blunder struggles to find the right way forward, and when letting Blunder play from the position at long time controls, it struggles to find the right ideas, like using its flank pawn to crack the black defenses. Now this isn't always the case for every opponent or time control, but in many cases I think Blunder should be able to find the way forward.
Now I realize it's not advisable to tune an engine towards one position, but as I said, this is a general problem I've noticed. Whether defending an attack or applying pressure itself, in many cases, it either blunders and allows its opponent's attack to break through, or its attack fizzles out when it has a good position.
Of course, the first idea I tried was simply not to tune down the king safety score as much in the evaluation. And this helps in many different positions where the theme is king safety. But it always proves to be worse in general testing.
So I then decided to trying involving the tuner and seeing if any progress could be made. Currently, my king safety model is a quadratic polynomial scaled down by a factor of 4, which takes as input the "attack points" I collect a la Stockfish or Rebel. As is the common approach, these attack points are collected by considering how many squares a certain piece attacks around a king zone and multiplying this times a bonus. Semi-open files in front of the enemy king are also considered, and the number of them is also multiplied by a bonus and added to the total attack points.
These bonuses are what the tuner controls. What's difficult is that adjusting the scaling factor itself, as I mentioned, was a loss overall as the king safety was generally too influential. Adjusting the scaling factor and re-tuning was also futile as the tuner just compensated by running the bonus values into the ground. And using different tuning sets also hasn't proven to be very effective either.
I then figured I might just need more king safety evaluation terms to cover more bases, but again the tuner stopped my fun by running most of the values into the ground. And manually adjusting these king safety values isn't very feasible either, particularly for a player of my level.
I'm curious whether other engine authors have found Texel Tuning to be successful in finding good values for an effective king safety model.
King Safety and Texel Tuning
Moderator: Ras
-
- Posts: 4398
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
Re: King Safety and Texel Tuning
Arasan has a fairly complex model but the main term is an "attack weight" term that considers the total values of pieces attacking the King region. Attacks are calculated considering own Bishops and Rooks as transparent, so stacked Rooks for example count as two Rooks attacking. There is also a "King cover" term that considers the pawn shield in front of the King, and there are terms for number of pieces attacking (not just weights). Then the whole function is run through a sigmoid transformation whose parameters are also tuned.
Arasan actually doesn't use this anymore, now that it's gone to a NNUE eval, but it did not perform badly. Arasan was quick to attack opponents with poor King safety, but it did not make stupid sacrifices for an attack. The sigmoid takes into account that something like a couple minors in the attack are not that significant, but as more pieces participate, the attack score starts to go up rapidly. But then after a while it tapers off, because the King is probably getting mated anyway.
It is important that the tuning set includes imbalanced positions.
Arasan actually doesn't use this anymore, now that it's gone to a NNUE eval, but it did not perform badly. Arasan was quick to attack opponents with poor King safety, but it did not make stupid sacrifices for an attack. The sigmoid takes into account that something like a couple minors in the attack are not that significant, but as more pieces participate, the attack score starts to go up rapidly. But then after a while it tapers off, because the King is probably getting mated anyway.
It is important that the tuning set includes imbalanced positions.
-
- Posts: 608
- Joined: Sun May 30, 2021 5:03 am
- Location: United States
- Full name: Christian Dean
Re: King Safety and Texel Tuning
Thanks.jdart wrote: ↑Sun Aug 14, 2022 4:12 am Arasan has a fairly complex model but the main term is an "attack weight" term that considers the total values of pieces attacking the King region. Attacks are calculated considering own Bishops and Rooks as transparent, so stacked Rooks for example count as two Rooks attacking. There is also a "King cover" term that considers the pawn shield in front of the King, and there are terms for number of pieces attacking (not just weights). Then the whole function is run through a sigmoid transformation whose parameters are also tuned.
Arasan actually doesn't use this anymore, now that it's gone to a NNUE eval, but it did not perform badly. Arasan was quick to attack opponents with poor King safety, but it did not make stupid sacrifices for an attack. The sigmoid takes into account that something like a couple minors in the attack are not that significant, but as more pieces participate, the attack score starts to go up rapidly. But then after a while it tapers off, because the King is probably getting mated anyway.
It is important that the tuning set includes imbalanced positions.
For the attack weight term, do you mean the values of the pieces themselves? And then you divide this term by some constant, like 100, and fold this value into the final value passed to the sigmoid? That makes sense, I'll think I'll experiment with that and some of the other points you mentioned.
And for the sigmoid, did you all tune the parameters via texel tuning or by hand? And just double-checking, by imbalanced, you mean materially correct? Or also other imbalances? Either way, I'm going to try going through the different datasets I have and selecting some more imbalanced positions to add to the main dataset.
-
- Posts: 4398
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
Re: King Safety and Texel Tuning
Yes. I actually keep a crude material weight measure, which has the point values you teach beginners, Pawn=1, Knight=3, Bishop=3, Rook=5, Queen=9.For the attack weight term, do you mean the values of the pieces themselves?
Tuned by Texel method.And for the sigmoid, did you all tune the parameters via texel tuning or by hand?
Meaning materially imbalanced and with king attacks - this implies you don't reject such positions.And just double-checking, by imbalanced, you mean materially correct?