MODULE 3 · DAY 1
Production Serving with vLLM
Continuous batching, PagedAttention, and the same /v1 contract
Gourav Shah · School of DevOps & AI · Containers for GenAI & Agentic AI
M3·01
What you'll learn
Why vLLM is the production workhorse — and how to run it on any laptop.
Same client, bigger engine — you swap the backend, your application code never notices.
M3·02
Ollama is great — until the crowd arrives
A home espresso machine pulls one perfect shot. Ask for a second mid-brew and you wait your turn.
Perfect for a developer at a laptop. Under concurrent load, finished slots sit idle and the queue backs up.
M3·03
Continuous batching — never let a head sit idle
The moment one shot finishes, the next order slides in — no waiting for the whole batch.
As soon as a sequence emits its final token and leaves, a waiting request takes its place — the single biggest reason vLLM wins under load.
M3·04
PagedAttention — virtual memory for the KV cache
Your OS never demands one giant contiguous block per program. It hands out small pages and maps them anywhere.
Near-zero memory waste means far more concurrent sequences fit — which is exactly what feeds continuous batching enough work to stay busy.
M3·05
The payoff: ~3x throughput under load
Same GPU, same per-shot time — but the heads never go idle, so far more coffees per hour.
Continuous batching + PagedAttention together give roughly 3x the throughput of a naive server on the same hardware.
M3·06
Same contract, bigger engine
The wall socket from M2, again — the client speaks to the contract, not the engine behind it.
Swapping Ollama for vLLM is a one-line change — point OPENAI_BASE_URL at the new address. No code, no SDK, no image change.
M3·07
The CPU track — learn the machinery anywhere
Apple Silicon exposes no GPU to containers, so containerized vLLM runs on CPU. Slow on purpose.
Throughput isn't the lesson on CPU — understanding the OpenAI server, the batcher, and quantization mechanics is.
M3·08
Why containers report 0 NUMA nodes
NUMA is the building's floor plan. A container is a furnished apartment inside it — the floor plan is abstracted away.
The signature teaching point: a surgical sed patch guards the division so an upstream image behaves in a containerized world.
M3·09
CPU tuning knobs that keep the laptop usable
A few environment dials do most of the work — set threads to part of your cores, not all.
Multi-threaded BLAS and multi-threaded OpenMP thrash the cache and slow everything down — keep BLAS at one thread.
M3·10
CPU track vs GPU track
Learn the engine on any laptop; reach for the throughput payoff on an NVIDIA box.
Both speak the identical /v1 contract — your M2 client wouldn't change moving from CPU to GPU.
M3·11
GPU operational gotchas
Two flags and one sizing rule separate a working GPU server from cryptic crashes.
--max-model-len and --max-num-seqs cap KV-cache size and concurrency — the usual dials to fit memory.
M3·12
Quantization — trade a little precision for a lot of room
Like a JPEG: compress weights from 16-bit floats to 4- or 8-bit ints. A little accuracy lost, the file shrinks dramatically.
Rule of thumb: 4-bit AWQ roughly quarters VRAM vs FP16 for a small accuracy cost — often how a 7B model fits a consumer 8 GB card.
M3·13
TO THE LAB
Same socket. Bigger engine.
Serve SmolLM2 on CPU vLLM and hit the same /v1 your M2 client already speaks.
Next: Lab — Serve SmolLM2 on CPU vLLM · Gourav Shah · School of DevOps & AI
M3·14