How to Reduce LLM Latency

11 Jul 2026 · 42 min
41:35

In this 40‑minute technical talk, Hamel Husain interviews inference researcher Abby, who walks through a mental model of where LLM inference latency originates and how to predict and reduce it. Abby introduces the concept of an inference shape (input tokens, output tokens, batch size, context length) and shows how different application patterns (chat, RAG, creative writing, agentic loops) map to distinct token ratios. She explains the two fundamental phases of a request – prefill (compute‑bound, parallel) and decode (memory‑bandwidth‑bound, sequential) – and demonstrates with a TinyLlama‑1.1B model on an NVIDIA T4 how latency splits between them. Experiments reveal that decode time dominates total latency, especially for long‑output or multi‑step agent workloads, and that small batch sizes waste GPU capacity. Abby discusses KV‑cache growth, continuous batching, prefix caching, quantization, flash/paged attention, and when speculative or disaggregated decoding become worthwhile. She then covers common production pitfalls (missing warm‑up, poor KV‑cache sharing, stale cache), cost modeling for self‑hosting versus API usage, and the trade‑offs of speculative decoding. The session ends with a curated list of learning resources (Forward Deployed course, inference engineering books, gpengineering.com, etc.) and a short homework to experiment with batch sizes and different inference engines.

Chapters

More from Hamel

0:47
youtube.com

Stop Splitting One Task Across Multiple Agents

17h ago
3:23
youtube.com

How To Decide Who Owns AI Evals

17h ago
0:41
youtube.com

The Two Biggest Mistakes Teams Make With Evals

1d ago
3:16
youtube.com

Can One Model Run Your App And Evals?

1d ago
0:44
youtube.com

Why Generic Eval Metrics Waste Your Time

2d ago
21:18
youtube.com

How to Ace AI Eval Interview Questions (for Engineers & PMs)

2d ago
0:31
youtube.com

Not Every Bug Needs an Eval

3d ago
47:59
youtube.com

Can Claude Build Your Evals?

3d ago
0:46
youtube.com

How to Get Your Team to Care About Evals

4d ago
12:47
youtube.com

7 Most Common AI Eval Mistakes (From Teaching 5K+ Engineers & PMs)

4d ago
40:01
youtube.com

How To Test AI Agents With Simulations

6d ago
See all content