# GPU Basics: Why Does Memory Bandwidth Limit Decoding?

> Why a GPU's memory read speed, more than its maths, often sets how fast one answer streams out, explained for your AI interview.

**In short:** Decoding writes one token (a short piece of a word) at a time. In a standard model, each token needs the weights read from GPU memory again. The speed of those reads, the memory bandwidth, often sets the pace, so extra compute barely helps one user.

AI and LLM interview question Q327, Inference, performance and cost. Advanced, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/gpu-basics-why-does-memory-bandwidth-limit-decoding

## Say it in 30 seconds

GPU memory bandwidth often limits decoding, because a model writes one token at a time. For each token, the GPU reads the model's weights from its memory. That read often sets how fast tokens come out, so a chip with more maths power does little for one user. Batching many users raises total tokens per second from the card, and smaller weights raise each reply's ceiling. When a team asks me to speed up a slow assistant, I check the memory numbers first.

## Say it in 2 minutes

Decoding is slow for a simple reason: the chip reads the model's weights from its memory for every token it writes. A language model writes one token at a time. In a standard model, each token needs all those billions of numbers read again, and the chip does only a small amount of maths on them each step. Most of the wait sits in those reads.

NVIDIA describes this stage as memory-bound, which means the speed of the reads sets the pace while the compute units wait. A faster chip with the same memory speed barely helps one user. The rule of thumb I use is memory bandwidth divided by the bytes read for each token. It leaves out compute on purpose, and it holds while the reads are the bottleneck.

The fixes all work on the reads. Use smaller weights, so there are fewer bytes to read. Batch many users, so one read of the weights serves all of them. Let the attention heads share one set of keys and values, as multi-query attention does. Or buy a card with more bandwidth.

I would also name the limits. Batches run into a memory limit, because each user's stored notes, the cache, take their own memory and grow with every reply. A rule of thumb is not a benchmark, so I measure on the real workload before I promise a number.

## What is memory bandwidth, in plain words?

A language model reads the whole input once, then writes its answer one token (a short piece of a word) at a time. In a standard model, every token it writes needs a fresh pass over the model's weights, the billions of numbers it learned in training.

A GPU keeps those weights in its own memory. Memory bandwidth is how many bytes per second that memory can hand to the chip. Think of a hospital ward pharmacy: the nurse prepares each dose quickly, but every dose needs a trip to the store room, and the trolley carries only so much per trip. The trolley sets the pace, not the nurse.

A bank's internal policy assistant has the same shape. Its team bought a card with far more maths power and saw no faster replies for one user, because the trolley was still the limit.

- **Weights:** The billions of learned numbers that make up the model.
- **Memory bandwidth:** How many bytes per second the card's memory can deliver to the chip.
- **Decoding:** Writing the output one token at a time, after reading the prompt.
- **Compute:** The chip's maths units, which do the arithmetic on the numbers.
- **Token:** A short piece of a word that the model reads and writes one at a time.

## Why does each new token read the whole model?

Decoding writes the answer one token at a time. NVIDIA's 2023 inference blog puts it this way: "the LLM generates output tokens autoregressively one at a time, until a stopping criteria is met." Autoregressive means each new piece depends on the pieces before it.

In a dense model, the standard kind, each step uses the whole model, so the chip must read every weight for that step. NVIDIA says decoding is like a matrix-vector operation (one big table of numbers times one short list) that underuses the GPU's compute compared with the prefill phase, the stage that reads your whole prompt at once. In plain words, the chip has far more maths capacity than one token needs.

*Diagram, One decode step, one token: One decode step, in a simplified picture of a dense model. The model's weights sit in the card's memory, and each token needs all of them read. The chip's maths waits for those reads, and then the next token comes out.*
1. A dense model reads all weights per token.
2. The maths can only run on the data that has arrived.

## Why doesn't a faster chip help one user?

- **Prefill: The whole prompt at once.** One large parallel pass keeps the chip's maths busy. Adding compute helps this stage.
- **Decode: One token per step.** Each step reads the weights again, and the chip waits on those reads. Adding compute does little here.
- **The ceiling: Bandwidth over bytes read.** Roughly, one user's speed is memory bandwidth divided by the bytes read per token.

The rule of thumb is my own working model, and it holds while reads are the bottleneck, which is the usual case for one reply. NVIDIA's 2023 inference blog says it plainly: "In other words, this is a memory-bound operation."

NVIDIA's 2022 Hopper post gives a real figure for the read side. It says the H100 SXM5 delivers over 3 TB/sec of memory bandwidth.

> "The H100 SXM5 GPU is the world's first GPU with HBM3 memory, delivering over 3 TB/sec of memory bandwidth" (NVIDIA, Hopper architecture post)
>
> "In other words, this is a memory-bound operation." (NVIDIA, inference optimization post)

## How do you raise the speed ceiling?

Each lever either cuts the bytes read for each token or spreads one read across more users.

1. **Use smaller weights:** Store each weight in fewer bits, such as 8-bit or 4-bit instead of 16-bit. Half the bytes gives roughly double the ceiling, but accuracy can drop, so test on your own tasks.
2. **Batch many users:** Batching means one pass over the weights serves several users' requests at once. NVIDIA's 2023 inference blog says "The simplest way to improve GPU utilization, and effectively throughput, is through batching."
3. **Share keys and values:** Keys and values are the stored notes each token looks back at. Multi-query attention lets all the attention heads share one set, so each token reads less. The model must be trained or fine-tuned with it, and NVIDIA notes a potential accuracy drop.
4. **Buy more bandwidth:** A newer card raises the read speed itself, and the ceiling moves up with it.

*Diagram, Ways to raise tokens per second: Two routes for one card. Fewer bytes for each token raise each reply's speed ceiling. Sharing one read across more users raises the total tokens per second.*
1. Cut the bytes each token reads.
2. Or spread one read across more users.
3. Fewer bytes raise each reply's ceiling.
4. Shared reads raise total tokens per second.

Batching has a limit. NVIDIA warns that "Batch sizes, however, can only be increased up to a certain limit, at which point they may lead to a memory overflow."

> "Since multiple requests use the same model, the memory cost of the weights is spread out." (NVIDIA, inference optimization post)
>
> "greatly reducing the size of these tensors and hence the memory bandwidth requirements of incremental decoding" (The multi-query attention paper)

## What does the sizing sum look like?

Here is a made-up case. A bank runs an internal policy assistant on one GPU card. Its model has 8 billion weights. At 16-bit, each weight takes 2 bytes, so the weights fill 16 GB. The card is rated at about 3 TB, or 3,000 GB, per second.

The team bought a card with much more maths power and expected faster answers. For one user, the ceiling did not move, because each token still reads all 16 GB. The script below prints the ceiling for three weight sizes.

```python
# Made-up numbers for a bank's policy assistant on one GPU card.
# Ceiling for one reply: each new token reads every weight once.
BANDWIDTH_GB_PER_S = 3000  # a card rated near 3 TB per second
PARAMS_BILLIONS = 8  # a made-up model with 8 billion weights

def weights_gb(bytes_per_weight):
    return PARAMS_BILLIONS * bytes_per_weight  # billions x bytes = GB

def tokens_per_second(model_gb):
    # Compute speed is not in this sum: the reads set the pace.
    return BANDWIDTH_GB_PER_S / model_gb

for name, size in [("16-bit", 2), ("8-bit", 1), ("4-bit", 0.5)]:
    gb = weights_gb(size)
    one = tokens_per_second(gb)
    print(f"{name}: {gb:.0f} GB, one reply about {one:.0f} tokens/s, 32 users together at best about {32 * one:.0f} tokens/s")
```

Output:

```text
16-bit: 16 GB, one reply about 188 tokens/s, 32 users together at best about 6000 tokens/s
8-bit: 8 GB, one reply about 375 tokens/s, 32 users together at best about 12000 tokens/s
4-bit: 4 GB, one reply about 750 tokens/s, 32 users together at best about 24000 tokens/s
```

The numbers set a ceiling. Real replies run slower, since the keys and values also need reads and the batch has a memory limit. The pattern still holds: halving the bytes doubles the ceiling, and compute never enters the sum.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] Decoding makes one token per step, and each step reads the model's weights.
- [ ] Memory bandwidth, the read speed, sets the ceiling for one user.
- [ ] More compute alone does little for one reply.
- [ ] Fixes: smaller weights, batching, shared keys and values, more bandwidth.
- [ ] Honest limits: batches hit a memory cap, and the ceiling is a rule of thumb.
- [ ] Measure on your own workload before promising a number.

**Common traps**

- Trap: "A faster GPU gives each user faster replies." Better: Only if the reads speed up too. For one reply, memory bandwidth sets the ceiling, so compare that first.
- Trap: "Batching makes each user's reply faster." Better: It raises total tokens per second from the card. One user's stream does not get faster, because each step still waits on the same weight reads.
- Trap: "Smaller weights are always free." Better: They cut the bytes read, but accuracy can drop. Test the smaller version on your own tasks.

## Can you spot the bottleneck?

**Spot the bottleneck:** A bank's assistant is slow for one user, and the GPU dashboard shows memory bandwidth near its limit while compute units sit at 25%. Which explanation fits?

A. Compute is maxed out, so the card needs more maths units.
B. Each reply waits on memory reads, so the bandwidth sets the pace.
C. The office network is too slow for the card's maths.
D. The temperature setting is too high, which slows each step.

**Answer:** B. Low compute use with a slow reply points at memory reads. More compute would not fix that. Check memory bandwidth, shrink the weights, or serve more users per card to raise total throughput.

**Quick check:** A team wants each user's reply to stream faster on the same card. Which change raises the speed ceiling?

A. Fewer users on the card
B. Smaller weights, such as 8-bit
C. A bigger context window
D. A faster CPU in the server

**Answer:** B. Fewer bytes per weight means fewer bytes read per token, so the ceiling rises. The other changes do not reduce the reads.

## Can you answer these from memory?

**Flash cards**

- **What limits one user's decode speed?** Memory bandwidth: how fast the weights can be read from GPU memory for each token.
- **Why is decode memory-bound?** In a dense model, each token reads the whole model, and the maths on those reads is small by comparison.
- **Does more compute speed up one reply?** Very little. The reads set the pace for one stream.
- **What does batching do?** One read of the weights serves many users, so total tokens per second rise.
- **How does multi-query attention help?** Heads share keys and values, so each token reads fewer bytes.
- **Where does the ceiling come from?** Roughly bandwidth divided by bytes read per token. A rule of thumb only.

## Likely follow-up questions

- Q328 Does a 70B model fit on one 80GB GPU? https://designervenkat.online/interview/ai/does-a-70b-model-fit-on-one-80gb-gpu
- Q329 Tensor vs pipeline parallelism? https://designervenkat.online/interview/ai/tensor-vs-pipeline-parallelism
- Q341 How do you measure GPU utilisation? https://designervenkat.online/interview/ai/how-do-you-measure-gpu-utilisation
- Q055 What is the KV cache, and why does it speed up generation? https://designervenkat.online/interview/ai/what-is-the-kv-cache
- Q065 Prefill vs decode phases? https://designervenkat.online/interview/ai/prefill-vs-decode-phases
- Q319 What is PagedAttention / vLLM? https://designervenkat.online/interview/ai/what-is-pagedattention-vllm
