user7281: When AlphaZero learned on its own that a queen has a value of 9, a pawn 1, knight 3, etc., then did it also need to learn on its own that a piece has a value? Or was it that the concept of value was baked into its code and it only had to figure out on its own what the values are. The value of a queen is not strictly 9, but it is relatively more valuable than a pawn.

user18029: This is a short answer, but hopefully it helps.
Consider how AlphaZero values pawns. It throws them away in disgust sometimes, usually to open up files or diagonals on which to plant menacing rooks and bishops. AlphaZero doesn't care one bit about the nominal value a piece may have (I'd argue most human players also don't care about a piece's value).

user8694: In short, no there was no explicit concept of relative piece importance coded in. But the position evaluation is based on a neural network which possesses weights which indirectly account for the pieces in the position.
That said, in this AlphaZero paper they use self-play games to fit a linear model that predicts the game outcome from the difference
in numbers of each piece only, result:


user19269: From the comments below, maybe a good summary of this answer:

Alphazero doesn't necessarily respect piece value the way we do, but both Alphazero's experience and our piece valuation (which is effectively our human experience) are approximations of same the balance of power for a given board state.


Piece value is a form of bias, by inherent definition of saying that one piece is worth more than other. It's an artifact of how humans reason about the strength of a certain position/play. Our piece valuation, when taken as literal truth, suggests that a queen is always worth more than e.g. a knight or a pawn.
Part of what makes machine learning so interesting is that having an unbiased objective view can fundamentally shake things up. For example, in certain strategies you could do more with a knight than a queen, therefore throwing out the idea that a queen has more value than a knight.
However, this is just a small subset of strategies and positions, among million others. You already touched on this point yourself, when you commented:

Not strictly 9, but only that a queen is worth more than a pawn, for example. Of course, exceptions exists, for example if the pawn can deliver a mate.

Humans aren't able to mentally track different individual piece valuations for millions of different positions or plays. Therefore, humans use a valuation that works in most cases. In most cases, a queen is more useful than a knight. In most cases, a knight is more useful than a pawn. This is why our piece valuation is the way that it is.
However, machines don't have these limitations. They are much more able to track different piece valuations for each distinct board situation, and therefore a machine doesn't need to rely on some arbitrary global piece value, as it is a needlessly imprecise measurement.
For a machine, it makes a lot more sense to simply calculate each piece's value on the fly, rather than relying on some half-baked approximation.
Different strokes for different folks. Machines are better at this, and therefore they don't need the oversimplified crutch that our piece valuation represents.
In order to understand machine learning, and how the machine "thinks", you need to sidestep your own bias and preconceived observations. Unsurprisingly, sidestepping human bias is by far the biggest challenge in machine learning - more so than the raw learning algorithm in and of itself.

That being said, if you asked Alphazero to play a billion games, look at the victories, asked it to re-simulate those games after taking away one random piece, and then asked which type of piece had the biggest impact on turning a victory in a defeat, then it would very likely tell you that it's the queen.
That is sort of the same as saying "the queen is the most valuable piece", but in a much more pedantic and deeply analytical way. It is pedantic to us, but for Alphazero this isn't pedantry but rather necessary accuracy. One man's pedantry is another man's precision.
Our human piece valuation system isn't wrong, it's just very crude and unrefined.

user27980: AI engineer here.
The answer to this question is hiding in the name: AlphaZero. This refers to "zero prior knowledge of the game". AlphaZero can also play Go.
Now, it might be a bit strong to say that AlphaZero has absolutely no knowledge about chess. AlphaZero knows that it's a turn-by-turn board game, and that the 3 possible outcomes are a win for either side or a draw. (unlike Go, which has no draw). But AlphaZero had to figure out itself how pieces contributed to winning.
Since AlphaZero is a Deep Neural Network, it can quickly learn highly complex valuation functions. That is to say, it can learn a valuation function which includes how well each piece cooperates with other pieces.
What might also be surprising is how Google got started with these valuations. They simply started with entirely random values! The learning algorithm just tweaked the values step by step, and gradually won more and more games.

user19777: One central piece of alphazero is the neural evaluation function. This function takes the board as input and produces a value as output. The only input is what pieces are on the board and where.
So, you can see it as the programmers enforcing this rule: the value of a position depends on which pieces are placed where.
This is what the AI "knew" as it as born, if you will. It knew that pieces being present and located relative to each other had value. Now, one possible way to score the board is a linear combination of "piece value" times "number of pieces of that kind". But in practice, the network learned a much more complex and non-linear function of the pieces present on the board.
It certainly could do what we often use: queen times 9 + knight times 3 + ... but it learned much better than that.
https://medium.com/applied-data-science/alphago-zero-explained-in-one-diagram-365f5abf67e0
The deep neural network on the left gives you a hint of how much more complex the evaluation function can be, over this simplistic linear evaluation.

user27975: The short answer is: No.
AlphaZero learns to evaluate only the position. The position consists of all the pieces and their placement on the board (plus castling and en-passant information). There is no way to distinguish the material's value from the position's strength -- which is a really beautiful idea and offers a lot of learning potential for humans.
AlphaZero chooses its moves to maximize the (positive) value of the position. (The checkmate-win has the maximal positive value, the checkmate-loss has the maximal negative value.)
The information about the value of single pieces is stored nowhere. It can be potentially obtained by comparing position evaluations when removing/adding pieces to the board. But it will also influence the position's strength which cannot be separated from the material's value itself. So in best case some average value of pieces (when averaging over many positions) might be estimated in this way.

user15223: It sort of did. "Sort of" because once you examine how neural networks work it's not clear what AlphaZero is actually learning.
AlphaZero has a neural network evaluation function. How that works is that it takes as input the position on the board (along with other things like whether a pawn can capture en passant, whether castling is possible, etc) and converts that into a list of candidate moves to play as well as the probability of winning. There is no "queens are worth 9 pawns" input, there is only "there's a queen on this square". Of course, queens usually have quite an impact on a position, so the neural network will quickly learn that having queens strongly correlates with a high probability of winning, but nobody actually knows how much value the neural network ascribes to the queen.
What was definitely not given to AlphaZero was the idea that each piece has a value. Remember, it was only given the position on the board.

7281: <p>When AlphaZero learned on its own that a queen has a value of 9, a pawn 1, knight 3, etc., then did it also need to learn on its own that a piece has a value? Or was it that the concept of value was baked into its code and it only had to figure out on its own what the values are. The value of a queen is not strictly 9, but it is relatively more valuable than a pawn.</p>
 18029: <p>This is a short answer, but hopefully it helps.</p>
<p>Consider how AlphaZero values pawns. It throws them away in disgust sometimes, usually to open up files or diagonals on which to plant menacing rooks and bishops. AlphaZero doesn't care one bit about the nominal value a piece may have (I'd argue most human players also don't care about a piece's value).</p>
 8694: <p>In short, no there was no explicit concept of relative piece importance coded in. But the position evaluation is based on a neural network which possesses weights which indirectly account for the pieces in the position.</p>
<p>That said, <a href="https://arxiv.org/abs/2009.04374" rel="nofollow noreferrer">in this AlphaZero paper</a> they use self-play games to fit a linear model that predicts the game outcome from the difference
in numbers of each piece only, result:</p>
<p><a href="https://i.stack.imgur.com/lusRN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lusRN.png" alt="enter image description here" /></a></p>
 19269: <p>From the comments below, maybe a good summary of this answer:</p>
<blockquote>
<p>Alphazero doesn't necessarily respect piece value the way we do, but both Alphazero's experience and our piece valuation (which is effectively our human experience) are approximations of same the balance of power for a given board state.</p>
</blockquote>
<hr />
<p>Piece value is a form of <strong>bias</strong>, by inherent definition of saying that one piece is worth more than other. It's an artifact of how humans reason about the strength of a certain position/play. Our piece valuation, when taken as literal truth, suggests that a queen is <em>always</em> worth more than e.g. a knight or a pawn.</p>
<p>Part of what makes machine learning so interesting is that having an unbiased objective view can fundamentally shake things up. For example, in certain strategies you could do more with a knight than a queen, therefore throwing out the idea that a queen has more value than a knight.</p>
<p>However, this is just a small subset of strategies and positions, among million others. You already touched on this point yourself, when you commented:</p>
<blockquote>
<p>Not strictly 9, but only that a queen is worth more than a pawn, for example. Of course, exceptions exists, for example if the pawn can deliver a mate.</p>
</blockquote>
<p>Humans aren't able to mentally track different individual piece valuations for millions of different positions or plays. Therefore, humans use a valuation that works in <em>most</em> cases. In <em>most</em> cases, a queen is more useful than a knight. In <em>most</em> cases, a knight is more useful than a pawn. This is why our piece valuation is the way that it is.</p>
<p>However, machines don't have these limitations. They are much more able to track different piece valuations for each distinct board situation, and therefore a machine doesn't need to rely on some arbitrary global piece value, as it is a needlessly imprecise measurement.<br />
For a machine, it makes a lot more sense to simply calculate each piece's value on the fly, rather than relying on some half-baked approximation.</p>
<p>Different strokes for different folks. Machines are better at this, and therefore they don't need the oversimplified crutch that our piece valuation represents.</p>
<p>In order to understand machine learning, and how the machine &quot;thinks&quot;, you need to sidestep your own bias and preconceived observations. Unsurprisingly, sidestepping human bias is by far the biggest challenge in machine learning - more so than the raw learning algorithm in and of itself.</p>
<hr />
<p>That being said, if you asked Alphazero to play a billion games, look at the victories, asked it to re-simulate those games after taking away one random piece, and then asked which type of piece had the biggest impact on turning a victory in a defeat, then it would very likely tell you that it's the queen.</p>
<p>That is <em>sort of</em> the same as saying &quot;the queen is the most valuable piece&quot;, but in a much more pedantic and deeply analytical way. It is pedantic <em>to us</em>, but for Alphazero this isn't pedantry but rather necessary accuracy. One man's pedantry is another man's precision.</p>
<p>Our human piece valuation system isn't <em>wrong</em>, it's just very crude and unrefined.</p>
 27980: <p>AI engineer here.</p>
<p>The answer to this question is hiding in the name: Alpha<strong>Zero</strong>. This refers to &quot;zero prior knowledge of the game&quot;. AlphaZero can also play Go.</p>
<p>Now, it might be a bit strong to say that AlphaZero has absolutely no knowledge about chess. AlphaZero knows that it's a turn-by-turn board game, and that the 3 possible outcomes are a win for either side or a draw. (unlike Go, which has no draw). But AlphaZero had to figure out itself how pieces contributed to winning.</p>
<p>Since AlphaZero is a Deep Neural Network, it can quickly learn highly complex valuation functions. That is to say, it can learn a valuation function which includes how well each piece cooperates with other pieces.</p>
<p>What might also be surprising is how Google got started with these valuations. They simply started with entirely random values! The learning algorithm just tweaked the values step by step, and gradually won more and more games.</p>
 19777: <p>One central piece of alphazero is the neural evaluation function. This function takes the board as input and produces a value as output. The only input is what pieces are on the board and where.</p>
<p>So, you can see it as the programmers enforcing this rule: the value of a position depends on which pieces are placed where.</p>
<p>This is what the AI &quot;knew&quot; as it as born, if you will. It knew that pieces being present and located relative to each other had value. Now, one possible way to score the board is a linear combination of &quot;piece value&quot; times &quot;number of pieces of that kind&quot;. But in practice, the network learned a much more complex and non-linear function of the pieces present on the board.</p>
<p>It certainly could do what we often use: queen times 9 + knight times 3 + ... but it learned much better than that.</p>
<p><a href="https://medium.com/applied-data-science/alphago-zero-explained-in-one-diagram-365f5abf67e0" rel="noreferrer">https://medium.com/applied-data-science/alphago-zero-explained-in-one-diagram-365f5abf67e0</a></p>
<p>The deep neural network on the left gives you a hint of how much more complex the evaluation function can be, over this simplistic linear evaluation.</p>
 27975: <p>The short answer is: <strong>No</strong>.</p>
<p>AlphaZero learns to evaluate only the position. The position consists of all the pieces and their placement on the board (plus castling and en-passant information). <strong>There is no way to distinguish the material's value from the position's strength</strong> -- which is a really beautiful idea and offers a lot of learning potential for humans.
AlphaZero chooses its moves to maximize the (positive) value of the position. (The checkmate-win has the maximal positive value, the checkmate-loss has the maximal negative value.)</p>
<p>The information about the value of single pieces is stored nowhere. It can be potentially obtained by comparing position evaluations when removing/adding pieces to the board. But it will also influence the position's strength which cannot be separated from the material's value itself. So in best case some average value of pieces (when averaging over many positions) might be estimated in this way.</p>
 15223: <p>It sort of did. &quot;Sort of&quot; because once you examine how neural networks work it's not clear what AlphaZero is actually learning.</p>
<p>AlphaZero has a neural network evaluation function. How that works is that it takes as input the position on the board (along with other things like whether a pawn can capture <em>en passant</em>, whether castling is possible, etc) and converts that into a list of candidate moves to play as well as the probability of winning. There is no &quot;queens are worth 9 pawns&quot; input, there is only &quot;there's a queen on this square&quot;. Of course, queens usually have quite an impact on a position, so the neural network will quickly learn that having queens strongly correlates with a high probability of winning, but nobody actually knows how much value the neural network ascribes to the queen.</p>
<p>What was definitely not given to AlphaZero was the idea that each piece has a value. Remember, it was only given the position on the board.</p>
