◆ AI All-in-One

Level 3 In-Depth AI · ML Engineering and Production

AI Hardware: GPUs, TPUs and Accelerators

The chips, memory and networks that AI runs on. Datacentre GPUs and TPUs compared, why memory bandwidth limits more than raw FLOPs (the roofline model), the memory hierarchy from on-chip SRAM to the network, interconnects, and the arithmetic of what training a frontier model takes.

Level
●●●●● Intermediate
Reading
13 min
To learn it well
1 hour to read
↗ Plan a path here

Read first

GPUs and Why AI Needs Them

This leads to

The Energy Cost of AI
The full path from zero — 3 concepts before this one
  1. Vectors
  2. Matrices and Matrix Multiplication
  3. GPUs and Why AI Needs Them
  4. AI Hardware: GPUs, TPUs and Accelerators

Read them roughly in this order. See it on the concept map →

Why it matters

Modern AI is as much a hardware story as an algorithms story. The The Transformer became dominant partly because it maps beautifully onto GPUs. Training a frontier model takes tens of thousands of chips for months and tens of megawatts of power. And the speed at which a chatbot types is set not by its arithmetic but by how fast its chips can read memory.

You don't need to design chips to benefit from understanding them. A few numbers — FLOPs, memory capacity, memory bandwidth and interconnect bandwidth — explain why Quantization speeds up inference, why batching is essential, why Distributed Training uses the layouts it does, and why FlashAttention-style tricks matter. They also let you estimate cost and time before you spend money. This chapter builds on GPUs and Why AI Needs Them, which introduced cores, VRAM and CUDA.

The intuition

Picture a large kitchen. The cooks are the arithmetic units: thousands of them, very fast. The ingredients sit in a warehouse down the road (the GPU's main memory). A small counter next to the cooks holds what they're working on right now (on-chip memory). A road links the kitchen to the warehouse, and its width is the memory bandwidth.

If each ingredient is used for one quick chop and then discarded, the cooks spend most of their time waiting for the van. Hiring more cooks doesn't help; you need a wider road. If each ingredient goes into many dishes, as when the same sack of flour feeds a hundred loaves, the cooks are the bottleneck and the road sits idle.

Which situation you're in depends on how much work you do per byte fetched. This is the single most useful idea for reasoning about AI hardware.

SRAMon chip HBMGPU memory CPU DRAMhost memory 19 TB/sabout 20 MB in total 1.5 TB/s40 GB 12.8 GB/smore than 1 TB the tile beingcomputed right now weights, activations,KV cache datasets, offloadedweights bigger, slower, cheaper per GB NVIDIA A100 (40 GB) figures as given in the FlashAttention paper (Dao et al., 2022)
Fig. 1 The memory hierarchy of an NVIDIA A100 GPU and its host, as given in the FlashAttention paper. On-chip SRAM is tiny (about 20 MB in total) but very fast (about 19 TB/s). HBM holds 40 GB at about 1.5 TB/s. CPU memory is far larger but is reached at only about 12.8 GB/s. Each step down is roughly ten to a hundred times bigger and slower.

Key idea An accelerator is a huge calculator attached to a comparatively narrow memory pipe. Whether a job is limited by arithmetic or by memory depends on its arithmetic intensity: FLOPs done per byte moved. Most AI speed tricks are ways of moving fewer bytes.

How it works

What an accelerator is

An accelerator is a chip specialised for the dense linear algebra at the heart of neural networks. Three families dominate (as of late 2026):

  • NVIDIA GPUs (A100, H100, H200, the Blackwell B200 and B300, and the Rubin generation, which began shipping to early customers in late 2026 with 288 GB of HBM4 per GPU). General-purpose parallel processors with tensor cores for matrix maths and the CUDA software ecosystem. They are by far the most widely used.
  • Google TPUs (Tensor Processing Units, v4, v5e, v5p, v6e "Trillium", v7 "Ironwood"). Built around a systolic array: a grid of multiply-add units through which data flows in rhythm, each number being reused by a whole row or column of units without returning to memory. They are available only through Google Cloud and are used to train Google's Gemini models.
  • Others. AMD's Instinct GPUs (MI300X, MI325X, MI355X) compete directly with NVIDIA using the ROCm software stack. AWS has Trainium and Inferentia chips. Cerebras builds wafer-scale chips with very large on-chip memory. Groq and others build chips aimed at fast inference.

The numbers that matter

Headline specifications as published by the vendors (dense, without the "sparsity" doubling some datasheets use):

Chip (year) 16-bit dense TFLOPS Memory Memory bandwidth Power
NVIDIA A100 SXM 80GB (2020) 312 (BF16) 80 GB HBM2e 2.0 TB/s 400 W
NVIDIA H100 SXM (2022) about 989 (BF16) 80 GB HBM3 3.35 TB/s up to 700 W
NVIDIA H200 SXM (2024) about 989 (BF16) 141 GB HBM3e 4.8 TB/s up to 700 W
NVIDIA B200 (2024–25) about 2,250 (BF16)¹ 180 GB HBM3e about 8 TB/s about 1,000 W
AMD MI300X (2023) about 1,307 (BF16) 192 GB HBM3 5.3 TB/s 750 W
Google TPU v4 (2021) 275 (BF16) 32 GiB HBM2 1.2 TB/s
Google TPU v5p (2023) 459 (BF16) 95 GiB HBM 2.8 TB/s
Google TPU v7 Ironwood (2025) 4,614 (FP8) 192 GiB HBM 7.4 TB/s

¹ Derived from NVIDIA's DGX B200 system figures (8 GPUs, 1,440 GB, 64 TB/s total). Treat all these numbers as approximate and check the vendor's current datasheet. Each generation brings roughly two to three times more low-precision FLOPs and a smaller increase in bandwidth.

Three lessons are already visible. Memory per chip has grown from 80 GB to around 200 GB, which is why a 70B model in 16 bits (140 GB) now fits on one chip. Bandwidth has grown more slowly than compute. And lower-precision formats (FP8, FP4) are where each generation's biggest headline numbers come from (Mixed Precision Training, Quantization).

HBM and the memory hierarchy

Accelerators use HBM (high-bandwidth memory): stacks of DRAM chips placed right next to the processor in the same package and connected by thousands of wires. HBM is why a GPU's memory is fast (terabytes per second, against roughly 100 GB/s for a laptop's main memory). It is also expensive and limited in size.

Inside the chip is SRAM: registers, caches and the per-core scratchpad that CUDA calls shared memory. It is roughly ten times faster than HBM but thousands of times smaller. The levels together form the memory hierarchy in the figure above. Fast kernels are designed to load data from HBM into SRAM once, do as much work as possible there, and write back only the result. FlashAttention (2022) is the famous example: by computing attention in tiles that fit in SRAM, it avoids writing the large attention matrix to HBM at all, and runs several times faster despite doing the same arithmetic.

The roofline model

The roofline model turns the kitchen analogy into numbers. Arithmetic intensity is the number of floating-point operations a computation does per byte it moves to or from memory:

I=FLOPsbytes movedI = \frac{\text{FLOPs}}{\text{bytes moved}}

The achievable speed is the lower of two ceilings, the compute peak and what memory can feed:

attainable FLOP/s=min⁡(peak FLOP/s,  I×memory bandwidth)\text{attainable FLOP/s} = \min\big(\text{peak FLOP/s},\; I \times \text{memory bandwidth}\big)

The two ceilings meet at the ridge point I∗=peak FLOP/s/bandwidthI^* = \text{peak FLOP/s} / \text{bandwidth}. Below it you are memory-bound, above it compute-bound. For an H100: 989×1012/3.35×1012≈295989 \times 10^{12} / 3.35 \times 10^{12} \approx 295 FLOPs per byte.

0.1 1 10 100 1000 10000 0.1 1 10 100 1000 arithmetic intensity (FLOPs per byte, log scale) attainable TFLOPS (log) memory roof: 3.35 TB/s compute roof: 989 TFLOPS ridge ≈ 295 vector add 0.6 TFLOPS decode, batch 1 3.4 TFLOPS decode, batch 64 214 TFLOPS big matmul / prefill compute-bound Roofline of an NVIDIA H100 SXM (dense BF16)
Fig. 2 A roofline for an NVIDIA H100 (BF16): attainable TFLOPS against arithmetic intensity, both on log scales. The sloped part is the memory bandwidth limit (3.35 TB/s); the flat part is the compute peak (989 TFLOPS); they meet at about 295 FLOPs per byte. LLM decoding at batch 1 sits far down the slope, batch 64 is still memory-bound, and a large matrix multiplication reaches the flat roof.

Worked example: why LLM decoding is memory-bound. To generate one token, a model multiplies each weight matrix by a single vector. Each 16-bit weight (2 bytes) is used for one multiply and one add: 2 FLOPs per 2 bytes, an intensity of about 1. That is about 300 times below the H100's ridge point, so the arithmetic units are idle more than 99% of the time. Now batch 64 users together. Each weight, once loaded, is used for 64 users, so the intensity rises to about 64, and throughput rises almost 64-fold at nearly the same cost per step. That is the economic engine behind continuous batching. Processing a long prompt (prefill) uses each weight for every prompt token at once, so it is compute-bound, which is why prefill is fast per token and decoding is slow.

Interconnects

A single chip is not enough for training, so how chips talk matters as much as the chips themselves. An interconnect is the link between chips. There are two tiers:

  • Scale-up links connect a small group of chips with very high bandwidth. NVIDIA's NVLink gives each H100 900 GB/s to the other GPUs in its server through NVSwitch chips, and each Blackwell GPU 1.8 TB/s. The group that shares such links is the scale-up domain: 8 GPUs in an HGX H100 server, 72 in a GB200 NVL72 rack. TPUs connect directly to their neighbours with inter-chip interconnect (ICI) links in a 3D torus, which lets a v5p pod join up to 8,960 chips.
  • Scale-out networks connect thousands of servers: InfiniBand or high-end Ethernet (RoCE), typically 400 Gbit/s (about 50 GB/s) per GPU on H100-era clusters and 800 Gbit/s (about 100 GB/s) on Blackwell-era ones, as of late 2026. That is fast for a network, but still nearly twenty times slower than the NVLink of the same generation.

This bandwidth gap shapes Distributed Training: tensor parallelism, which communicates inside every layer, stays within the scale-up domain, while data parallelism, which communicates once per step, crosses the slower network.

What training a frontier model takes

Combine the training-compute rule of thumb (≈6ND\approx 6ND FLOPs for NN parameters and DD tokens, from Scaling Laws) with hardware numbers:

Worked example: Llama 3 405B. Meta reported training it on 15.6 trillion tokens with about 3.8×10253.8 \times 10^{25} FLOPs, on up to 16,384 H100 GPUs. Check the compute: 6×405×109×15.6×1012≈3.8×10256 \times 405 \times 10^9 \times 15.6 \times 10^{12} \approx 3.8 \times 10^{25}. ✓ Each H100 peaks at about 9.9×10149.9 \times 10^{14} BF16 FLOP/s, and Meta reported 38–43% utilisation. At 40%, the cluster delivers

16,384×9.9×1014×0.4≈6.5×1018 FLOP/s16{,}384 \times 9.9 \times 10^{14} \times 0.4 \approx 6.5 \times 10^{18} \text{ FLOP/s}

so the run needs 3.8×1025/6.5×1018≈5.9×1063.8 \times 10^{25} / 6.5 \times 10^{18} \approx 5.9 \times 10^6 seconds, about 68 days of pure computation. The GPUs alone draw about 16,384×700 W≈11.516{,}384 \times 700 \text{ W} \approx 11.5 MW, before cooling, CPUs and networking. If an H100 rents for roughly 2 to 4 US dollars per hour (a typical range in 2025), the GPU time alone is in the tens of millions of dollars.

Epoch AI, which tracks these numbers, has estimated that the compute used to train the largest models has grown by roughly four to five times per year since 2010. Much of that growth now comes from larger clusters rather than faster chips, which is why power and datacentres have become the binding constraints (The Energy Cost of AI).

In code

You can measure your own machine's roofline. This script times a large memory copy (bandwidth) and a large matrix multiplication (compute), then says where common operations fall:

import time
import torch

def best_time(fn, repeats=5):
    fn(); times = []
    for _ in range(repeats):
        t = time.perf_counter(); fn(); times.append(time.perf_counter() - t)
    return min(times)

# Memory bandwidth: copy a 400 MB array (read 400 MB + write 400 MB)
a = torch.ones(100_000_000); b = torch.empty_like(a)
t = best_time(lambda: b.copy_(a))
bandwidth = 2 * a.numel() * 4 / t
print(f"memory bandwidth   {bandwidth / 1e9:6.1f} GB/s")

# Compute: a large float32 matrix multiplication (2 n^3 FLOPs)
n = 4096
x, y = torch.randn(n, n), torch.randn(n, n)
t = best_time(lambda: x @ y)
flops = 2 * n**3 / t
print(f"matmul throughput  {flops / 1e9:6.1f} GFLOP/s")
print(f"ridge point        {flops / bandwidth:6.1f} FLOPs per byte")

# Where do common operations sit? (FLOPs per byte moved, float32)
ops = {"vector add": 1 / 12, "matrix-vector (LLM decode, batch 1)": 2 / 4,
       "matmul 4096 x 4096": 2 * n**3 / (3 * n * n * 4)}
for name, intensity in ops.items():
    bound = "compute" if intensity > flops / bandwidth else "memory"
    print(f"{name:<38} {intensity:8.2f} FLOPs/byte -> {bound}-bound")

# On an Apple-silicon laptop CPU:
# memory bandwidth    126.9 GB/s
# matmul throughput  1608.5 GFLOP/s
# ridge point          12.7 FLOPs per byte
# vector add                                 0.08 FLOPs/byte -> memory-bound
# matrix-vector (LLM decode, batch 1)        0.50 FLOPs/byte -> memory-bound
# matmul 4096 x 4096                       682.67 FLOPs/byte -> compute-bound

Even a laptop has the same shape as an H100, just with a lower ridge point (13 FLOPs per byte against about 295). On a GPU, add device="cuda" to the tensors and call torch.cuda.synchronize() inside the timed function, because GPU calls return before the work finishes.

Common pitfalls

  • Comparing peak FLOPs across datasheets. Some figures assume 2:4 structured sparsity, which doubles the number but rarely applies to real models. Some are FP8 or FP4, others BF16. Compare like with like.
  • Ignoring memory bandwidth. For LLM inference, a chip with more bandwidth often beats one with more FLOPs. Use the roofline to see which limit you hit.
  • Expecting peak utilisation. Real training reaches perhaps 30–50% of peak, inference decoding much less. Budget with realistic utilisation, not datasheet numbers.
  • Forgetting the interconnect. Eight GPUs in separate cloud machines on ordinary Ethernet will train a large model far slower than eight GPUs joined by NVLink.
  • Trusting old numbers. Hardware specs, availability and prices change every year. Date every figure you rely on and check it again before making a purchase or budget decision.

Watch out Hardware prices and rental rates move fast and differ a lot between providers, regions and contract terms. Any dollar figure in this chapter is a rough 2025 snapshot for building intuition, not a quote.

Where it leads

A bit of history

GPUs were built for video games. In 2009, Raina, Madhavan and Ng showed that GPUs could train deep belief networks many times faster than CPUs, and in 2012 AlexNet was trained on two consumer NVIDIA GTX 580 GPUs, a landmark for deep learning (A Short History of AI). NVIDIA then steered its datacentre chips towards AI. Tensor cores arrived with the V100 (2017), BF16 and TF32 with the A100 (2020), FP8 and the Transformer Engine with the H100 (2022), and FP4 with Blackwell (2024).

Google, facing a projected explosion of speech-recognition compute, built its first TPU for inference and deployed it in its datacentres from 2015. Jouppi and colleagues described it in 2017, reporting large speed and energy-efficiency gains over contemporary CPUs and GPUs on Google's workloads. Later TPU generations added training support and were joined into pods of thousands of chips. Since 2023 the demand for training and serving large language models has made AI accelerators one of the most valuable product categories in the world, and the limiting factors have shifted towards HBM supply, advanced chip packaging and electrical power.

Try it

  1. Run the script on your machine. Is your ridge point higher or lower than 12.7? What does that tell you about your CPU's balance of compute and memory?
  2. An 8B model in BF16 is 16 GB. Using the roofline, estimate the maximum tokens per second for one user on an H100 (3.35 TB/s) and on an H200 (4.8 TB/s).
  3. Redo the Llama 3 405B estimate assuming 30% utilisation and 8,192 GPUs. How many days of computation would it need?

Hint for 2: each generated token reads every weight once, so time per token ≈ model bytes ÷ bandwidth.

Check your understanding

5 quick questions. Pick an answer to see whether you were right and why. Your best score is saved on this device.

  1. LLM decoding at batch 1 has an arithmetic intensity of about 1 FLOP per byte. On an H100 with a ridge point near 295, what limits its speed?

  2. Why does batching 64 users together raise LLM decoding throughput almost 64-fold at nearly the same cost per step?

  3. A chip has a peak of 1,000 TFLOPS and 4 TB/s of memory bandwidth. Where is its ridge point?

  4. Why does FlashAttention run several times faster despite doing the same arithmetic?

  5. Eight GPUs in separate cloud machines on ordinary Ethernet train a large model much slower than eight GPUs in one NVLink server. Why?

Finished this chapter?

Learn more

Hand-picked courses, books, videos and tutorials for going deeper. See all resources →

Book

How To Scale Your Model

Google DeepMind · 2025 · Advanced · Free

A free online book on the systems view of LLMs: rooflines, TPUs and GPUs, sharding, parallelism strategies and inference, with worked problems.

Book

Machine Learning Engineering Open Book

Stas Bekman · Advanced · Free

A practitioner's open book on the hardware and software of training and serving large models: GPUs, networking, storage and debugging.

Article

Which GPU(s) to Get for Deep Learning

Tim Dettmers · 2023 · Intermediate · Free

A long, practical guide to how GPUs work for deep learning and how to choose one, including memory and tensor cores.

Article

Epoch AI

Epoch AI · Intermediate · Free

Data and research on trends in AI compute, data, models and hardware.

Facts checked as of 30 November 2026. Fast-moving details (products, prices, laws) change often. · Source: content/entries/mlops/ai-hardware.md