Serve an LLM with vLLM
vLLM is a serving engine built for throughput. It batches many requests continuously on one GPU and loads the original safetensors weights from Hugging Face instead of GGUF files. It runs on Linux with NVIDIA or AMD GPUs.
Pick vLLM when
- Several people or agents use the model at the same time.
- You run on a datacenter GPU and want the most tokens per dollar.
- You want the unquantized weights, or an FP8 build.
Look elsewhere when
- The model does not fully fit in VRAM: vLLM has no CPU offload.
- You are on a Mac or Windows desktop.
1. Install
Linux with an NVIDIA GPU
Create an environment with uv and let it pick the PyTorch build for your CUDA driver. Python 3.11 to 3.14.
AMD GPUs
Install from the ROCm wheel index.
Check that it worked
2. Run a model
Example: Qwen 3.8 27B as FP8 on NVIDIA L40S (48 GB). With a 16K context it needs 31.8 GB of 46.2 GB usable memory and should generate about 16.2–27 tok/s, with room for 15 requests in parallel.
Size your own model and hardware for vLLM3. The settings that decide memory use
Set the context window
--max-model-len caps prompt plus output. Left out, vLLM takes the model's maximum and refuses to start if a single request of that length does not fit. --max-model-len auto picks the largest length that fits.
Halve the KV cache
Store the KV cache in FP8 instead of the model's data type. Every request then needs half the cache, so twice as many fit.
Reading nvidia-smi
vLLM uses the VRAM the weights leave over as KV cache for parallel requests. A nearly full GPU in nvidia-smi is normal and does not mean the model barely fits.
4. Connect your tools
Use it from other tools
The server exposes an OpenAI-compatible API on http://localhost:8000. It hosts one model per process.
Or let your coding agent do it
Paste this into Claude Code, Codex or any agent with a shell. It carries the target, our estimates and the steps, and tells the agent to check the hardware first and to report measured memory and speed against the estimates. The calculator builds the same prompt for any model, hardware and runtime.
Set up a local LLM on this machine and verify that it works. Target - Model: Qwen 3.8 27B (Hugging Face: Qwen/Qwen3.8-27B) - Runtime: vLLM - Build: FP8, RedHatAI/Qwen3.8-27B-FP8 - Context window: 16,384 tokens (16K) - Hardware this was sized for: NVIDIA L40S (48 GB) Estimates from llmsizing.com - Memory: 31.8 GB of 46.2 GB usable (weights 28.8 GB, KV cache 1.0 GB, approximate, overhead 2.0 GB) - Fit: Fits comfortably. 14.4 GB headroom left for a longer context or other apps. - Speed: 16.2–27 tok/s for one request. Modelled from memory bandwidth and model size. No published measurement covers this setup. - Parallel requests at this context length: about 15 Steps 1. Check the hardware before downloading anything (`nvidia-smi`, or the vendor's equivalent). If it is not NVIDIA L40S (48 GB), or less than 31.8 GB of memory is free, stop and tell me what you found. 2. Check whether vLLM is installed with `vllm --help`. If it is not, install it: - Linux with an NVIDIA GPU: `uv venv --python 3.14 --seed && source .venv/bin/activate && uv pip install vllm --torch-backend=auto` - AMD GPUs: `uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm/` 3. Start the model: `vllm serve RedHatAI/Qwen3.8-27B-FP8 --max-model-len 16384` 4. Send one short test prompt. Then report, next to the estimates above: memory actually used (`nvidia-smi`), tokens per second, and whether everything runs on the GPU. 5. Tell me the base URL and model name to use from other tools. vLLM API: http://localhost:8000/v1. Rules - Ask me before using sudo, changing system settings or installing system packages. - Do not delete or replace models that are already on this machine. - If the download is larger than the free disk space, stop and tell me. - If the measured memory or speed is far from the estimates, say so plainly. Sized with https://llmsizing.com/?m=qwen3-8-27b&hw=nvidia-l40s-48gb&q=q8_0&ctx=16384&rt=vllm Setup guide: https://llmsizing.com/guides/vllm
How to read our numbers for vLLM
The question for vLLM is not how much memory it uses, since it puts all of it to work, but whether weights plus one request of your context length fit, and how many such requests fit at once. Our vLLM numbers use the safetensors sizes from Hugging Face and count every layer's cache at full length.
- Gated models need a Hugging Face token in HF_TOKEN.
- Several GPUs need
--tensor-parallel-size N; otherwise only the first is used.