LLM Inference Systems
Understand the memory, scheduling, decoding, and hardware tradeoffs that make LLM serving fast or painfully expensive.
What this path gives you
You can reason about long context cost, KV cache pressure, PagedAttention, speculative decoding, and model-specific silicon.
Before transformers, KV cache, and GPU serving, language models had a smaller job: look at context and predict what text should come next.
AI Engineering / 5 min readTransformers were not the first attempt to model language. They arrived after rules, n-grams, recurrent networks, LSTMs, seq2seq models, and attention exposed the same bottleneck: sequence processing was too slow and too forgetful.
AI Engineering / 6 min readN-gram models were useful because they turned language into counts. They failed because a fixed local window cannot remember distant context, understand meaning, or generalize well to unseen phrases.
AI Engineering / 6 min readRNNs improved on local n-gram counting by carrying a hidden state through the text. The tradeoff was dependency: token 10 cannot be processed until token 9 has updated the state.
AI Engineering / 6 min readPlain RNNs rewrote one hidden state at every step. LSTMs added gates and a cell state, giving the model a cleaner path for preserving useful information over longer spans.
AI Engineering / 6 min readRNNs and LSTMs gave language models memory, but that memory still had to pass through one step after another. Long context made useful clues fade, compete, and arrive too slowly.
AI Engineering / 6 min readAttention changed the sequence-model bottleneck. Instead of forcing every old clue through one running state, it let the model look back and score which earlier tokens mattered now.
AI Engineering / 6 min readSelf-attention is attention applied inside one sequence. Each token builds a better representation by comparing itself with the other tokens in the same input.
AI Engineering / 6 min readSelf-attention changed the shape of sequence processing. Instead of moving one state through the text step by step, it builds token-to-token scores for the whole sequence with matrix operations.
Article / 6 min readA transformer is a stack of repeated blocks that use self-attention, small neural networks, residual paths, and normalization to turn token vectors into context-aware predictions.
Article / 6 min readTransformers replaced RNNs because they gave tokens shorter paths to context and gave training hardware a more parallel shape. The tradeoff was higher attention cost.
Article / 6 min readEmbeddings turn tokens into learned vectors. The vector is not a dictionary definition; it is a set of numbers the model can use as the starting point for computation.
Article / 6 min readSelf-attention can compare tokens, but attention alone does not know their order. Transformers need positional information so the same tokens in different positions can mean different things.
Article / 6 min readQuery, key, and value vectors are three learned views of the same token representation. Attention uses queries and keys to decide what matches, then mixes values to carry information forward.
Article / 6 min readAttention separates matching from information flow. Queries and keys decide which tokens are relevant, while values carry the information that gets mixed into the updated token representation.
Article / 6 min readMulti-head attention runs several learned attention views in parallel. Each head uses its own projections, then the model combines the results into one updated token representation.
Article / 6 min readMultiple attention heads help because one token may need several kinds of context at the same time. Heads give the layer several learned ways to score and mix tokens before the results are combined.
Article / 6 min readAfter attention lets tokens exchange context, the feed-forward network works on each token separately. It is the per-token thinking step inside a transformer block.
Article / 6 min readResidual connections let a transformer layer add a transformation without forcing the original representation through a narrow gate. They preserve a route around attention and feed-forward steps.
Article / 6 min readVRAM planning for LLMs is not just about model weights. Long context windows can make the KV cache as expensive as the model itself.
AI Engineering / 5 min readBigger GPUs help, but fast LLM serving is mostly a scheduling and KV cache problem. PagedAttention, block allocation, batching, and prefix caching decide how much useful work fits in memory.
AI Engineering / 6 min readSpeculative decoding speeds up LLM inference by letting a cheap draft model guess several tokens, then asking the expensive target model to verify those guesses in one parallel pass.
AI Engineering / 6 min readIf language models can be compiled directly into silicon, inference stops looking like software running on a GPU and starts looking like the computer itself.
AI Engineering / 5 min read