Notes

vLLM

Serving a language model is mostly a memory problem. Each in-flight conversation drags a KV cache behind it that grows with every token, and the obvious approach — reserve one contiguous block big enough for the longest reply the request might produce — spends most of the GPU on space that is never used. vLLM is an open-source inference engine built around fixing exactly that.

Paged attention and continuous batching

vLLM keeps the KV cache in small fixed-size blocks scattered wherever there is room, with a per-sequence table mapping tokens to blocks — the trick an operating system plays with virtual memory. Requests also enter and leave the running batch token by token instead of waiting for the slowest member, so the accelerator stays busy. Together:

  • fragmentation waste falls from most of the cache to a few percent, fitting far more concurrent requests on one card;
  • identical blocks are shared, so a long system prompt is stored once and reused by every request that begins with it.
Why people reach for it

Throughput on a single GPU rises several-fold against a naive Hugging Face generation loop, which is the difference between one card serving a demo and one card serving a product. It exposes an OpenAI-compatible HTTP endpoint, so existing client code moves over with a changed base URL, and it carries the rest of the serving toolkit: tensor parallelism across cards, quantised weights, prefix caching, speculative decoding and hot-swappable LoRA adapters. For self-hosting an open-weight model such as LLaMA, Qwen or Mistral it is the default answer, and the reason a small team can put a 70B model behind an API at all.

vLLM is an open-source serving engine for large language models, built on PagedAttention: the KV cache is held in fixed-size blocks like operating-system memory pages, which nearly eliminates fragmentation and lets requests share identical prefixes. With continuous batching it delivers several times the throughput of a naive generation loop on the same GPU, and it exposes an OpenAI-compatible API — making it the common choice for self-hosting open-weight models.

When a chat assistant answers thousands of people at once, something has to decide how the computer's memory is divided between all those half-finished conversations. Do it carelessly and most of the memory sits reserved but empty, like a restaurant holding tables for guests who never arrive. vLLM is free software that does this bookkeeping well. It hands out memory in small pieces as each conversation actually grows, and lets new questions join the queue the moment there is room. The same hardware then serves far more people at the same time, which is why so many AI services you can run yourself are built on it.