Course outline
- 01How a computer works
- 02How the Internet works
- 03Introducing the GPU
- 04Tensors and models
- 4.1What is a tensor?soon
- 4.2What is an AI model?soon
- 4.3Training vs inferencesoon
- 05Splitting work across GPUs
- 5.1Why split work across GPUs?soon
- 5.2Data parallelismsoon
- 5.3Tensor parallelismsoon
- 5.4Pipeline parallelismsoon
- 5.5Expert parallelismsoon
- 5.6Which to use whensoon
- 06Serving LLMs with vLLM
- 6.1What is LLM serving?soon
- 6.2Meet vLLMsoon
- 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.
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
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:
- Every box is the same kind of job: multiply pairs and add them up.
- 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.
Sources
This lesson was checked against these pages.