vLLM Cheatsheet - High-Performance LLM Inference & Serving
vLLM differs from llama.cpp or Ollama not in whether a model runs but in its throughput model: PagedAttention manages KV cache in pages and continuous batching packs requests of different lengths into one batch, so the goal is maximum tokens per second inside a fixed memory budget. Three signals justify the operational cost - you need an OpenAI-compatible endpoint shared by several services, your request volume is high enough for batching to pay off, and you can afford the GPU and the upkeep. This sheet covers installation, launching vllm serve, client calls, quantisation and performance tuning. Three things genuinely need care: size the model against --gpu-memory-utilization first, then set --tensor-parallel-size to the card count (tensor parallelism is not data parallelism, and mismatching it slows things down), and finally choose a quantisation format against accuracy. AWQ and GPTQ are a memory decision, not a speed decision - quantised inference often runs slower, so switch only when memory is the binding constraint.
Install 5
pip install vllmpip install vllm --upgradevllm --versionpython -c "import vllm; print(vllm.__version__)"vllm --helpOpenAI-compatible Server 5
vllm serve facebook/opt-125mvllm serve <model> --host 0.0.0.0 --port 8080vllm serve <model> --api-key <key>vllm serve <model> --tensor-parallel-size 2vllm serve <model> --gpu-memory-utilization 0.9Client Calls 5
curl http://localhost:8000/v1/modelscurl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"...","messages":[...]}'openai_api_base=http://localhost:8000/v1vllm serve <model> --max-model-len 8192vllm serve <model> --enforce-eagerQuantization & Perf 5
vllm serve <model> --quantization awqvllm serve <model> --quantization gptqvllm serve <model> --enable-prefix-cachingvllm serve <model> --max-num-seqs 256vllm serve <model> --dtype halfTips 5
Server defaults to :8000Big model? raise --gpu-memory-utilization firstTP count = GPU countDebug with --enforce-eagerQuantization trades throughput/VRAMTips
- vLLM is a high-throughput inference engine (PagedAttention + continuous batching) that exposes open models over the OpenAI-compatible protocol — the default for self-hosted serving.
- The server listens on :8000 by default (not OpenAI's :8080); clients just set
base_url=http://localhost:8000/v1to swap in seamlessly. - Low on VRAM? raise
--gpu-memory-utilizationfirst; use--tensor-parallel-sizeper GPU count for multi-card; debug oddities with--enforce-eager. - AWQ/GPTQ trade precision for cost;
--enable-prefix-cachingspeeds up multi-turn/repeated-prefix workloads.
FAQ
How does vLLM differ from loading a model with Transformers directly?
vLLM implements PagedAttention and continuous batching, scheduling requests far more efficiently and delivering noticeably higher throughput under concurrency than naive per-request inference. The trade-offs are more aggressive memory management, a heavier startup, and less flexibility for custom inference logic. Use Transformers for single-request work or research; use vLLM when you are serving traffic.
What if the model does not fit in VRAM?
Try these in order: raise the allocation with --gpu-memory-utilization 0.9, then cap the context with --max-model-len 8192 — either one is often enough. If it still does not fit, load quantized weights with --quantization awq or gptq, accepting some accuracy loss that is usually tolerable. With multiple GPUs, use --tensor-parallel-size 2 for tensor parallelism, where the count generally matches the GPU count.
Should I use --enforce-eager when debugging odd problems?
Yes. --enforce-eager disables CUDA graph, narrowing the problem from "vLLM versus CUDA graph" down to the model itself. If the issue disappears, the fault lies in the CUDA graph layer and you should look at driver and CUDA versions; if it persists, the problem is in the model or your code. Enabling it during debugging saves a lot of time.
What port does the vLLM server use by default?
8000. OpenAI's own API lives in a different range, which is why an unmodified OpenAI SDK client fails to connect. Point base_url explicitly at http://localhost:8000/v1 when using the SDK. You can also choose your own port with --port 8080, and pair it with --host 0.0.0.0 to make the service reachable from other machines on the network.
How do I raise concurrent throughput?
Start with --max-num-seqs 256 to raise the concurrency ceiling, then add --enable-prefix-caching to reuse shared prefixes, which pays off clearly in multi-turn chat. Across multiple GPUs, --tensor-parallel-size 2 shards the model. Raising --gpu-memory-utilization 0.9 also fits more KV cache and indirectly improves concurrency.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Aug 23, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us