# Why does Stockfish undervalue pawns when compared to the classical "a piece is worth three pawns" approach?

I was taking a look at values engines give to pawns and piece and was quite shocked by Stockfish values for middlegame (Mg):

• `PawnValueMg` = 128

• `KnightValueMg` = 721 ~ 5.6 pawns

• `BishopValueMg` = 825 ~ 6.4 pawns

• `RookValueMg` = 1276 ~ 9.9 pawns

• `QueenValueMg` = 2538 ~ 19.8 pawns

So this is way far from the standard "1 piece equals 3 pawns approach", and I was curious about the reason behind it.

Also, the fact that bishops are 0.8 pawns more valuable than knights called my attention.

I'm aware that this is a small part of Stockfish's (or for that case, any serious engine) evaluation function, but even so it seems like a really big different from the classic approach.

• I'm pretty sure the values are empirically tuned. To explain why - as in 'why is a Bishop worth 0.8 pawns more than knights in the generic middlegame position - though is likely beyond the ability of anyone on the planet. It works, that's all anyone knows. Commented May 9, 2020 at 12:48
• "It works" means "it works in the context of Stockfish evaluation algorithm". That doesn't mean it would work for humans! Commented May 9, 2020 at 14:55
• The rule of thumb is 3 pawns in a knight/bishop. But that's a simplification. A bishop is almost always worth more than a knight and both pieces are almost always worth more than 3 pawns. That rule works for a simplification, but Stockfish doesn't care for simplifications.
– Mast
Commented May 11, 2020 at 9:32

I am not an expert on stockfish source code, but my understanding is the following.

Humans:

It is true, that the 1 piece equals 3 pawns approach is pretty accurate, surprisingly so. However as you are probably aware, when evaluating a position, we consider many other aspects as well, such as piece activity, space, king safety, etc. The difference however is that we don't assign actual numerical values to these other factors.

Stockfish (or similar engines):

Unlike humans, engines assign numerical values to all factors. The numbers you mention are just a small part of the evaluation function.

Check out the middlegame evaluation function for stockfish. On that page you can also modify the board to see the evaluation and you can visit the specific functions such as `piece_value_mg' which is concerned with these numbers.

As you can see, just the piece values of all pieces amount to 9326. However there are many other functions which add to the evaluation. Most importantly, not all of these extra functions treat pawns and pieces equally.

For instance:

• `Psqt mg', gives values to pawns only, depending on their position on the board. As you would expect, pawns in the center are more valuable (pawn on e4 instead of e2 is +24 points)
• another pawns only function: `Pawns mg' gives points depending on the pawn structure (isolated, doubled, connected pawns, etc) also here you can gain several tenth of points for the pawns (but not for the pieces).

To be fair, there are also functions that only deal with pieces such as `Pieces mg'. However note that they can also give a penalty (negative value) to the total evaluation. In fact for the starting position you have -63 from that function.

In summary...

Stockfish has a much more fine grained evaluation function than we humans do. The pure piece value from stockfish cannot really be compared with the human piece value.

In stockfish pieces and pawns can gain points in other ways beyond the values you mention. Furthermore, stockfish does not consider the piece on its own, but also how it relates to other pieces, e.g. whether there are doubled pawns, an outpost, etc.

If you check out the code, these other factors are each in the range of several ten points, so if you take them all together you might very well gain the 100 points necessary for the pawn to be 1/3 of a piece.

Mathematically you could also consider it as a kind of approximation or averaging in which you assign a single number (human piece value) for the very complex system that stockfish uses. There is no reason that the average value (human piece value) has any relation to one of the parameters (ValueMG) in the stockfish universe.

I really recommend to see for yourself at the link how much more complete the stockfish evaluation is.

• +1 Excellent answer. Commented May 10, 2020 at 23:59

Please note that those values are "abstract", later to be modified by the specifics of the position. For example, even though a knight appears 0.8 pawns less valuable than a bishop, it could be that bigger bonuses are awarded to well-placed knights than for well-placed bishops, turning the balance around.

It's also worth noting that the "3 pawns equal a piece" is, for all practical purposes, meaningless. In certain types of positions (those with powerful attacks against the king, for instance), the extra pawns can be useless against a piece. In endgames, three pawns often defeat the piece, specially if not a lot of extra pawns are left

• I think this is the big one: the modifiers to those numbers may be so significant as to render the base numbers kind of meaningless. Commented May 11, 2020 at 2:07

The value of a piece or pawn will depend greatly upon how well it is placed. The common 1/3/3.5/5/9 values are reasonable estimates for pieces which are placed decently but not amazingly well. For various reasons, it may be easier to have the baseline score for a piece represent a piece which is either much worse than typical (so that most pieces would have an adjusted score that was higher), or perhaps have it represent a piece which is much better than typical (so that most pieces would score lower). As an exaggerated contrived example, consider something like:

``````8/p/Pp/RP/1P2nn/RP/P/5K1k w - - 0 1
``````

Even though White nominally has a substantial material advantage (up twice the Exchange, plus three pawns), Black cannot lose without capturing any of the White pawns or pieces. Although trading a pawn for a rook would normally be a good trade, in this case it is a very bad one since White's pieces are completely useless. Black will nominally be able to trade a pawn for a rook, which would seem like an advantage, but doing so would enormously increase the value of White's pieces.

If it is White to mov Playing with this example, I think White should be able to eke out a draw, and Black certainly should be able to do at least that. Playing against Stockfish level 3 on lichess.org, however, I was able to win as both sides because Stockfish overvalued the material at the left and thinks it's worth trading for (I think White should be able to eke out a draw by moving R3-a4, and then a3, but Stockfish didn't find that playing as White, and there might be a way for Black to capture the rook in a situation where Black could then forcce draw by perpetual check/repetition, but Black should have no excuse for losing here.

Even in less contrived situations, Stockfish sometimes fails to adequately distinguish between pieces which aren't currently in the fray, but are going to get there, versus pieces which can be very cheaply kept out of the action while the opponent has a substantial majority of the immediately-effective material. A common feature of games between neural networks and Stockfish is that Stockfish ends up letting some of its pieces sit out of the action while the opponent uses its power majority to edge out further advantages, until by the time the blocked-up pieces get to move, the game is already lost.

Incidentally, I was just playing with another variation on that example (black to play)

``````7K/p7/Pp6/RP6/QP4q1/RP3k2/P7/8 b - - 0 1
``````

Black has a mate in four, but Stockfish, even if set for the highest level on lichess.org, will stalemate White via Qg6 rather than achieve victory, probably because any move that continues play with such a large material imbalance is seen as so massively inferior to stalemate that it's not worth investigating further.

• Uh, in that last example, how does black force a win? "move the king to g4", then white replies with Kg1 and it's a draw anyway (e.g. Kg4, Kg1 Kh3, Kh1 g2, Kg1 Kg3)? Stockfish probably goes for the draw because it is a draw, unless I'm missing something?
– ZLK
Commented May 11, 2020 at 0:56
• @ZLK: Any idea why Stockfish level 8 on lichess would do Kf1 rather than Kh1 in that line? Commented May 11, 2020 at 15:23
• @ZLK: I think I figured out why Stockfish was never so impertinent as to play Kh1. Even if Black manages to promote the pawn, White would still be ahead by two rooks and three pawns, so a stalemate would be seen as a bad outcome for White. Commented May 11, 2020 at 15:44
• @ZLK: I reworked the example to show even more clearly that Stockfish is overvaluing pieces that can't move. Black can immediately achieve a draw, and no position that can be reached within three moves would offer prospects that aren't much worse. I don't think Stockfish's behavior necessarily represents a "defect", in that improving play in this sort of contrived situation would require spending more time pursuing lines that would be unlikely to be useful outside such contrived situations. Still interesting, though, that SF would be blind to a mate in four where all of White's moves... Commented May 11, 2020 at 22:28
• ...are either forced or, in the one case where White would have a choice, the one alternative move would allow immediate mate. Commented May 11, 2020 at 22:29

I'm afraid it was machine tuned. Nobody knows exactly why. It's like nobody really understand the network weights in LC0. In any case, 3 pawns = a piece is nothing more than a general guidance for chess beginners.

• I think there is more to it (see my too long answer). If a piece was really worth 6 pawns, I doubt stockfish would play as good. Commented May 9, 2020 at 19:54