Search
Course outline
  1. 01How a computer works
    1. 1.1What is a computer?(completed)
    2. 1.2The CPU: the brain(completed)
    3. 1.3Memory: RAM vs storage(completed)
    4. 1.4How the CPU and memory work together(completed)
    5. 1.5What happens when you turn on a computer(completed)
  2. 02How the Internet works
    1. 2.1What is the Internet?(completed)
    2. 2.2Addresses and names: IP and DNS(completed)
    3. 2.3Packets: how information travels(completed)
    4. 2.4Client and server: opening a website(completed)
    5. 2.5Inside a busy server(completed)
    6. 2.6Why this matters for AI(completed)
  3. 03Introducing the GPU
    1. 3.1What is a GPU?(completed)
    2. 3.2CPU vs GPU(completed)
    3. 3.3The GPU's own memory: VRAM(completed)
    4. 3.4How the CPU and GPU work together(completed)
    5. 3.5Why GPUs suit AI(completed)
  4. 04Tensors and models
    1. 4.1What is a tensor?soon
    2. 4.2What is an AI model?soon
    3. 4.3Training vs inferencesoon
  5. 05Splitting work across GPUs
    1. 5.1Why split work across GPUs?soon
    2. 5.2Data parallelismsoon
    3. 5.3Tensor parallelismsoon
    4. 5.4Pipeline parallelismsoon
    5. 5.5Expert parallelismsoon
    6. 5.6Which to use whensoon
  6. 06Serving LLMs with vLLM
    1. 6.1What is LLM serving?soon
    2. 6.2Meet vLLMsoon
    3. 6.3Serving a model with vLLMsoon

Lesson 3.5

Why GPUs suit AI

AI is mostly huge piles of simple multiplications. A short preview of the maths to come.

beginner 4 min readChecked

In one line

AI models spend most of their time doing huge piles of simple multiply-and-add sums, arranged as matrix multiplication, and that is exactly the kind of work a GPU’s many workers do best.

Real-life analogy

Imagine the restaurant must work out the price of every dish on a giant menu for 1,000 different restaurants, each with its own ingredient prices.

For every dish at every restaurant, the sum is the same kind of thing: “amount of ingredient × its price, added up”. Each of those sums is easy, and none of them needs to wait for another.

Give one sum to each of your thousands of helpers and the whole menu is priced almost instantly. That is why AI loves GPUs.

Where the comparison stops working: pricing a menu is something you understand. An AI model’s numbers do not have an obvious meaning like “price” or “amount”; they are values the model learned during training. But the kind of sum is really the same: multiply, then add.

Diagram

NUMBERS IN×MODEL'S NUMBERS=ANSWER: 4 SMALL JOBS2×1 + 3×62×0 + 3×24×1 + 5×64×0 + 5×2Each answer box is just multiply-and-add, and none of them needs to waitfor the others. Give each box to a different GPU worker and they finish together.Real AI models do this with tables of thousands of rows and columns.23451062
Matrix multiplication: every answer box is an independent multiply-and-add job, perfect for many GPU workers at once.

Step by step

We now know what a GPU is good at. But what does an AI model actually do with all those workers? Let’s take a short peek at the maths. Don’t worry: it is only multiplying and adding.

Numbers in tables

An AI model works with numbers arranged in tables. A table of numbers is called a matrix (plural: matrices).

  • Your question is turned into numbers.
  • The model itself is mostly a huge collection of learned numbers (we will look at these properly in Module 4).

The key move: matrix multiplication

The most common thing an AI model does is multiply a table of input numbers by a table of the model’s numbers. This is called matrix multiplication.

Let’s do a tiny one, like the diagram:

Numbers in Model’s numbers
2, 3 / 4, 5 1, 0 / 6, 2

Each answer box takes one row from the left and one column from the right, multiplies them pair by pair, and adds the results:

  • top-left: 2×1 + 3×6 = 20
  • top-right: 2×0 + 3×2 = 6
  • bottom-left: 4×1 + 5×6 = 34
  • bottom-right: 4×0 + 5×2 = 10

That is it. Multiply, then add. This “multiply-add” is the most common operation inside neural networks.

Why this is perfect for a GPU

Look again at the four answer boxes. Notice two things:

  1. Every box is the same kind of job: multiply pairs and add them up.
  2. No box needs to wait for another. You can work out the bottom-right before the top-left.

Those are exactly the two questions from lesson 3.2. Both answers are yes, so this is a GPU job.

Now scale it up. A real model multiplies tables with thousands of rows and columns, again and again. That means an enormous number of small, independent multiply-adds. Thousands of GPU workers can share them out and finish together. Many modern GPUs even have special parts (NVIDIA calls them Tensor Cores) built just to speed up this matrix maths.

And memory matters too

All those numbers have to be fed to the workers from VRAM. That is why, as we saw in lesson 3.3, VRAM size (does the model fit?) and VRAM speed (can we feed the workers fast enough?) matter so much for AI.

Where we go next

In Module 4 we will see what these tables of numbers really are: tensors and models. In Module 5 we will see what happens when a model is too big for one GPU and the work must be split across many GPUs.

Key takeaways

  • AI models work with tables of numbers called matrices.
  • Their most common operation is matrix multiplication, which is just lots of multiply-and-add sums.
  • Those sums are all alike and independent, which is exactly what GPUs are built for.
  • Feeding the numbers from VRAM quickly matters as much as doing the maths quickly.

Recap: price every dish on a giant menu by giving each simple “multiply, then add” sum to a different helper, all at once. That is AI on a GPU.

Now you understand why AI and GPUs are such a good match. That completes Module 3, and the foundations of this course: you now know how a computer works, how a request reaches a server, and why that server has a GPU.

Quick check

Pick an answer, then press Check answer. Nothing is recorded.

  1. What is the most common kind of calculation inside an AI model?
  2. Why does matrix multiplication suit a GPU?
  3. Using the diagram, what is the top-left answer (2×1 + 3×6)?

Sources

This lesson was checked against these pages.

  1. Matrix Multiplication Background User's Guide · NVIDIA
  2. GPU Performance Background User's Guide · NVIDIA
  3. What's the Difference Between a CPU and a GPU? · NVIDIA