Module 1 · From characters to vectors

Counting the parameters yourself

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 8 of 9 in this chapter

This chapter’s goalTrace a piece of text from characters to token ids to vectors and back to a score for every possible next token, predict where a tokenizer will split unfamiliar input, and count the parameters of a model from four numbers on its config page.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
Where the eight billion parameters goEmbedding table (128,256 ×4,096)0.53Output projection, untied0.53Attention, all 32 layers1.3Feed-forward, all 32layers5.6billions of parametersEvery number here comes from six lines of config.json and multiplication. The feed-forward half isfour times the attention half, and over a billion parameters go on the vocabulary alone, which is whysmall models often tie the two vocabulary matrices together.
Every number here comes from six lines of config.json and multiplication. The feed-forward half is four times the attention half, and over a billion parameters go on the vocabulary alone, which is why small models often tie the two vocabulary matrices together.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

Four numbers, one calculation

Open any open-weights model on Hugging Face and click config.json. You will find something like this:

JSON
{
  "hidden_size": 4096,
  "num_hidden_layers": 32,
  "num_attention_heads": 32,
  "num_key_value_heads": 8,
  "intermediate_size": 14336,
  "vocab_size": 128256
}

From those you can derive the model’s size, its memory needs, and roughly what it will cost to run. Nobody teaches this and it takes ten minutes.

The embedding table

vocab_size × hidden_size = 128,256 × 4,096 ≈ 525 million parameters. The output layer that converts the final vector back into one score per vocabulary entry has the same shape, and in this model it is a separate matrix, so that is another 525 million. Some architectures tie the two (using one matrix for both) which saves the memory at a small cost in quality, and is common in small models where the vocabulary is a large fraction of the total.

Already, in an 8-billion-parameter model, over a billion parameters are spent on the vocabulary.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the AI, Actually Explained exam.

Stuck on something?Ask Anjali, your AI tutor

How to cite: Addaly (2026) ‘Counting the parameters yourself’, in How a Language Model Actually Works. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/how-llms-work/the-shape-of-a-model (Accessed: 29 November 2026).