vLLM Cheatsheet
vLLM is a high-throughput LLM inference serving engine featuring PagedAttention and Continuous Batching for optimal GPU utilization. It supports multi-GPU tensor/pipeline parallelism, hot-loaded LoRA adapters, and an OpenAI-compatible API — the standard choice for production LLM deployment.
Quick Start
``bash
# Install
pip install vllm
# Start serving a model vllm serve meta-llama/Llama-3.1-8b --host 0.0.0.0 --port 8000
# Test with curl curl -s http://localhost:8000/v1/chat/completions \ -d '{"model":"meta-llama/Llama-3.1-8b","messages":[{"role":"user","content":"Hello"}],"max_tokens":100}'
# Check loaded models
curl -s http://localhost:8000/v1/models | jq .
`
Model Serving
vllm serve is the core command. Models can be HuggingFace IDs (e.g., meta-llama/Llama-3.1-8b) or local paths. Key flags: --port, --host, --dtype, --max-model-len, --gpu-memory-utilization.
Multi-GPU Inference
For large models, split across GPUs with tensor parallel (--tensor-parallel-size) or pipeline parallel (--pipeline-parallel-size). Both can be combined for very large deployments.
LoRA Adapter Support
vLLM supports hot-loading LoRA adapters without restarting. Enable with --enable-lora and register modules with --lora-modules. Multiple adapters coexist; select per-request by specifying the module name as the model.
Memory Optimization
--gpu-memory-utilization controls VRAM usage (default 0.9). --kv-cache-dtype fp8 halves KV cache memory. --max-model-len limits context size. --max-num-seqs controls request concurrency.
OpenAI-Compatible API
vLLM serves endpoints at /v1/chat/completions, /v1/completions, /v1/embeddings, and /v1/models`. Any OpenAI SDK can target vLLM by changing the base URL.
Startup & Modes(2)
| Command | Level | ||
|---|---|---|---|
vllm --helpShow vLLM CLI help | Basic | vllm --help | |
pip install vllmInstall vLLM | Basic | pip install vllm |
ai-server(19)
| Command | Level | ||
|---|---|---|---|
vllm serveStart model inference server (core command) | Basic | vllm serve facebook/opt-125m | |
vllm serve --portSpecify server port (default 8000) | Basic | vllm serve meta-llama/Llama-3.1-8b --port 8080 | |
vllm serve --hostSpecify bind host address | Basic | vllm serve meta-llama/Llama-3.1-8b --host 0.0.0.0 | |
vllm serve --tensor-parallel-sizeSet tensor parallel size (multi-GPU) | Expert | vllm serve meta-llama/Llama-3.1-8b --tensor-parallel-size 2 | |
vllm serve --pipeline-parallel-sizeSet pipeline parallel size | Expert | vllm serve meta-llama/Llama-3.1-70b --pipeline-parallel-size 4 | |
vllm serve --dtypeSpecify inference precision | Intermediate | vllm serve meta-llama/Llama-3.1-8b --dtype bfloat16 | |
vllm serve --max-model-lenSet maximum model context length | Intermediate | vllm serve meta-llama/Llama-3.1-8b --max-model-len 16384 | |
vllm serve --gpu-memory-utilizationSet GPU memory utilization (0-1) | Intermediate | vllm serve phi-4 --gpu-memory-utilization 0.85 | |
vllm serve --enable-loraEnable LoRA adapter support | Expert | vllm serve meta-llama/Llama-3.1-8b --enable-lora | |
vllm serve --lora-modulesLoad specified LoRA modules | Expert | vllm serve meta-llama/Llama-3.1-8b --enable-lora --lora-modules my-lora=/path/to/lora | |
vllm serve --api-keySet API key authentication | Intermediate | vllm serve meta-llama/Llama-3.1-8b --api-key sk-my-key | |
vllm serve --tokenizer-modeSet tokenizer mode (auto/slow) | Expert | vllm serve microsoft/phi-4 --tokenizer-mode slow | |
vllm serve --load-formatSpecify model load format | Expert | vllm serve ./local-model --load-format safetensors | |
curl http://localhost:8000/v1/chat/completionsSend OpenAI-compatible chat request to vLLM | Intermediate | curl -s http://localhost:8000/v1/chat/completions -d '{"model":"meta-llama/Llama-3.1-8b","messages":[{"role":"user","content":"Hello"}]}'
| |
curl http://localhost:8000/v1/completionsSend text completion request to vLLM | Intermediate | curl -s http://localhost:8000/v1/completions -d '{"model":"meta-llama/Llama-3.1-8b","prompt":"Hello","max_tokens":100}'
| |
curl http://localhost:8000/v1/modelsList models loaded in vLLM server | Basic | curl -s http://localhost:8000/v1/models | jq . | |
curl http://localhost:8000/healthCheck vLLM server health | Basic | curl -s http://localhost:8000/health | |
vllm serve --kv-cache-dtypeSpecify KV cache dtype (auto/fp8) | Expert | vllm serve meta-llama/Llama-3.1-8b --kv-cache-dtype fp8 | |
vllm serve --max-num-seqsSet max concurrent sequences | Expert | vllm serve meta-llama/Llama-3.1-8b --max-num-seqs 32 |
ai-eval(1)
| Command | Level | ||
|---|---|---|---|
vllm benchvLLM benchmark | Expert | vllm bench latency --model meta-llama/Llama-3.1-8b |