Go to Map Courses Lab Glossary How it works Troubleshooting Start →
ITEN
← Course 01 · The Basics (Lesson 01.02 · 15 minutes · No sensor · For everyone)

What's inside your phone.

A model runs inside a chip the size of a fingernail, with a battery that has to last all day. Here you'll open the phone layer by layer, and see what each part does when a neural network is at work.

What you learn
  1. What the CPU, GPU and NPU do, and why networks prefer the last two
  2. Why memory slows a model down more than the math does
  3. Which sensors a model can use on your phone
  4. What it costs in battery and heat to run a model
You need to know

If you don't remember one of these, the link takes you to the chapter that explains it.

How do you want to follow it
Preparing the scene…
  1. 01 The chip

    A whole computer inside one chip.

    If you open a phone, under the screen you'll find the battery and a board full of components. In the middle there's a chip smaller than a fingernail. It's called an SoC, a system on a chip, because a whole computer fits inside it, with all its processors.

    In practice. In a phone's spec sheet, the name of the chip matters more than the brand. Two phones with the same chip run a model at roughly the same speed.

01 / 07
(Go deeper)

A few more numbers.


(01)

Why memory costs more than math

In 2014 Mark Horowitz, at Stanford, measured how much energy the operations inside a chip cost. Multiplying two 32-bit numbers with a decimal point costs about 3.7 picojoules. Reading those same 32 bits from external memory costs about 640, almost two hundred times as much.

That's why models for phones try to move as little data as they can. They use smaller numbers, 8 bits instead of 32, and networks that reuse the same numbers many times once they reach the chip. With 8-bit numbers the multiplication costs less too, about 0.2 picojoules.

  • 640 pJreading 32 bits from memory
  • 3.7 pJmultiplying two 32-bit numbers
  • 0.2 pJmultiplying two 8-bit numbers
(02)

Who can use the NPU, and when

Not every app can reach the NPU. On the iPhone you get there with Core ML, Apple's engine, which decides on its own whether to use the Neural Engine, the GPU or the CPU. On Android each maker has its own tools, and Google offers LiteRT, which tries to use the right accelerator for each phone.

For now the browser can't reach the NPU. There's a proposal to make that possible, called WebNN, but it isn't available on every phone yet. That's why the course lab uses the GPU, which the browser reaches through WebGL and WebGPU. It's a bit less efficient than the NPU, but it works everywhere.

(03)

Cold and hot

A phone has no fans. The chip's heat goes into the case and from there into the air, and if the chip makes more heat than can get out, the system lowers the speed of the processors. It happens after a few minutes of heavy work, sooner in summer or with the phone in a case.

For a model, this means the same photo can take 20 milliseconds right after you turn the phone on, and much longer after ten minutes. When you test your model in the lab, let it run for a while before you look at the numbers.

(Try it on your phone)

Measure your phone


Press the button. The page looks at what's inside your phone and measures how many calculations it does in one second, first with the CPU and then with the GPU. It doesn't send anything to anyone, the numbers stay here. Keep the page open until it's done.

The tool needs JavaScript turned on.

These are rough estimates, and they change from one run to the next, especially if the phone is warm or in battery saver mode. Try twice, once with the phone cold and once after a few minutes of continuous use. On the second run the page also reminds you of the numbers from the first.

(Quiz)

3 questions to close the lesson.

When you have answered them all, the lesson counts as done and its stone on the map turns yellow. Answering is what counts, not the score.


  1. (01)

    Why does a neural network run better on the GPU than on the CPU?

  2. (02)

    A model that writes text runs slowly even on a phone with a powerful NPU. What's the most likely cause?

  3. (03)

    When should you measure a model's speed on the phone?

To close the lesson, answer the quiz

← Where AI does its thinking Back to the map
(Next lesson · 01.03) How a model learns