← Chapter 13: CPU-style caches? Chapter 15: Designing an LLM →
date 28 / jun / 26
mtwtfss
PUTTING IT TOGETHER — Chapter 14 index home

The memory wall & HBM

*worked out from first principles*

Here's the quiet crisis sitting underneath every AI chip. The compute keeps getting faster, roughly doubling every couple of years, while the memory feeding it barely moves.

The cores race ahead, the data delivery crawls, and the gap between them keeps widening. That growing gap has a name, the memory wall, and it is the single biggest problem in modern hardware. Understanding why memory can't just keep up with compute, and the strange engineering trick used to dodge it, explains the shape of every AI chip being built right now.

The Problem: Fast Compute vs Slow Memory

Start with the obvious question. Compute speed keeps climbing, so why can't memory speed climb with it? The answer is that they're limited by two different things.

Compute gets faster because we keep shrinking transistors. A smaller transistor switches faster, so packing more, tinier transistors onto a core makes it quicker. That scaling has held for decades.

Memory is bound by something that doesn't shrink the same way. The data has to travel out of the memory chip through physical metal wires, and a wire has a hard ceiling on how much it can carry. You cannot shrink a wire endlessly the way you shrink a transistor, because past a point the path just chokes. Picture a factory with a machine inside that can sew ten thousand garments a second, but the only door into the factory fits two rolls of cloth at a time. It doesn't matter how fast the machine is. The door is the limit, and the machine sits half-idle waiting for material.

There's a second, deeper reason memory itself runs slow, down at the level of how a memory chip stores a bit. Inside, each bit lives in a microscopic capacitor, a tiny bucket of charge. Full bucket is a 1, empty bucket is a 0.

Now here's the trap. When we shrink the memory chip to fit more bits, those buckets get tinier too. A tiny bucket holds very little charge, and that charge leaks out fast. If you try to read and refill these tiny leaky buckets at very high speed, the chip starts confusing whether a bucket held a 1 or a 0. So to keep the data reliable, you simply cannot push the memory's internal speed past a certain point. The memory is slow from the inside out, by physics, not by laziness.

The Escape: High Bandwidth Memory (HBM)

So you have a machine that won't stop getting faster bolted to a supply line that physically refuses to speed up. And the cruel part is that buying a faster chip makes this worse, not better. Double the core speed and you haven't fixed the supply, you've just doubled how fast the cores starve waiting on it. Faster compute against fixed delivery means more idle silicon, not less.

Now the clever escape. If you can't make memory run faster, you make a huge crowd of it walk together. That's the whole idea behind High Bandwidth Memory (HBM), and it works by changing the physical layout in three ways.

  • First, it stacks the memory vertically. Old memory chips were scattered flat across the board, spread out and far away. High Bandwidth Memory takes those chips and stacks them into a tower, one on top of another, like a building instead of a sprawl. That saves space and shortens distances.
  • Second, it moves the tower right next to the compute. Instead of sitting far off on the board with a long road between them, the memory tower is placed on the same base as the GPU, packed in beside it. The distance the data has to travel collapses to almost nothing.
  • Third, and this is the real trick, it replaces a few long wires with thousands of tiny vertical ones. Ordinary memory talks to the chip through a relatively narrow path. High Bandwidth Memory drills thousands of microscopic vertical channels straight through the stacked silicon, so instead of a thin road you get an absurdly wide one. Each individual wire is still slow, bound by the same physics as before. But when thousands of slow wires carry data side by side, the total flood is enormous. This is the principle in one line: if you can't run faster, walk together in a massive crowd.
Traditional Flat RAM "The Narrow Door" Fast GPU Flat Layout Narrow Bus Long distance. Low bandwidth. GPU starves for data. High Bandwidth Memory (HBM) "The Vertical Crowd" Silicon Base (Interposer) Fast GPU Logic Die HBM Stack Thousands of vertical wires Zero distance. Massive bandwidth.

The AI Catch: Training vs Inference

And this is exactly why it matters most for AI, specifically for the moment a model answers you.

There's a hidden tragedy in how a large language model generates text. To produce each single word, the chip has to pull the model's entire set of weights, an enormous amount of data, from memory into the cores. The math to pick the next word is tiny. The data movement to do it is gigantic.

So generating text is brutally memory-bound, the cores do a sliver of math and then sit waiting on a mountain of data to arrive. Without wide memory, those expensive tensor cores would sit mostly idle, starved, and the model would spit out words painfully slowly. The wide memory is the only reason a model can answer you smoothly instead of stalling on every word.

Worth separating two AI phases here, because the wall hits them differently. Training a model is often compute-bound. You feed it huge batches of data at once, the cores grab that data and multiply it an enormous number of times, so they're running flat out and the math is the bottleneck. But Inference, the answering phase, is memory-bound, because each new word forces another full sweep of the weights out of memory. The same chip, doing two different jobs, gets choked by two different limits.

The Footnote: Cost and Rigidity

One honest footnote, because it explains why this fancy memory isn't in everything. High bandwidth memory is expensive and rigid. Stacking those towers and aligning them onto a shared silicon base beside the GPU is delicate, error-prone manufacturing, and one slip ruins the whole part, which is why it costs several times what ordinary memory does.

And because it's fused to the GPU at the factory, you can't upgrade it later the way you swap sticks of RAM in a normal PC. So it lives where the bandwidth is worth the price, in the AI chips fighting the wall, and not in your laptop.

↳ The General Takeaway

The memory wall isn't an engineering failure waiting to be fixed, it's a physics limit baked into wires and capacitors that won't scale like transistors do.

Compute will keep sprinting ahead, and memory will keep being the thing that decides whether all that compute actually gets used. The answer wasn't to make memory faster, because we can't. It was to bring it closer, stack it taller, and connect it with thousands of wires at once so a crowd of slow lanes becomes one massive flood.

The chip didn't beat the wall. It learned to walk around it.