Find Where Inference Latency Lives

AI Product Engineering
Systems
Separate prefill from decode before optimizing the wrong bottleneck.
Author

Hamel Husain

Published

July 2, 2026

This note covers Abi Aryan’s session in the AI Product Engineering series.

Abi Aryan’s session examines two stages of inference: prefill (reading the input) and decoding (generating each output token). Her Colab notebook runs three request shapes on the same model and prints the timing side by side.

A notebook comparing three request shapes on the same model

Decoding is sequential: the model emits one token at a time. Prefill processes the whole input in parallel, so per-token it runs an order of magnitude faster. There are three common inference shapes:

Abi’s advice: If output dominates, cut response length first. After that, try speculative decoding, a smaller model, or better hardware. If prefill dominates, batch requests and shorten context.

The notebook is built for tinkering. Here are some experiments worth trying:

You can watch Abi’s session here and open her notebook here.


To learn how to measure what matters in your AI product, see the AI Evals course, a live cohort with hands-on exercises and office hours.