Skip to content
mentoor

Topic 2 of 5 · 5 min read

Why memory bandwidth sets generation speed

Goal: Estimate the upper bound on tokens per second for a model on a device from its memory bandwidth.

When a model generates text one token at a time, speed is limited by how fast memory can feed the weights to the chip, so tokens per second is at most memory bandwidth divided by the bytes read per token. Raw compute is rarely the limit.

Check yourself · 1 of 3

For single-user text generation, what mostly limits tokens per second?

Choose one answer

Why it matters

Two machines can have similar memory sizes and very different speeds. A buyer who compares only gigabytes picks a machine that fits the model but crawls. The bandwidth number, in GB/s, predicts the feel of a chat better than any other single spec.

How the ceiling works

To produce one token, the model reads every active weight once. For a dense model, that is the whole file. So:

max tokens/s = memory bandwidth (GB/s) / active weight size (GB)

Real speed is lower, often 60 to 80 percent of this ceiling, because of cache reads, scheduling and other overhead. Use the ceiling to rank options, not to promise a number.

Worked numbers

An 8B model at 4-bit is about 4.5 GB:

  • Graphics card with 1,000 GB/s: ceiling about 222 tokens/s.
  • Laptop with 100 GB/s of system memory: ceiling about 22 tokens/s.
  • A 70B model at 4-bit (39 GB) on a 400 GB/s machine: about 10 tokens/s.

The same arithmetic explains quantisation: a 4-bit model is both smaller in memory and about four times faster than 16-bit at the same bandwidth, because there are fewer bytes to read.

Two refinements

Mixture-of-experts (MoE) models read only the active experts per token. A model with 30B total parameters and 3B active, at 4-bit, reads about 1.7 GB per token, so it can run several times faster than a dense 30B model while still needing about 17 GB to hold all the weights. Memory size sets whether it fits, active size sets how fast it runs.

Batching changes the picture. Reading the weights once can serve many requests at the same time, so a server with 16 parallel chats produces far more total tokens per second than one chat does, though each user gets the same per-user speed. Single-user local use is the bandwidth-bound case. Prompt processing, called prefill, is the opposite: it handles many tokens at once and is limited by compute, so a machine can read a long prompt slowly and then generate quickly.

Before and after

Weak: "Both machines have 64 GB, so they will run a 70B model equally well." Fixed: one has 100 GB/s, the other 800 GB/s. For a 39 GB model that is a ceiling of about 2.6 tokens/s against about 20 tokens/s.

What goes wrong

  • Comparing capacity only. Memory size says whether a model loads, not how fast it runs.
  • Quoting the ceiling as the speed. Expect a fraction of it.
  • Using total parameters for an MoE model. Use active parameters for speed and total for memory.
  • Judging a long-prompt workload by generation speed. Prefill depends on compute.

Examples

Ranking three machines for a 4.5 GB model

Bandwidths: desktop with a graphics card 1,000 GB/s, a unified-memory laptop 400 GB/s, a desktop on system RAM 90 GB/s. Ceilings for a 4.5 GB model: 222, 89 and 20 tokens per second. At 70 percent of the ceiling, expect roughly 155, 62 and 14. All three are usable for chat, but only the first two feel instant.

Dense versus MoE on the same laptop

On a 400 GB/s machine, a dense 32B model at 4-bit (about 18 GB) has a ceiling near 22 tokens/s. A 30B MoE with 3B active at 4-bit (reading about 1.7 GB per token) has a ceiling near 235 tokens/s, while using about 17 GB of memory. The MoE model fits the same machine and runs many times faster.

Key points

  • Single-stream generation reads all active weights once per token, so speed is capped at bandwidth divided by active weight size.
  • Real throughput is typically well below the ceiling, so use it to rank hardware, not to promise numbers.
  • Smaller quants run faster as well as fitting better, because fewer bytes are read per token.
  • For MoE models, total parameters set the memory needed and active parameters set the speed.
  • Prefill and batched serving are limited by compute, not only bandwidth, so they behave differently from one-user chat.

Common mistakes

  • Choosing hardware by memory capacity alone and ignoring bandwidth.
  • Treating the bandwidth ceiling as the expected speed instead of an upper bound.
  • Dividing bandwidth by total parameters for an MoE model instead of active parameters.
  • Expecting fast generation to mean fast long-prompt processing; prefill is compute-bound.

Check yourself · 2 of 3

A 4.5 GB model runs on a device with 90 GB/s of memory bandwidth. What is the rough ceiling?

Choose one answer

Check yourself · 3 of 3

Why can a 30B-parameter MoE model with 3B active parameters generate faster than a dense 30B model on the same machine?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic