Compute Comparison
How-To Guides12 min read

vLLM Deployment Guide: Serve Open-Weight LLMs in Production (2026)

How to deploy vLLM for production LLM inference — installation, model loading, OpenAI-compatible API, continuous batching, tensor parallelism, and GPU cloud setup.

vLLM is the de-facto standard for serving open-weight LLMs in production. It implements PagedAttention — a memory management technique that increases GPU utilisation by 2–4x compared to naive inference — and continuous batching, which processes requests as they arrive rather than waiting to fill a batch. The result is 3–10x higher throughput than llama.cpp server at the same hardware cost. This guide covers installing vLLM, serving Llama 3 and Mistral models, configuring tensor parallelism for multi-GPU setups, and deploying behind a reverse proxy.

Why vLLM over llama.cpp for production

llama.cpp is excellent for local inference and single-user workloads. vLLM is built for concurrent multi-user serving. The key difference is how they handle memory and batching. llama.cpp allocates a fixed KV cache per request — if you have 10 concurrent users, you need 10x the VRAM. vLLM's PagedAttention allocates KV cache in pages shared across requests, dramatically reducing memory waste.

Continuous batching means vLLM starts processing new requests the moment a slot frees up, rather than waiting for a full batch to complete. At 10 concurrent requests, vLLM typically achieves 3–5x higher throughput than llama.cpp server on the same GPU. At 50+ concurrent requests, the gap widens to 8–10x.

vLLM also supports tensor parallelism (splitting a model across multiple GPUs), quantisation (AWQ, GPTQ, FP8), speculative decoding, and LoRA adapter hot-swapping. For any production deployment serving more than a handful of users, vLLM is the right choice.

Installation

vLLM requires Python 3.9+ and CUDA 12.1+. Install with pip: `pip install vllm`. For a clean environment, use a virtual env or conda: `conda create -n vllm python=3.11 && conda activate vllm && pip install vllm`.

Verify the installation: `python -c "import vllm; print(vllm.__version__)"`. If you see a version number, you're ready. If you get CUDA errors, check your driver version with `nvidia-smi` — you need driver 525+ for CUDA 12.1.

For Docker deployment (recommended for production), use the official image: `docker pull vllm/vllm-openai:latest`. This image includes all CUDA dependencies and is the most reliable way to deploy vLLM in a containerised environment. See the Docker + GPU Setup Guide for container configuration details.

Serving your first model

Start an OpenAI-compatible server with Llama 3.1 8B Instruct: `python -m vllm.entrypoints.openai.api_server --model meta-llama/Meta-Llama-3.1-8B-Instruct --port 8000`. vLLM downloads the model from Hugging Face on first run (~16 GB for fp16). Set `HUGGING_FACE_HUB_TOKEN` in your environment for gated models.

For quantised inference (half the VRAM, ~5% quality loss): `python -m vllm.entrypoints.openai.api_server --model meta-llama/Meta-Llama-3.1-8B-Instruct --quantization awq --dtype auto`. AWQ quantisation runs the 8B model in ~5 GB VRAM vs ~16 GB for fp16.

Test the server: `curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "meta-llama/Meta-Llama-3.1-8B-Instruct", "messages": [{"role": "user", "content": "Hello"}]}'`. The response format is identical to OpenAI's API.

Key startup flags: `--max-model-len` caps the context window (reduces VRAM), `--gpu-memory-utilization` controls how much VRAM vLLM reserves (default 0.9), `--max-num-seqs` sets maximum concurrent sequences (default 256).

Multi-GPU tensor parallelism

For models that don't fit on a single GPU (70B+ at fp16), vLLM supports tensor parallelism — splitting the model's weight matrices across multiple GPUs. Each GPU holds a shard of every layer and they communicate via NVLink or PCIe during inference.

Enable tensor parallelism with `--tensor-parallel-size N` where N is the number of GPUs: `python -m vllm.entrypoints.openai.api_server --model meta-llama/Meta-Llama-3.1-70B-Instruct --tensor-parallel-size 4 --port 8000`. This splits the 70B model across 4 GPUs (~20 GB per GPU at fp16).

NVLink-connected GPUs (A100, H100 SXM, RTX 3090/4090 with NVLink bridge) achieve near-linear scaling — 4x GPUs gives ~3.5x throughput. PCIe-connected GPUs have higher communication overhead — expect ~2.5–3x throughput from 4 GPUs. Check live GPU cloud prices for multi-GPU instance costs.

For pipeline parallelism (splitting layers across GPUs rather than within layers), use `--pipeline-parallel-size`. This is useful when GPUs are connected via PCIe and you want to minimise inter-GPU communication bandwidth.

Production deployment with nginx

Never expose vLLM directly to the internet. Put it behind nginx for TLS termination, rate limiting, and authentication. A minimal nginx config: set `proxy_pass http://127.0.0.1:8000;`, add `proxy_read_timeout 300s;` for long generations, and configure `limit_req_zone` to rate-limit by IP.

For API key authentication, vLLM supports `--api-key YOUR_SECRET_KEY` at startup. All requests must include `Authorization: Bearer YOUR_SECRET_KEY`. For more sophisticated auth (per-user keys, usage tracking), put a lightweight proxy like LiteLLM in front of vLLM.

Health check endpoint: `GET /health` returns 200 when the server is ready. Use this for load balancer health checks and Kubernetes readiness probes. The `/metrics` endpoint exposes Prometheus metrics including request latency, throughput, and queue depth.

For high availability, run multiple vLLM instances behind a load balancer. Each instance is stateless — requests can be routed to any instance. Use sticky sessions only if you need KV cache reuse across requests from the same user (prefix caching feature).

Cost and throughput benchmarks

On an H100 80GB SXM, vLLM serves Llama 3.1 70B at ~800–1,200 tokens/second throughput (across all concurrent requests) with continuous batching. At $2.50/hr (spot), that's $0.0006–0.0009 per 1,000 output tokens — cheaper than any managed API for this model tier.

On an A100 80GB, expect 400–600 tokens/second for the 70B model at ~$1.50–2.00/hr spot. For the 8B model on an RTX 4090 ($0.40–0.60/hr spot), throughput reaches 2,000–3,000 tokens/second — under $0.00006 per 1,000 tokens at full utilisation.

The self-hosted break-even vs managed APIs depends on utilisation. At 50% GPU utilisation, double these per-token costs. Use the LLM ROI Calculator to model your specific token volume and find the exact break-even point against managed API pricing.

Frequently asked questions

What GPUs does vLLM support?
vLLM supports all NVIDIA GPUs with CUDA compute capability 7.0+ (Volta and newer). This includes RTX 2080 through RTX 4090, A10G, A100, H100, and L40S. AMD GPU support via ROCm is available but less mature. Apple Silicon is not supported — use llama.cpp or Ollama for Mac.
How much VRAM do I need for vLLM?
Llama 3.1 8B at fp16 needs ~16 GB VRAM, or ~5 GB with AWQ quantisation. Llama 3.1 70B at fp16 needs ~140 GB (2x A100 80GB or 4x A100 40GB). With AWQ quantisation, the 70B model fits in ~40 GB (single A100 80GB). Add 10–20% for KV cache overhead.
Can vLLM serve multiple models simultaneously?
Not natively on a single instance — each vLLM process serves one model. For multi-model serving, run multiple vLLM instances on different ports and route requests with a proxy like LiteLLM or a custom nginx upstream. LiteLLM supports model routing, fallbacks, and unified billing across multiple vLLM backends.
How does vLLM compare to TGI (Text Generation Inference)?
Both are production-grade LLM servers with continuous batching. vLLM generally has higher throughput due to PagedAttention. TGI (by Hugging Face) has better support for some model architectures and tighter integration with the Hugging Face ecosystem. For Llama and Mistral models, vLLM is typically the better choice.
Does vLLM support streaming responses?
Yes. Add "stream": true to your request body and vLLM returns server-sent events (SSE) in the same format as OpenAI's streaming API. Streaming is important for chat applications where you want to show tokens as they generate rather than waiting for the full response.

More guides

Was this guide useful?