Verba/Rapida

Explainers

Prefill and decode

A reply has two very different phases. First the model reads the whole prompt at once, which parallelizes well and takes time in proportion to the prompt. Then it writes the answer one token at a time, each token a separate small step.

EXPrefill and decodeillustrative

Choose a prompt length. The picture is illustrative; the measured numbers are below.

timeprefillfirst tokendecode, one token per step

Reading the prompt is 46% of the time in this picture.

The picture and its numbers are illustrative.

The takeaway

The time to the first token is the prefill. A long prompt with a short answer, like this lab's workload, is mostly prefill, which is why caching the prompt and speeding up prefill matter most.

What the lab knows

Measured here at 8k tokens: 0.69 s to the first token cold, then 145 tokens per second while writing (Gemma 4 E4B). measured here

See it in the atlas

Want to see what these experiments produced? Lesto, the Gemma 4 inference engine for Apple silicon Macs, is on lestoengine.com

Made by Federico Andrioli, @fedeandri on X A research lab's own measurements, generated from its files. Data built