Library article / ai-computing
Why AI Needs GPUs and Memory: The Roles of CPUs, GPUs, and HBM
How CPU latency, GPU throughput, RAM, VRAM, HBM, training state, inference, and the KV cache shape AI computers—and where computing goes next.
7 min read
Get it in 30 seconds
Behind one short response to a prompt, CPUs, GPUs, memory, and networks perform different jobs while moving vast amounts of data.
A useful mental model
Picture the CPU as a stage manager making control decisions, the GPU as a large ensemble repeating structured work in parallel, memory as the worktables holding scores and intermediate results, and interconnects as the transport routes.
Where the analogy stops
This analogy explains roles, not a universal ranking. Real performance changes with the model, precision, batch, software, memory capacity, bandwidth and latency, communication, and power; adding GPUs or memory does not always make a workload faster.
Follow the story in three steps
You will be able to explain CPU, GPU, and memory strengths without one speed league table, and locate AI bottlenecks across the whole system.
Need a term? →Article map13 chapters
01The 30-second answer: CPUs, GPUs, and memory play different roles
| Element | Strength | Typical AI-system role |
|---|---|---|
| CPU | Low latency for a few threads, complex branching, broad compatibility | OS, I/O, preprocessing, scheduling, accelerator control |
| GPU / AI accelerator | High throughput across many parallel operations | Matrix and tensor work, training, batched inference |
| Memory | A hierarchy of capacity, bandwidth, and latency | Weights, activations, gradients, optimizer state, and KV cache |
| Interconnect | Moves data among devices | Synchronizing and distributing work across accelerators |
A GPU is not always faster than a CPU, and more memory does not make a model smarter. Workload, software, numerical precision, and data movement must be compared together.
02Look at the shape of the work, not a performance ranking
Latency is the time to finish one job; throughput is the amount completed per unit time. CPUs emphasize fast response along one or a few complex flows. GPUs emphasize the aggregate rate of many similar flows.
Small inputs, branching, sequential dependencies, or host-device transfers can leave GPU lanes idle. Repeated processing of large matrices can let many GPU lanes outperform a small number of powerful CPU cores in aggregate. The first question is not which processor is “better,” but how regularly the work can be divided.
03CPU strengths: latency, branching, and control
Many modern high-performance CPU cores combine branch prediction, out-of-order execution, large caches, and broad instruction sets to handle changing control flow with low latency. They suit responsive work across the OS, networking, storage, databases, compression, tokenization, data loaders, and error handling.
CPUs also have SIMD, matrix extensions, and multiple cores, and they can run AI inference. A small model, tiny batch, strict latency target, or expensive accelerator transfer can make that rational. CPUs remain responsible for preparing jobs, launching kernels, managing I/O, and handling failure even in accelerator-heavy systems.
04GPU strengths: parallelism and throughput
A GPU assigns one kernel across many lightweight threads to sustain high throughput on regular arithmetic. The model that grew from pixel and vertex work maps well to matrix and tensor operations over broad data. Dedicated matrix units can use lower precision to execute the multiply-accumulate patterns common in AI.
Branch divergence, tiny jobs, frequent CPU round trips, or insufficient memory delivery can leave those lanes waiting. Hardware parallelism is usable only when compilers, libraries, and ecosystems such as CUDA support it. Peak FLOPS or TOPS alone cannot determine application performance.
05Why AI uses so much matrix math
Many neural-network layers multiply an input vector by a weight matrix and then apply nonlinear transformations. In Transformers, attention and feed-forward networks contain large matrix multiplications. Repeating the same multiply-accumulate structure makes them suitable for GPU and TPU parallel units.
AI is not only matrix multiplication. Normalization, activation, sampling, routing, preprocessing, and communication matter too. Training differs from inference, and prompt prefill differs from token-by-token decode. Benchmarks need aligned models, precision, batch, quality targets, and scenarios.
06Memory strengths: separate capacity, bandwidth, and latency
In conventional architectures memory is not itself the arithmetic engine; it stores data and supplies it to one. Capacity determines what fits at once, bandwidth how many bytes move per second, and latency how long a request waits. These are different: large capacity can be slow, while wide bandwidth does not erase random-access latency.
| Layer | Location and role |
|---|---|
| Registers / on-chip SRAM / cache | Small, close to arithmetic, and fast |
| VRAM / HBM | Large accelerator-local memory; HBM uses stacking and a wide interface for bandwidth |
| System DRAM | CPU-side main memory with capacity and generality |
| SSD / storage | Larger and slower than execution memory; used for loading and offload |
07Training must store more than weights
Training holds gradients, optimizer state, and forward-pass activations in addition to model parameters. The amount changes with precision and optimizer, so parameter count multiplied by bytes is not enough. ZeRO partitions optimizer state, gradients, and parameters precisely because this memory burden constrains system design.
Mixed precision uses lower precision for some computation and storage, improving throughput and capacity while requiring numerical-stability techniques. Activation checkpointing saves memory by recomputing selected activations, trading memory for compute. Model parallelism expands aggregate capacity but adds communication and synchronization.
08Inference holds weights and a growing KV cache
LLM inference repeatedly reads model weights while generating tokens. Autoregressive decode may do little new arithmetic per step and become bandwidth-constrained. Prompt prefill and larger batches can have higher arithmetic intensity, so “all AI inference is memory-bound” is too broad.
The KV cache preserves attention keys and values instead of recomputing them and grows with layers, tokens, and concurrent requests. PagedAttention proposed virtual-memory-style management to reduce wasted contiguous allocation. Long context is therefore a memory-capacity and bandwidth question as well as an algorithmic capability.
09How many gigabytes just to place 7B or 70B weights?
A transparent weights-only calculation at two bytes per FP16 or BF16 parameter gives about 14 GB for 7 billion parameters and 140 GB for 70 billion. A theoretical packed 4-bit weight body would be about 3.5 GB and 35 GB respectively. These are decimal gigabytes.
Real systems add quantization metadata, selected higher-precision values, runtime and allocator headroom, temporary buffers, and the KV cache. Training also adds gradients, optimizer state, and activations. This arithmetic is not a final GPU count; it is a lower-bound-style explanation of why capacity constrains placement.
10Fast arithmetic still waits when data cannot arrive
The Roofline model bounds performance by the smaller of peak compute and memory bandwidth multiplied by operational intensity—the operations performed per byte moved. A kernel that moves much data without enough arithmetic reaches the bandwidth roof even if more arithmetic units are added.
FlashAttention preserves the attention result while reducing reads and writes between HBM and on-chip SRAM. The memory did not “perform the computation”; the algorithm reduced the data movement needed for the same result. AI optimization increasingly asks where data can be reused, not only how many arithmetic operations are counted.
11With multiple GPUs, the interconnect becomes performance
Splitting a model or batch across accelerators moves gradients, activations, parameters, and token state. Fast chips spend time waiting if the interconnect is slow. Topology, collective communication, package, board, rack, storage, power, and cooling together form the AI computer.
MLPerf compares whole systems under defined models, quality targets, scenarios, divisions, and versions. That is more reproducible than lining up TOPS reported under different precision and software assumptions, though no benchmark represents every workload.
12Quantization, offload, and distribution are not free speed-ups
Quantization reduces bits per parameter and can save capacity and bandwidth, but it brings accuracy, calibration, kernel-support, and metadata trade-offs. Offloading to CPU memory or SSD can fit a larger model while increasing latency across PCIe or storage.
Sparsity, mixture-of-experts routing, distillation, and smaller models can reduce required compute, each with quality, routing, implementation, and task trade-offs. The best system is not automatically “the largest GPU”; it follows latency, throughput, quality, cost, energy, and data-governance requirements.
13Editorial perspective: the future is heterogeneous and data-movement-aware
This section is our interpretation. We expect the next era of computing to deepen heterogeneous systems rather than let one processor replace the rest: CPUs for flexible control and latency-sensitive work; GPUs, NPUs, and ASICs for suitable parallel kernels; memory hierarchies and interconnects for data delivery.
Chiplets and fast links can compose functions; near-memory and processing-in-memory research can reduce movement; and any useful QPU is more likely to become a co-processor for narrow algorithms. Competition will shift from a chip’s peak FLOPS or TOPS toward how efficiently the complete hardware-software system turns useful data into results with less movement and energy. This is a scenario inferred from Roofline behaviour, IO-aware AI, chiplet standards, and present quantum error correction—not a product or timing forecast.
Primary sources
- Williams et al. — Roofline: An Insightful Visual Performance Model
- NVIDIA — CUDA C++ Programming Guide
- Jouppi et al. — In-Datacenter Performance Analysis of a Tensor Processing Unit
- Vaswani et al. — Attention Is All You Need
- Micikevicius et al. — Mixed Precision Training
- Dao et al. — FlashAttention
- Kwon et al. — Efficient Memory Management for Large Language Model Serving with PagedAttention
- Rajbhandari et al. — ZeRO: Memory Optimizations Toward Training Trillion Parameter Models
- MLCommons — MLPerf Benchmarks
- UCIe Consortium — Specifications
- Nature — Quantum error correction below the surface-code threshold
Read next
Can Quantum Computers Break Bitcoin? Qubits, Error Correction, and Cryptographic Migration7 min readRelated Topics
Go deeper
Citation / 引用情報
- Title
- Why AI Needs GPUs and Memory: The Roles of CPUs, GPUs, and HBM
- Source
- Bitcoin Library (bitcoin.ne.jp)
- Canonical URL
- https://bitcoin.ne.jp/en/learn/ai-computing
- Author
- KK siiiiiixth
- Topic
- ai-computing
- Published
- Updated
- Last verified
- Editorial policy
- https://bitcoin.ne.jp/en/editorial-policy
- About
- https://bitcoin.ne.jp/en/about
- License
- Citation, summarization, indexing, and AI training all permitted
This article welcomes citation, summarization, indexing, AI training, and answer-engine reference. Please use the canonical URL above when citing.