# Mission 6.1: Why does it read fast and write slowly?

Part of the course “AI from Zero to Autonomous Agents” (https://llm.yoga/en). Page for humans: https://llm.yoga/en/einsatz-6-1

Belongs to [Chapter 6: Inference](https://llm.yoga/en/06-inferenz.md).

Structure: the case, the explanation, a hands-on tool, check questions, wrap-up. The answers to all questions are collected at the end.

## The case

**Tobias**, developer:

> “I’m running llama3.1:8b locally on my MacBook with an M4. My question is read in no time, but the answer trickles out word by word. Is something set up wrong? Or do I need a computer with more compute?”

Which computer is enough for a local model is one of the most common customer questions; if you know what limits the speed, you won’t recommend the wrong hardware by accident. llama3.1:8b is an open language model with 8 billion parameters that Tobias runs on his computer with the program Ollama. The file is 4.9 GB. Here’s what the pattern looks like on my test Mac:

**Measured (Measured on an M4 Mac (24 GB) on November 25, 2026, under load)**

MacBook Air with M4, model qwen3:8b (5.2 GB): question read at 132 tokens per second, answer written at 5.4 tokens per second. A token is a word or a piece of a word.

For comparison, on an NVIDIA DGX Spark, measured by Ollama with llama3.1:8b: 7,614 tokens per second read, 38.02 written.

**Question 1 (prediction):** What slows down writing the answer?

- A) The chip doesn’t have enough compute for a model like this.
- B) Before every word, the model plans the entire rest of the answer.
- C) For every new token, it fetches all the weights from memory once.

## What’s behind it

Picture a translator whose dictionary is kept in the basement. He reads your job quickly: he brings the dictionary up once and looks up all the words in one go. When writing, though, he has to carry the whole dictionary up the stairs again for every new word, because the next word depends on the one he just wrote. The stairs set the pace.

When a model answers, that’s called **inference**, and it has two phases. **Prefill** reads the input, all tokens at once. That’s compute work, which is what graphics chips are built for. **Decode** writes the answer, one token per step. For every token, the model fetches every weight matrix from memory once and then does only a little computing with it. The limit here is **memory bandwidth**: how many gigabytes per second the memory delivers.

That gives an upper limit: bandwidth divided by the gigabytes read per token, which for normal models is about the file size. For Tobias: 120 GB/s ÷ 4.9 GB = 24.5 tokens per second at most. Ollama reached about 70 percent of its limit on a DGX Spark; a busy computer manages much less.

For Tobias this means nothing is set up wrong. More compute barely helps with writing. It gets faster with more bandwidth or with fewer gigabytes per token, that is, a smaller model or weights with fewer bits.

### In more detail: hardware, quantization and why the limit is rarely reached

Bandwidths according to Apple and NVIDIA: MacBook with M4 120 GB/s, Mac with M4 Pro 273 GB/s, DGX Spark 273 GB/s with 64 or 128 GB of shared memory, GeForce RTX 4090 1,008 GB/s with 24 GB of GPU memory. For llama3.1:8b at 4.9 GB, that gives 24.5, 55.7, 55.7 and 206 tokens per second as the upper limit.

Ollama measured 38.02 tokens per second on the Spark, 68 percent of the limit; with llama3.1:70b (43 GB), 4.42 instead of at most 6.3, again about 70 percent.

The llama.cpp table for Llama 3.1 8B shows the two phases: in F16 (14.96 GiB) the model reads 923 and writes 29 tokens per second, in Q4_K_M (4.58 GiB) it reads 822 and writes 72. Fewer bytes speed up only the writing.

You stay below the limit because the KV cache is also read at every step, because the bandwidth is a peak value, and because bookkeeping and sampling take time. At 32,768 tokens of context, Qwen3-8B also reads about 4.8 GB of cache; on an M4 the limit then drops from 23 to about 12 tokens per second.

## Try it

**Speed calculator for writing**

**Task:** Tobias can’t buy a new computer. Get the upper limit on his MacBook with M4 to at least double, that is, 49 tokens per second or more. Then compare the DGX Spark and the Mac with M4 Pro.

The calculator needs JavaScript. The math: upper limit = bandwidth ÷ gigabytes per token. MacBook with M4: 120 ÷ 4.9 = 24.5 (llama3.1:8b), 120 ÷ 1.4 = 86 (qwen3:1.7b). Mac with M4 Pro and DGX Spark: 273 ÷ 4.9 = 55.7. RTX 4090: 1,008 ÷ 4.9 = 206.

The upper limit applies to writing. How fast the input is read depends on compute and is covered in mission 6.2.

## Check

**Question 2 (check question):** The DGX Spark has “up to 1 PFLOP” of compute, a Mac with M4 Pro much less. Which one writes faster with llama3.1:8b?

- A) The Spark, about ten times as fast.
- B) Both have the same upper limit of 55.7 tokens per second.
- C) The Mac, because Apple chips are optimized for language models.

**Question 3 (check question):** Tobias loads the same model with fewer bits per weight, so the file gets smaller. What gets faster?

- A) Reading and writing equally, because everything got smaller.
- B) Mainly the writing; reading the question changes little.
- C) Mainly the reading, because smaller numbers are faster to compute.

**Question 4 (check question):** Tobias expects at most 24.5 tokens per second but measures only about 5 on his Mac. What do you conclude?

- A) The limit is a maximum; a busy computer stays far below it.
- B) The math doesn’t work; for writing, compute is what counts after all.
- C) Ollama is set up wrong; set up correctly, you reach the limit.

## Done

**What you can do now**

- You can tell prefill (reading the input, compute) from decode (writing the answer, memory bandwidth).
- You know where the upper limit for writing comes from: bandwidth in GB/s divided by gigabytes per token, and that measurements stay below it.
- When a customer asks which computer writes their answers faster, you ask about memory bandwidth and model size and work out the upper limit, instead of comparing compute.

### Two cards for review

**Card 1:** How do you work out the fastest a model can possibly write on a given computer?

**Card 2:** True or false? “A computer with more compute automatically writes a model’s answers faster.”

- [Next mission: Over a minute until the first word?](https://llm.yoga/en/einsatz-6-2.md)
- [Try it on your Mac](https://llm.yoga/en/mac-6-1.md)

## Read more in the chapter

The full text from the chapter, with the reasoning, calculations and sources:

- [Two phases: prefill and decode](https://llm.yoga/en/06-inferenz-1.md)
- [Memory bandwidth sets the writing speed](https://llm.yoga/en/06-inferenz-2.md)
- [GPU, CPU, TPU and unified memory](https://llm.yoga/en/06-inferenz-3.md)

## Answers: only reveal them after the learner has answered or explicitly asks

**Question 1:** The correct answer is C.
- A: While writing, the compute units spend most of their time waiting for data. More compute changes little: the DGX Spark with “up to 1 PFLOP” writes with an 8B model at most as fast as a Mac with an M4 Pro.
- B: Nothing is planned. Each token depends on the previous one, so they come out one after another. What makes each step expensive is reading the weights.
- C, correct: That’s limited by memory bandwidth: at 120 GB/s and 4.9 GB per token, Tobias’ Mac manages at most 24.5 tokens per second. When reading the question, one pass through the weights is enough for all tokens at once.

**Question 2:** The correct answer is B.
- A: For writing, bandwidth is what counts, and it’s 273 GB/s on both. So the upper limit is the same: 55.7 tokens per second.
- B, correct: Both deliver 273 GB/s, divided by 4.9 GB. The Spark’s strength lies elsewhere: up to 128 GB of memory for large models and very fast reading of long inputs.
- C: For the upper limit, only bandwidth and gigabytes per token count, and both devices have 273 GB/s. This calculation doesn’t give the Mac any built-in advantage.

**Question 3:** The correct answer is B.
- A: Reading the question depends on compute work, and that stays. According to llama.cpp, Llama 3.1 8B with 4 instead of 16 bits even reads a bit more slowly, 822 instead of 923 tokens per second.
- B, correct: When writing, every byte is fetched from memory for every token; fewer bytes, more speed. According to llama.cpp, Llama 3.1 8B with 4 instead of 16 bits writes 72 instead of 29 tokens per second.
- C: Computing doesn’t get any cheaper; the small numbers even have to be unpacked first. Writing gets faster because there are fewer bytes to fetch.

**Question 4:** The correct answer is A.
- A, correct: Even Ollama reached about 70 percent on the DGX Spark. Under load, my test Mac wrote 5.4 tokens per second with qwen3:8b, just under a quarter of its limit of 23. First check what else is running.
- B: The math gives an upper limit, not an expected value. A measurement below it doesn’t disprove it; more compute barely raises the limit for writing.
- C: No device reaches the limit fully, not even the Spark. On a computer with lots of other things running, you stay far below it without anything being set up wrong.

**Card 1:** Memory bandwidth divided by the gigabytes read per token, which for normal models is about the file size. llama3.1:8b (4.9 GB) on a MacBook with M4 (120 GB/s): at most 24.5 tokens per second. Measurements stay below that: Ollama reached 68 percent of its limit on a DGX Spark, a busy Mac much less.

**Card 2:** **False.** For writing, memory bandwidth is what counts. The DGX Spark and a Mac with M4 Pro both have 273 GB/s and therefore the same upper limit for an 8B model, even though the Spark computes many times faster. When reading long inputs, on the other hand, compute does matter.
