โ† All posts

vLLM

vLLM

LLM inference looks complicated.
It mostly comes down to 4 runtime tricks.

๐Ÿญ) ๐—–๐—ผ๐—ป๐˜๐—ถ๐—ป๐˜‚๐—ผ๐˜‚๐˜€ ๐—ฏ๐—ฎ๐˜๐—ฐ๐—ต๐—ถ๐—ป๐—ด
Old batching waits for the slowest request.

Continuous batching swaps in a new request the moment another one finishes.

That keeps the GPU busy instead of leaving slots idle.

๐Ÿฎ) ๐—ฃ๐—ฎ๐—ด๐—ฒ๐—ฑ๐—”๐˜๐˜๐—ฒ๐—ป๐˜๐—ถ๐—ผ๐—ป
KV cache is the memory bottleneck.

Instead of reserving one huge contiguous block, PagedAttention splits it into small pages and allocates them only when needed.

That cuts waste and lets more requests fit on the same GPU.

๐Ÿฏ) ๐—ฃ๐—ฟ๐—ฒ๐—ณ๐—ถ๐˜… ๐—ฐ๐—ฎ๐—ฐ๐—ต๐—ถ๐—ป๐—ด
A lot of requests share the same prompt start:

  • system prompts
  • few-shot examples
  • RAG context
  • conversation history

Prefix caching computes that shared prefix once, then reuses the KV cache.

Less recomputation. More throughput.

๐Ÿฐ) ๐—ฆ๐—ฝ๐—ฒ๐—ฐ๐˜‚๐—น๐—ฎ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—ฑ๐—ถ๐—ป๐—ด
Generation is still sequential by default.

Speculative decoding speeds it up by:

  • proposing several tokens with a small drafter
  • verifying them in one pass with the main model

If the guess is right, you accept multiple tokens at once.

The result:

  • lower latency
  • higher throughput
  • better GPU utilisation

Originally published on LinkedIn.

Turn your expertise into LinkedIn posts like this one.

Try Postars free โ†’
vLLM โ€” Postars