Tokencito Game of the day Play

Why does AI use GPUs?

A GPU is a chip that was born to draw graphics and does thousands of simple calculations at the same time. AI uses it because a model is, mostly, multiplying huge tables of numbers. Its edge is not speeding up a single operation, but running a huge number of them in parallel.

📝The text as tokens👀Attention: what matters🔢Lots of math on a GPU

Put it to the test

A question from the app. Pick an answer.

Why does AI usually run on GPUs?

Start playing on the web

From video games to AI

To draw a game frame, the GPU works out the color of millions of pixels, and each one is a small, independent calculation. That is why it has thousands of simple cores instead of a few powerful ones like a CPU.

A neural network has the same kind of work: multiplying matrices, that is, tables of numbers, over and over. Today's language models are Transformers, a design built to take advantage of doing those calculations in parallel.

Training and answering: two bills

Pretraining a huge model from scratch takes a lot of specialized compute: large groups of GPUs, or of similar chips like Google's TPUs, working together. After that, every answer is computing too: the model does math for every token it writes, for every user. That is the difference between training and inference.

That is why these chips are expensive, scarce and in high demand, and why using AI is not free: every answer takes up hardware and electricity. More in how much AI costs.

Memory decides which model fits

A dedicated GPU has its own memory, VRAM; with unified memory, as on Apple Silicon Macs, the CPU and GPU share it. The weights and what the model uses while running have to fit there. If they do not fit, it runs slowly or will not start. That is why quantization exists, to shrink the model, and why it is the first question when you run a local model.

Common mistakes

"No GPU, no AI." A small model runs on a CPU, just slower, and many phones have their own AI chip, the NPU: that is on-device AI. "The GPU does the thinking." The GPU only does math; what the model knows is in its weights. "A GPU is faster at everything." Its strength is running many operations in parallel, not speeding up any single operation.