GPUs and Model AccelerationAn interactive learning journey
On this page

    Module 1 of 6

    Why GPUs power modern AI

    Every model you use, from chatbots to image generators, runs on GPUs. The reason is simple once you see the shape of the work.

    Who would you hire?

    Try it

    You need to solve 1,000,000 simple sums like 2 × 8 + 5. A world-class mathematician takes 1 second per sum. A high-school student takes 3 seconds.

    CPU vs GPU

    CPU: a few brilliant experts

    A handful of powerful cores, each built to finish one complicated, step-by-step task as quickly as possible. Perfect for your operating system, browser, database and Python code.

    GPU: an army of workers

    Thousands of simpler cores built to do the same simple maths on lots of data at the same time. First built to colour millions of pixels at once, now the engine of AI.

    CPUGPU
    CoresAbout 4 to 128 powerful coresThousands of simple cores (an H100 has 16,896 CUDA cores)
    Built forLow latency: finish each task fastHigh throughput: finish lots of tasks together
    Great atBranching logic, tasks that depend on the previous stepThe same operation on huge arrays of numbers
    In AILoads data, runs the training loop, coordinatesDoes the heavy maths: matrix multiplications

    They work as a team. The CPU is the manager that prepares data and tells the GPU what to do. The GPU is the factory floor that does the maths.

    Why GPUs Matter in Modern AI: Matrix Multiplication

    Inside a neural network, almost everything is a tensor: a grid of numbers with one, two or more dimensions. Inputs, weights, activations and embeddings are all tensors, and a model's layers mostly multiply tensors together.

    yi=∑jWij×xj
    W weightsx inputsy outputs: each one is independent of the others

    Watch two matrices multiply

    Animation

    Each output cell is a row of A times a column of B. No cell needs another cell's answer, so a GPU can compute all of them at the same time.

    Multiplying a 4,096 × 4,096 weight matrix by one input vector takes about 16.8 million multiply-and-adds, and none of the outputs depends on another. A CPU works through them a few at a time. A GPU hands them out to thousands of cores at once.

    Inside an NVIDIA GPU

    A GPU is organised in layers, like a company with departments and teams.

    The GPU

    Streaming Multiprocessors (SMs)

    The departments. An H100 has 132 of them, each running many calculations at once.

    CUDA cores

    Inside each SM: general-purpose units that multiply and add.

    Tensor Cores

    Specialists for matrix multiplication, built for low precision like BF16 and FP8. They do most of the work in AI.

    HBM (VRAM)

    High Bandwidth Memory stacked next to the chip. Holds the model and its data.

    How work is split up

    PyTorch operation
    →
    CUDA kernel
    a function that runs on the GPU
    →
    Thousands of threads
    tiny units of work
    →
    Warps of 32 threads
    run each instruction together

    You rarely write kernels yourself: PyTorch and NVIDIA's libraries launch them for you. But this picture explains why GPUs love big, regular blocks of work.

    The memory ladder

    Not all GPU memory is equal. The closer memory sits to the cores, the faster and smaller it is.

    RegistersInside each core; holds the numbers being worked on right nowfastest, tiniest
    L1 / shared memory (SRAM)Inside each SM; FlashAttention keeps its tiles herevery fast, KBs per SM
    L2 cacheShared across the whole chipfast, tens of MB
    HBM (VRAM)Where the model and its data liveslowest, 16 to 192 GB

    Capacity is how many boxes the warehouse holds. Bandwidth is how fast boxes move in and out. AI needs both, and running out of the first is the famous CUDA out of memory error.

    Connecting GPUs

    PCIe

    The standard road between devices in a computer. Fine for one GPU; slow for GPUs that constantly swap data.

    NVLink and NVSwitch

    NVIDIA's high-speed highways between GPUs, around 900 GB/s on an H100. Essential for multi-GPU training (Module 5).

    Meet some real GPUs

    You will see these names in papers, cloud consoles and job adverts. The numbers are approximate and vary by version.

    GPUGenerationMemoryBandwidthKnown for
    T4Turing (2018)16 GB~320 GB/sThe free GPU in Google Colab; great for learning and small inference
    RTX 4090Ada Lovelace (2022)24 GB~1 TB/sA consumer gaming card that many researchers use on a desk
    V100Volta (2017)16 or 32 GB~900 GB/sThe first GPU with Tensor Cores
    A100Ampere (2020)40 or 80 GB1.6 to 2 TB/sThe workhorse of large-scale AI for years; 312 TFLOPS in BF16
    H100Hopper (2022)80 GB~3.35 TB/sBuilt for transformers: FP8 and the Transformer Engine; about 990 TFLOPS in BF16
    H200Hopper (2024)141 GB~4.8 TB/sAn H100 with much more and faster memory, ideal for big models
    B200Blackwell (2024)192 GB~8 TB/sThe newest generation: more compute, memory and FP4 support

    NVIDIA isn't the only option. AMD makes data-centre GPUs like the MI300X (192 GB of HBM), and Google's TPUs are AI accelerators built around the same idea: lots of parallel matrix maths fed by fast memory. Each generation moves in the same direction: more compute, more memory, more bandwidth, faster links and lower precision.

    The GPU system in one picture

    Compute cores

    The workers. They do the calculations in parallel.

    VRAM (HBM)

    The warehouse. On AI GPUs this is HBM, the High Bandwidth Memory stacked next to the chip. It holds parameters, activations and everything else the model needs.

    Memory bandwidth

    The conveyor belt. Moves data between memory and the cores.

    A GPU is only as fast as its slowest part. Cores, memory and the conveyor belt all have to keep up.
    Ben with an idea

    So a GPU isn't "faster" at everything. It's faster at lots of simple maths at once, which is what AI needs. Next question: how much maths, and how much memory?