Go to Map Courses Lab Glossary How it works Troubleshooting Start →
ITEN
← Course 05 · Understanding language (Lesson 05.03 · 20 minutes · No sensor · For everyone)

A language model in your pocket.

A model that writes can fit in a phone, if it's small enough. Here you'll work out memory and speed with real numbers, and find out what these models do well and where they make things up.

What you learn
  1. How a language model writes, one token at a time
  2. How to work out how much memory you need and how many tokens per second to expect
  3. What the context is and why a phone can hold only a little of it
  4. What a small model is good for, and what it isn't
You need to know

If you don't remember one of these, the link takes you to the chapter that explains it.

How do you want to follow it
Preparing the scene…
  1. 01 The game

    A language model guesses the next piece.

    A language model does just one thing. It reads a text and estimates which token05.01 comes next. It adds that token, rereads everything, and estimates the next one, one piece at a time. Answers, summaries and translations all come out of this repeated game. A model of this kind that's small enough to fit in a phone is called an SLM.

    In practice. When a model gets a fact wrong with total confidence, remember the game. It isn't looking for the truth, it picks the piece that sounds most likely.

01 / 07
(Go deeper)

A few more numbers.


(01)

The memory math

The table shows how much some open models weigh. The 16-bit column is the full size, and the 4-bit column is the quantized version used on phones. On top of the weights you need memory for the context, a few hundred MB for a few thousand tokens.

On a phone with 8 GB of RAM, models up to 3 or 4 billion parameters at 4 bits fit comfortably. The 8 billion ones need a top-end phone with 12 or 16 GB.

ModelParametersAt 16 bitsAt 4 bits
Gemma 3 1B1 billion2 GBabout 0.6 GB
Llama 3.2 3B3.2 billion6.4 GBabout 1.8 GB
Phi-3.5 mini3.8 billion7.6 GBabout 2.2 GB
Gemma 3 4B4 billion8 GBabout 2.5 GB
Llama 3.1 8B8 billion16 GBabout 4.7 GB
(02)

Reading is fast, writing is slow

A model works in two phases. First it reads the whole question, and it does that in parallel, many tokens at once. Here computing power matters, and the NPU helps a lot. Then it writes, one token at a time, and each token means rereading all the weights. Here memory speed matters.

That's why on phones the answer starts after a moment and then flows at a steady speed. A long question makes the first wait longer, and a long answer makes the rest longer. The memory math from the chapter on speed applies to the second part.

(03)

Trying them on your phone

There are free apps that download an open model and run it on the phone. Google AI Edge Gallery, on Android, tries out Gemma models and measures tokens per second. PocketPal and MLC Chat also work on iPhone. In the browser, with WebGPU, there's WebLLM.

Each model downloads once, from a few hundred MB to a few GB, and then works in airplane mode. It's the most direct way to see the math of this lesson with your own eyes, including the phone that heats up and slows down after a few minutes.

(Try it on your phone)

Does it fit in my phone?


Pick a model, the bits of the weights, the RAM and the kind of phone. The tool does the math of this lesson. It tells you how much the model weighs, whether it fits in memory and how many tokens per second it can write at most.

The tool needs JavaScript turned on.

These are rough numbers, worked out with the rules of the lesson. The models you download, like the ones in the table in the first Go deeper section, often weigh a bit more. For your own phone, try one of the apps in the third Go deeper section and compare.

(Quiz)

4 questions to close the lesson.

When you have answered them all, the lesson counts as done and its stone on the map turns yellow. Answering is what counts, not the score.


  1. (01)

    A model has 3 billion parameters quantized to 4 bits. Roughly how much does it weigh?

  2. (02)

    Why does a smaller model also write faster?

  3. (03)

    What is a small language model good for?

  4. (04)

    You want it to use a 300-page manual. What do you do?

(Next lesson · 05.04) Models that see and speak