vLLM is the de-facto standard serving engine for open-weight LLMs — named directly in job postings and adopted as the paved-path engine at major platform teams (Netflix, mid-2026). Its core wins are PagedAttention (near-zero KV-cache waste) and continuous batching (new requests join in-flight batches), which together turn one mid-range GPU into a usable multi-user endpoint.
Tier: Advanced · Workflow area: Serving & LLMOps
This playbook deploys a 7–8B model behind an OpenAI-compatible API and measures the two numbers that define serving quality: time-to-first-token (TTFT) and tokens-per-second (TPS) under concurrency.
If you need frontier-model quality or your volume is a few thousand requests a day, a hosted API is cheaper and better — self-hosting wins on privacy, unit economics at scale, and latency control, not on peak quality.
pip install vllm (Linux + CUDA; use the official Docker image if the host is messy).k6, locust, or vLLM's built-in benchmark CLI.Pick the model to match the VRAM. On a 16GB T4, serve a 4-bit AWQ build of a 7–8B instruct model (e.g. Qwen/Qwen2.5-7B-Instruct-AWQ). On a 24GB A10, FP16 7–8B fits.
Serve it.
vllm serve Qwen/Qwen2.5-7B-Instruct-AWQ \
--quantization awq \
--max-model-len 8192 \
--gpu-memory-utilization 0.90 \
--port 8000
--max-model-len bounds context (longer = more KV-cache per request = fewer concurrent requests); --gpu-memory-utilization is how much VRAM vLLM may claim for weights + KV cache.
Smoke-test via the OpenAI-compatible API. Any OpenAI client works with base_url="http://localhost:8000/v1" and a dummy key; hit /v1/chat/completions and confirm sane output and a populated usage block.
Benchmark methodically. Fix a representative prompt set (your real task's length distribution, not "hello"). Sweep concurrency 1 → 4 → 16 → 32, and at each level record: median and p95 TTFT, per-request decode TPS, total system throughput (tok/s across all requests), and error/timeout rate. vLLM exports Prometheus metrics at /metrics (TTFT and e2e latency histograms) — scrape them rather than trusting client-side timing alone.
Read the curves. Expect: system throughput climbs with concurrency (continuous batching working) until KV-cache saturates; TTFT degrades first as requests queue. The knee of the p95-TTFT-vs-concurrency curve is your capacity number — write it down as "N concurrent users at ≤X s p95 TTFT."
Compute unit economics. (tokens served during the sweep ÷ GPU-hours × spot price) → ₹ or $ per million tokens. Put it next to hosted-API pricing for the closest comparable model — this table is the deliverable your manager cares about.
A serving deployment without a load test is a demo. TTFT-at-p95 under realistic concurrency — not single-request speed — is the number that decides whether your endpoint survives contact with users.
vllm/vllm-openai) — same flags, cleaner host; the right default on cloud VMs.vllm bench servebuilt-in benchmark client as a cross-check on your k6/locust numbers./metrics histograms roughly agree with client-side measurements (large gaps mean client-side queuing).--max-model-len left at model default. A 32k default eats KV-cache budget and quietly halves concurrent capacity when your real prompts are 2k.Self-hosting is the restricted-environment answer — that is its point. For fully air-gapped setups, pre-download model weights (huggingface-cli download) on a connected machine and transfer; vLLM serves from a local path. Keep the endpoint on a private network and put authentication in front (vLLM's --api-key flag or a reverse proxy) before any colleague touches it.
Kaggle/Colab sessions cap at 9–12 hours and give no stable ingress — perfect for the benchmark lab, wrong for anything anyone depends on. Graduate to a spot VM for shared use.