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.
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:
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.
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.
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.
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.
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.
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.
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).