dmodeld_{\text{model}}

d_model — the model's width

Read "d model". It is how many numbers represent one token inside the network: 768 for GPT-2 small, 4096 for LLaMA-3 8B.

It is the one size that stays the same through every layer. Every vector in the residual stream, and every sub-layer's input and output, has dmodeld_{\text{model}} numbers. That is what lets the residual addition x+SubLayer⁡(x)\mathbf{x} + \operatorname{SubLayer}(\mathbf{x}) work at every layer: you can only add two vectors of the same length.

The weight matrices in each layer are roughly dmodel×dmodeld_{\text{model}} \times d_{\text{model}} in size, so a layer's parameter count grows with dmodel2d_{\text{model}}^2. Doubling the width roughly quadruples it.

Where the course uses it

Related terms