CPU vs GPU for LLM Inference: What Actually Changes
Does a graphics card really make an AI model faster, and by how much? We ran the same model, Llama 3.1 8B in Ollama, on the same rented Google Colab machine twice: once on its processor, once on its NVIDIA L4. Reading the prompt got 60x faster; writing the reply only about 6x. Here is why: reading is parallel math, writing is limited by memory speed, a model split between card and processor runs at the slow part's speed, and with many users at once the graphics card pulls far ahead.
Twenty-four seconds
You run an AI model yourself, and it takes twenty-four seconds to start answering.

Would a graphics card fix it, and do you even need one? We ran the same model on the same machine both ways.

The wait before the first word got sixty times shorter. The typing speed after it, only six times faster. By the end, you'll know why.

Jess runs a small roofing company, and her AI helper answers customers' texts. Every slow reply is a homeowner with a leak, calling another roofer.

Two jobs in one answer
First, what is the computer actually doing? A language model works in tokens: a token is a word, or a piece of one.

Every answer is two jobs. Job one is reading: the helper is given Jess's company page plus the customer's question. That input is called the prompt. Here it's eight hundred and seventy tokens, and the model takes them all in before a single word comes out. Job two: the model writes the reply. It guesses one token and adds it to the text. Then it feeds everything back in to guess the next one. Over and over, until the answer is done.

Reading is the wait before the first word; writing is the typing speed after it. And they lean on different parts of the machine, which is why a graphics card doesn't speed them up equally.

The same model, both ways
Now the test: can a graphics card answer before Jess's customers give up? Jess rents a cloud computer from Google Colab for an hour. Its main chip is an ordinary server processor, a C P U. Next to it sits one NVIDIA L4 graphics card, a G P U, which has its own memory. The model is Llama 3.1, run with a free tool called Ollama. Its file is about five gigabytes.
ollama listNAME ID SIZE MODIFIED llama3.1:8b 46e0c10c039e 4.9 GB Less than a second ago
lscpu | grep -E '^(Model name|CPU\(s\))'CPU(s): 12 Model name: Intel(R) Xeon(R) CPU @ 2.20GHz
nvidia-smi --query-gpu=name,memory.total --format=csvname, memory.total [MiB] NVIDIA L4, 23034 MiB
First, the processor only. Her ask command, a small script, sends a customer's question and times both jobs. Reading the page took twenty-four point one seconds. Writing the reply: seven point seven tokens a second. Ollama's status confirms where it ran: one hundred percent C P U.
ask --cpu "Can Mike fix a leak at my house tomorrow morning?"Mike's crew has the morning window open tomorrow. They can come by between 7:30 and 11:30 am. Would you like to schedule for that time? ---------------------------------------- read 870 tokens 24.1 s 36/s wrote 36 tokens 4.7 s 7.7/s first word after 24.1 s, done after 28.8 s
ollama ps | cut -c1-50NAME ID SIZE PROCESSOR llama3.1:8b 46e0c10c039e 9.5 GB 100% CPU
Now the same question, the same file, with the whole model on the graphics card. Reading the page: zero point four seconds. That's about sixty times faster. The reply is word for word the same, and the whole answer is done in under a second.
ask --gpu "Can Mike fix a leak at my house tomorrow morning?"Mike's crew has the morning window open tomorrow. They can come by between 7:30 and 11:30 am. Would you like to schedule for that time? ---------------------------------------- read 870 tokens 0.4 s 2317/s wrote 36 tokens 0.7 s 49.6/s first word after 0.4 s, done after 1.1 s
Reading can be counted in tokens a second too: eight hundred and seventy tokens in twenty-four seconds is about thirty-six a second on the processor, and more than two thousand on the card. Writing the reply: seven point seven, against forty-nine point six. Same card, same model, a very different gain. That gap is the whole story of CPU versus GPU.

Why reading speeds up
Start with reading. Why would a graphics card read Jess's page sixty times faster? The answer starts with video games. In nineteen ninety-nine, NVIDIA sold the GeForce 256 as the first G P U: a chip for game graphics, doing the same small sum for millions of pixels at once. Hold on to that idea.

All eight hundred and seventy tokens are known before the model starts, so the math for them can be done side by side. A core is one worker inside the chip. This processor has six, each one quick and clever. The L4 has more than seven thousand small cores that do one simple kind of math, multiply and add, all at the same time: the pixel trick, done on tokens. And a language model is mostly that one kind of math.

Why writing speeds up less
Writing is the part that surprises people. To write one token, how much of the model does it read: one small piece, or all of it? All of it. All of its weights. A model's weights are the eight billion numbers it learned in training, and every single token reads all of them from memory: four point nine gigabytes. Then for the next token, it reads all of them again.

It's like a roofer who rereads the whole manual before every nail: what decides the speed is how fast the pages turn, not how fast the hammer swings.
That's why model files are squeezed. Stored at full detail, each weight takes two bytes, so eight billion of them would fill sixteen gigabytes. Ollama's copy stores each weight in about half a byte. That squeezing is called quantization. It's the Q4 you see in the model's details on screen. So the file is four point nine gigabytes, and every token has about a third as much to read.
ollama show llama3.1:8b | head -12Model architecture llama parameters 8.0B context length 131072 embedding length 4096 quantization Q4_K_M template source go_template Capabilities completion tools
Now you can work out the speed limit. Each token reads the whole file once. So multiply the file size by the tokens a second, and you get how fast the memory is feeding the chip. On the processor, four point nine gigabytes times about eight tokens a second is roughly thirty-eight gigabytes a second. On the graphics card: about two hundred and forty gigabytes a second. And two hundred and forty against thirty-eight is about six times: the same six times we saw in the typing speed. So the card was running close to its listed limit, about three hundred gigabytes a second, and that limit is memory speed, not math.

Rule of thumb: the faster the memory, or the smaller the file, the faster it writes. Which raises Jess's next question: what if the model doesn't fit on the card?

When it doesn't fit
The card's memory is called V RAM. With the whole model on it, the card used about nine of its twenty-three gigabytes: the weights, plus working space for the conversations being answered. A model with seventy billion weights, about forty gigabytes even squeezed, wouldn't fit at all.
nvidia-smi --query-gpu=memory.used,memory.total --format=csvmemory.used [MiB], memory.total [MiB] 8980 MiB, 23034 MiB
ollama ps | cut -c1-50NAME ID SIZE PROCESSOR llama3.1:8b 46e0c10c039e 9.2 GB 100% GPU
A model is built in layers, steps that every token passes through in order. When it doesn't fit, Ollama splits them: some layers on the card, the rest on the processor. To see what happens, Jess makes Ollama split this same model on purpose: sixteen of its thirty-two layers on the card. That's half the layers, but Ollama's percentage counts memory, so it shows sixty-six percent on the G P U. Guess first: does it write near the card's fifty tokens a second, or near the processor's eight? It writes twelve point one tokens a second. Much closer to the processor.
ollama ps | cut -c1-56NAME ID SIZE PROCESSOR llama3.1:8b 46e0c10c039e 7.2 GB 34%/66% CPU/GPU
ask --layers 16 "Can Mike fix a leak at my house tomorrow morning?"Mike's crew has the morning window open tomorrow. They'll be there from 7:30 to 11:30 am. Would you like to book that time? ---------------------------------------- read 870 tokens 0.9 s 1007/s wrote 35 tokens 2.9 s 12.1/s first word after 0.9 s, done after 3.7 s
Why? Every token has to pass through every layer, in order. The layers on the card finish fast, then wait for the half still on the processor, reading from slow memory. A split model runs at the speed of its slow part. So pick a model that fits in the card's memory, with room to spare.

After the storm
After a storm, the real test: eight homeowners text at once. Her crowd command sends short questions together, first one, then eight. On the processor, each of the eight gets under two tokens a second, and the last customer waits thirty-four seconds for an answer. Counting all eight together, the processor only doubled what it managed for one customer.
crowd --cpu 11 customer on the processor each customer 7.4 tokens/s all together 7.4 tokens/s last answer after 8.2 s
crowd --cpu 88 customers at once on the processor each customer 1.8 tokens/s all together 13.7 tokens/s last answer after 33.7 s
On the graphics card, each reply is a bit slower than for one person, about twenty-six tokens a second. But all together, that's one hundred and eighty-eight a second, nearly four times its total for one customer, and nobody waits more than three seconds.
crowd --gpu 11 customer on the graphics card each customer 47.7 tokens/s all together 47.6 tokens/s last answer after 1.3 s
crowd --gpu 88 customers at once on the graphics card each customer 26.5 tokens/s all together 188.4 tokens/s last answer after 2.4 s
Here's why. Remember, writing is waiting on memory. When eight conversations are answered together, one trip through the weights writes the next token for all eight, so the memory trip is shared. Once that trip is shared, memory stops being the hold-up, and the math becomes the limit again. The graphics card has thousands of cores sitting idle to do the extra math. The processor has only six cores, so the extra math for eight customers swamps it.

Which one to pick
So, which one should you use? A processor is fine for one person, a small model, and short prompts, if you can wait a few seconds for the first word. Get a graphics card when prompts are long, when several people ask at once, or when the first word has to come fast.

If you buy one, buy for memory. First, enough V RAM, the card's own memory, to hold the whole model with room to spare. Second, the fastest memory you can afford, because that sets the typing speed. Or rent one by the hour, as Jess did here.

Jess's helper now runs on a rented graphics card. A homeowner texts about a leak, and about a second later the answer arrives: Mike's crew can come tomorrow morning. Nobody calls another roofer.

Recap
So here's what actually changes. Reading is parallel math: sixty times faster. Writing is memory speed: about six times. The model has to fit, and with many users, the card pulls far ahead.

If you're deciding what to run your own model on, subscribing brings the next one, measured the same way.
Every number in this video came from one rented Google Colab machine, the same model both ways, and the lab files are linked in the description. Thanks for watching Cloud Explainers.
Sources
- NVIDIA L4 Tensor Core GPU (24 GB GDDR6, 300 GB/s memory bandwidth, 72 W)
- TechPowerUp, NVIDIA L4 specifications (AD104, 7,424 shading units)
- NVIDIA blog, How the World's First GPU Leveled Up Gaming and Ignited the AI Era (GeForce 256, 1999)
- Ollama FAQ: how Ollama loads models on the GPU, and OLLAMA_NUM_PARALLEL
- Ollama API: the num_gpu option and generate timings
- Llama 3.1 8B in Ollama's library (Q4_K_M, 4.9 GB)
Demos: one Google Colab GPU runtime (NVIDIA L4), the same model file both ways; Jess's roofing company and its page are made up. Every command and output was real. Watch the full video on YouTube.