Explainers
Six techniques, each with something to move.
Attention
When a model writes the next word, it does not remember the sentence like a person. For every word it looks back at the earlier words and decides how much each one matters. That look-back is attention.
Quantization
Every weight of a model is a number stored in a fixed number of bits. Fewer bits means less memory to read for each token, so the model is faster, but each number is rounded to the nearest value the format can hold.
Speculative decoding
Writing a reply one token at a time wastes the big model: each step does the same heavy work for one token. A small drafter guesses several tokens ahead, and the big model checks them all in a single pass, keeping the ones that are right.
Prompt caching
A chat sends the whole conversation again every turn. If the beginning of the new request is identical to the previous one, the model can reuse the work it already did on that beginning instead of reading it again.
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.
Architecture surgery
Some parts of a trained model are more expensive than they need to be. Surgery swaps them for cheaper ones, which hurts quality at first. Then a healing step teaches the operated model to behave like the original again, by distillation.