Lesson 2

How does a model learn?

What a parameter is, how training turns billions (hundreds of crores) of them, and what a model keeps once training is over.

1How does a model learn which word comes next?

A model learns by guessing and being corrected. It is shown real sentences, and it has to guess each word before it sees it.

This guessing and correcting is called training.

The numbers that change are called parameters. Section 2 shows what they are.

2What is a parameter?

A parameter is a number inside a model that changes while the model learns.

Example: the chai model below has 2 parameters, its guess for the price of 1 cup of chai and its guess for the price of 1 plate of samosa.

Think of each parameter as a dial. Turn it up or down, and the model's answer changes.

The chai model guesses the bill at a chai stall:

Step 1 of 6

A made-up stall with made-up prices. Prices and bills are in rupees. We picked the size of each turn so the sums stay easy. Real training works out the size of each turn with maths.

These two dials are the model's parameters. Training turned them from ₹5 and ₹5 to ₹20 and ₹10.

You will also hear parameters called weights. Both words mean these learned numbers. Example: "a model with 8 billion weights" means a model with 8 billion (800 crore) parameters.

3How does training turn the dials?

Training turns the dials by repeating three steps, again and again: make a guess, check how wrong it is, and nudge the dials. The chai model in section 2 worked the same way: it guessed a bill, checked it against the real bill, and turned its dials.

What is the guess checked against?

At the start the dials are random, so the guesses are nonsense.

One nudge barely changes anything. But the nudges add up.

These numbers are made up, to show the idea. The nudges add up because the model goes through all of its training text, and every word in that text is one more guess to check.

After training, the guesses make sense:

4How many parameters does a real model have?

Billions (hundreds of crores). Llama 3, a model Meta released in 2024, comes in two sizes: one with 8 billion parameters (800 crore) and one with 70 billion (7,000 crore).

The dials sit in layers:

Input: your words as numbers
1
2
Layer 1 (4 dials)
box 11 × 3 + 2 × 1 = 5
box 21 × 2 + 2 × 4 = 10
Layer 2 (2 dials)
box 15 × 2 + 10 × 1 = 20

Your words go in as two numbers, 1 and 2. The layers have not worked yet.

Layer 1: each box multiplies 1 and 2 by its own two dials and adds. Out come 5 and 10.

Layer 2 takes 5 and 10, multiplies by its two dials and adds. Out comes 20. This network has 4 + 2 = 6 dials.

Step 1 of 3

The numbers on orange are the dials, the parameters. Made-up numbers. A real layer does a little more than multiply and add, and it has far more boxes.

This tiny network has 6 dials. Llama 3 has 8 billion (800 crore) or 70 billion (7,000 crore), in many more layers.

A model has parameters. It is trained on text.

5Are the chances for the next word stored in the model?

No. A model stores only its parameters, the numbers it learned in training, and once training is over they stop changing. The chances for the next word are worked out fresh, each time, from the sentence you type.

The cat sat on the  

Chance that each word comes next

  1. mat34%
  2. floor18%
  3. sofa14%
  4. lap9%
  5. rainbow<1%

The sentence goes into the model. Nothing is worked out yet.

The same dials work out a chance for every word that could come next.

The word with the highest chance goes into the blank.

Step 1 of 3

Made-up chances. Only the top 5 words are shown. Tap the other sentence: same dials, different sentence, different chances.

The chai model works the same way. Its dials stay at ₹20 and ₹10, and every new order gets its own bill. Example: 1 chai and 4 samosas, an order it never saw, comes to 1 × ₹20 + 4 × ₹10 = ₹60.

6Does a model keep a copy of what it read?

No. The text a model was trained on is not part of the model. All that is kept is its parameters, the numbers it learned.

Because the model keeps no copy:

Everything in this lesson works on numbers: dials multiply numbers and add them up. But you type words. How does a model read text? Lesson 3 starts there.

← Lesson 1  ·  All lessons  ·  Next lesson →

Where this comes from

  • Training as guess, check, nudge: How Large Language Models Work (Raff, Farris, Biderman; Manning 2025), ch.4, PDF p.69: "Gradient descent—You need a mechanical process that tweaks the numeric values inside an algorithm to make the loss function score as small as possible." PDF p.73: the gradient is "the direction and amount that you need to change the parameters". PDF p.74: "Modern LLMs perform billions of parameter updates because they are trained on billions of tokens."
  • Weights are the parameters, arranged in layers: Hands-On Large Language Models (Alammar, Grootendorst; O'Reilly 2024), ch.1, PDF p.28-29: "neural networks can have many layers where each connection has a certain weight depending on the input. These weights are often referred to as the parameters of the model."
  • Llama 3, 8 billion (800 crore) and 70 billion (7,000 crore), over 15 trillion tokens (15 lakh crore): Meta, "Introducing Meta Llama 3" (18 April 2024): "pretrained and instruction-fine-tuned language models with 8B and 70B parameters"; "Llama 3 is pretrained on over 15T tokens that were all collected from publicly available sources." ai.meta.com/blog/meta-llama-3. The book gives the same scale: "LLM developers train models on 1 to 15 trillion tokens (e.g., Llama 3.1 used 15 trillion)" (How Large Language Models Work, ch.9, PDF p.174).
  • 16 GB, 2 bytes per dial: Hugging Face, meta-llama/Meta-Llama-3-8B: 8,030,261,248 parameters stored as BF16 (2 bytes each), in four files totalling 16,060,556,376 bytes. huggingface.co/meta-llama/Meta-Llama-3-8B. 15 trillion (15 lakh crore) ÷ 8.03 billion (803 crore) ≈ 1,868 tokens per dial, rounded to 1,900.
  • Not a copy, but some text word for word: Hands-On Large Language Models, ch.3, PDF p.134: "For an LLM to be successfully trained, it needs to memorize a lot of information. But it is not simply a large database." How Large Language Models Work, ch.4, PDF p.76-77: models are not trained to "Produce factually accurate text"; they are rewarded "for producing text that looks exactly like the training data".
  • Made up on purpose: the chai stall, its prices, its orders and the size of each turn; the guesses and chances in sections 3 and 5; the numbers in the two-layer network. Each is labelled where it appears. All web pages accessed 2026-10-31.