How AI Chatbots Actually Work · Part 5 of 5
Running AI Faster, and Peeking Inside Its Head
Running a large language model faster, in plain English: a cache of past reading, specialist experts, and a peek at how Paris climbs. No math.
11 Nov 2026

Inference is using the warehouse without rereading the entire library for every new word — and interpretability asks what those numbers actually learned.
Prefill reads your prompt in parallel and builds a cache of attention keys and values — notes on what has already been read. Decode adds one token at a time, reusing that cache. For Llama-3-8B in the technical course's accounting, the cache is about 128 KiB per token; at 128,000 tokens that is about 16 GiB. Long context is expensive because the notebook of past reading grows with every word.
Attention scores, stored naively for a long sequence, can be absurd — on the order of 1.1 TB for a single layer at 128K in the course's example. FlashAttention computes the same result by tiling and keeping a running softmax, never materializing that scratch pad. Engines such as vLLM and llama.cpp add continuous batching so hardware stays busy.
Mixture-of-experts models scale differently. Mixtral 8×7B, counted from its real config, has about 46.7 billion parameters total, but only about 12.9 billion are active for any one token: a router opens a few specialist doors per layer.

The technical capstone ran SmolLM2-135M on "The Eiffel Tower is in the city of," watching Paris climb from roughly rank five thousand toward the top. One attention head in layer 23 placed about 84% of its attention on "iffel"; ablating it dropped Paris from about 79% to 40%. Induction heads complete repeated patterns. Superposition packs more features into too few dimensions. Moral: these systems are more like palimpsests than card catalogs.