vllm
Operate, configure, benchmark, and troubleshoot vLLM inference servers: Docker and Kubernetes deployment, quantization-aware model configuration (tensor parallelism, KV cache), OpenAI-compatible API serving, throughput and latency benchmarking, continuous batching tuning, GPU ope
Install
npx skills add https://github.com/magnus919/agent-skills/tree/main/vllm
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install magnus919-agent-skills@llmmart
git clone https://github.com/magnus919/agent-skills.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole magnus919/agent-skills collection as a plugin from our marketplace. Git is the plain clone.
README
vLLM — Inference-Serving Skill
Operate, configure, benchmark, and troubleshoot vLLM inference servers: Docker and Kubernetes deployment, quantization-aware model configuration (tensor parallelism, KV cache), the OpenAI-compatible API surface, throughput/latency benchmarking, continuous batching tuning, GPU operation, and upgrade/rollback.
Why Install This Skill
Your agent can run a vLLM deployment instead of guessing. Teams that self-serve open models in production need someone (or something) that knows how to start a vllm serve with the right flags, size the model and its KV cache for the GPUs at hand, confirm the OpenAI-compatible endpoints actually work, measure throughput and latency with evidence that comparisons mean something, tune continuous batching one knob at a time, and upgrade or roll back without burning the deployment.
This skill ships that operating knowledge plus two fillable templates — a serving configuration record (so every deployment is reproducible) and a benchmark run record (so every performance claim is comparable) — and a read-only vllm-health probe that checks a running server's health, version, models, load, and metrics over HTTP without changing anything. The references are distilled from the official vLLM documentation with dated sources. Serving strategy and engine-selection methodology deliberately route up to ml-engineering; the llama.cpp stack routes to llama-cpp; this skill owns the day-to-day operation of vLLM itself.
Capacity testing starts with a configurable 1, 2, 4, 8, 10 concurrency sweep, extends when useful, and stops at declared safety limits. It separates active agents from simultaneous inference, tracks per-request tails and accepted tasks/hour, and tests shared-prefix caching without mistaking prefill savings for faster decoding. Version-aware checks cover resolved V1 defaults, actual KV demand, and the experimental GGUF plugin path.
What You Get
| Directory | Purpose |
|---|---|
SKILL.md |
Agent-facing operating loop, mutation gates, and verification boundaries |
references/ |
Seven dated, source-indexed references: source index, deployment, model configuration, OpenAI API, benchmarking, batching/tuning, GPU ops and lifecycle |
templates/serving-config.md |
Fillable record of every serving argument, model revision, and environment — the rollback unit |
templates/benchmark-run-record.md |
Fillable record that makes throughput/latency evidence comparable across runs |
scripts/vllm-health |
Read-only probe: health, version, models, load, and metrics; stdlib-only, --json, --help without a server |
tests/ |
Deterministic tests against a local stub HTTP server, including the read-only contract |
evals/ |
Output-quality cases plus assertion challenge examples; not performance measurements |
Quick Start
# Help works with no vLLM server
scripts/vllm-health --help
# Probe a running server, machine-readable
scripts/vllm-health --url http://127.0.0.1:8000 --json
# Targeted checks
scripts/vllm-health --check health --check models --json
# Record what you are about to run before you run it
# (fill in vllm/templates/serving-config.md), then:
docker run --runtime nvidia --gpus all \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=$HF_TOKEN" \
-p 8000:8000 --ipc=host \
vllm/vllm-openai:v0.26.0 \
--model <model-name> --served-model-name <api-name> --max-model-len <len>
# Benchmark serving throughput/latency once the server is ready
vllm bench serve --backend vllm --model <model-name> \
--endpoint /v1/completions --dataset-name custom \
--dataset-path prompts.jsonl --num-prompts 100 --request-rate inf
The vllm-health script uses only Python's standard library and issues GET requests only. Exit codes: 0 all checks passed, 1 issues found or a fatal error, 2 usage error, 124 timeout. Benchmark output includes request throughput (req/s), output token throughput (tok/s), and TTFT/TPOT/ITL percentiles — record them in templates/benchmark-run-record.md.
Triggers
Load this skill for vLLM operations: deploying or updating a vllm serve server (bare, Docker, or Kubernetes), choosing serving flags (--quantization, --tensor-parallel-size, --max-model-len, --kv-cache-dtype, --gpu-memory-utilization), wiring or debugging the OpenAI-compatible API surface (/v1/chat/completions, /v1/completions, /v1/models, /health, tool calling, chat templates), measuring serving throughput or latency (vllm bench serve/bench throughput), tuning continuous batching, running or diagnosing GPUs under a vLLM workload, or planning a vLLM upgrade or rollback. Do not load it for model training or fine-tuning (that's ml-engineering), for the llama.cpp stack (that's llama-cpp), or for generic Kubernetes/Docker administration (that's kubernetes/docker-compose).
Requirements
- A vLLM release: the
vllm/vllm-openaiDocker image (NVIDIA CUDA, AMD ROCm, or Intel XPU variants) orpip install vllm==<pinned-version>. - An accelerator with the matching driver (NVIDIA with the NVIDIA Container Toolkit for Docker, or the platform equivalent), or a supported CPU build for testing.
- Hugging Face access to the model: a mounted
~/.cache/huggingfaceand anHF_TOKENfor gated models. - Python 3.9+ for the
vllm-healthscript (--helpneeds nothing else); live probes need HTTP(S) access to the running server.
Skill manifest
vLLM Inference Serving
Use this skill to operate vLLM as a production inference server: deploy it with Docker or Kubernetes, configure the model and engine (quantization, tensor parallelism, KV cache, context length), serve the OpenAI-compatible API surface, benchmark throughput and latency with comparable evidence, tune continuous batching, operate the GPUs underneath, and upgrade or roll back safely. This is a tool skill for one named engine. Serving methodology — engine selection, quantization trade-offs, deployment plans, regression triage — belongs to ml-engineering; local single-node GGUF serving with the llama.cpp stack belongs to llama-cpp. This skill owns the day-to-day operation of vLLM itself.
Operating contract
- Record the deployment before tuning it. Capture the vLLM version or image digest, model and revision, quantization, parallelism,
max-model-len, KV cache settings, batching limits, GPU inventory, and workload. Inspect the installed release's help and resolved startup configuration, not just supplied flags: V1 enables chunked prefill where supported, and prefix caching may already be on; model/backend exceptions matter. The serving config template exists for exactly this. - Confirm the target, scope, and rollback path before acting. Read-only discovery (health probes,
/metrics,nvidia-smi) may proceed without confirmation. Mutations — restarting a server, changing serving args, scaling replicas, upgrading the image — require an explicit human directive naming the deployment. - A server that responds is not a server that serves.
/healthreturning 200 proves liveness, not that the model loaded or that inference works. Verify at the delivery boundary:/v1/modelsreports the served model and a representative request returns generated tokens. - Benchmark before and after every change. vLLM flags, defaults, and behavior change between releases; an unmeasured tuning change is a guess. Compare only matched conditions (version, model, GPU, context, batch, workload) and record the evidence in the benchmark run record.
- Keep evidence bounded. Summarize logs, configs, and metrics; never dump full server logs,
.envfiles, or HF tokens into chat.--enable-log-requestswith debug logging can leak prompt content; keep request logging off or redacted in shared sessions.
The vllm-health script
scripts/vllm-health is an agent-first, read-only probe for a running vLLM server. It issues GET requests only, never mutates, and emits bounded JSON.
scripts/vllm-health --help # no server needed
scripts/vllm-health --url http://127.0.0.1:8000 --json
scripts/vllm-health --check health --check models --json
scripts/vllm-health --check metrics --timeout 10 --json
Exit codes: 0 all checks passed, 1 issues found or a fatal error, 2 usage error, 124 timeout. Checks: health (/health), version (/version), models (/v1/models), load (/load), and metrics (a bounded prefix of /metrics). The script never sends data anywhere and never writes files.
Operating loop
- Identify the deployment: vLLM version or image digest, model and revision, served model name, parallelism, and how it is deployed (bare
vllm serve, Docker, Kubernetes). - Collect evidence: run
vllm-health --jsonfor health, version, models, and load; check/metricscounters (vllm:num_requests_running,vllm:num_requests_waiting,vllm:gpu_cache_usage_perc); inspect GPU state withnvidia-smi. - Triage against the symptom: map the problem to the evidence (OOM → KV cache or
gpu_memory_utilization; high latency → batching, TTFT vs TPOT; model not found → served name or chat template; slow start → model download or compile cache). - Act with confirmation: bounded, scoped changes after a human directive, with a rollback path named first.
- Verify: re-run the probe and the representative request at the delivery boundary, and re-benchmark if the change affects performance.
Deployment: Docker and Kubernetes
- Docker: the official image is
vllm/vllm-openai(Docker Hub). Run with GPU access, the Hugging Face cache mounted, the HF token for gated models, port 8000 published, and--ipc=host(or a--shm-size) for the shared memory tensor parallelism relies on. See references/01-deployment.md. - Kubernetes: a Deployment with
nvidia.com/gpu(oramd.com/gpu) resources, a PVC for the model cache, anemptyDirbacked by Memory at/dev/shm, liveness/readiness probes on/healthport 8000, and a Service. Raise probefailureThresholdfor large models that take minutes to load — a premature kill shows up asKeyboardInterrupt: terminatedin the container log. - Pin image tags to a release (for example
vllm/vllm-openai:v0.26.0) instead oflatest, and persist the compile cache (default~/.cache/vllm) across restarts sotorch.compileartifacts are reused.
Model configuration
- Model identity:
--modelis the HF repo or local path;--revisionpins the exact weights.--served-model-namesets the name clients must use in/v1requests and in themodelfield of responses.--trust-remote-codeis required for some model repos and should be reviewed before use. - Context length:
--max-model-lenbounds prompt plus output per request. Unset, it derives from the model config;-1/autoselects a length subject to memory/model limits on supporting releases. Distinguish this admission limit from the allocated KV pool and actual resident token lengths. Halving the configured limit does not automatically halve memory or double useful concurrency when actual token lengths stay fixed. - Quantization-aware serving: pass
--quantization(or-q) only when the model weights require it (GPTQ/AWQ/GGUF checkpoints load their scheme from config). Weight types and activation dtypes must match what the kernels support; a quantized model served at the wrong dtype fails to load or silently degrades. Hardware support varies by method (see references/02-model-configuration.md). - GGUF caveat: upstream calls vLLM GGUF support experimental, under-optimized, and potentially incompatible with other features. Current docs use the out-of-tree
vllm-gguf-pluginand recommend the base-model tokenizer. Verify the installed version/plugin path; a smaller checkpoint is not evidence of faster serving or feature parity. - Tensor parallelism:
--tensor-parallel-size Nshards one model across N GPUs in the same node;--pipeline-parallel-sizesplits layers across nodes. TP requires NVLink/fast interconnect and equal per-GPU memory; startup logs the memory profiling result, which is the evidence that the model fits. - KV cache: memory budgeting (
--gpu-memory-utilization, or an explicit KV pool size on supporting releases) and startup profiling determine the allocated pool.--kv-cache-dtype fp8can shrink per-token storage on supported configurations. Record the startup token capacity and concurrency estimate with its assumed request length. This is a memory estimate, not measured SLO capacity or a universal client-concurrency ceiling.
OpenAI-compatible API surface
- Basic endpoints:
/health(liveness),/version,/v1/models(served models),/load(load metrics),/metrics(Prometheus). Inference:/v1/completionsand/v1/chat/completions(chat requires the model to ship a chat template, or pass--chat-template);/v1/embeddingsfor pooling models;/v1/responsesfor the Responses API. - Streaming, tool calling (
--enable-auto-tool-choice --tool-call-parser openai), structured outputs, and parallel sampling are server-side options that change request/response behavior — verify each against the installed release rather than assuming parity. - Exposing the server beyond loopback requires an explicit decision about bind address, API keys, TLS or a trusted reverse proxy, and firewall rules. Development-only endpoints (
/reset_prefix_cache, weight transfer, profiling) must not be exposed in production.
Benchmarking: throughput and latency
- Online serving benchmark: run
vllm bench serveagainst a live server with a representative dataset (ShareGPT, a localcustomJSONL, or your own prompts) and fixed--num-prompts,--request-rate, and--max-concurrency. It reports request throughput (req/s), output token throughput (tok/s), total token throughput, and TTFT/TPOT/ITL percentiles. - Offline throughput:
vllm bench throughputmeasures raw engine throughput without the HTTP path; use it for engine-only comparisons, not end-to-end user latency. - Comparable evidence: the benchmark run record template freezes version, model, quantization, parallelism, context, batching, GPU, dataset, and load pattern. Never compare numbers across different conditions as if one variable changed. TTFT is a latency metric; token throughput is a throughput metric — an optimization that helps one can hurt the other.
- Capacity sweep: use configurable levels 1, 2, 4, 8, 10 as a starting plan, extending beyond ten when safe and useful. Stop at predefined memory, latency, error, thermal, or budget constraints. Measure requested/in-flight, queued, and running inference separately from active agents. Keep per-request tails, actual token distributions, failures/retries, and task outcomes; accepted tasks/hour needs linked task-level evaluation, not just HTTP success.
- Cache controls: compare cold/warm cache states and shared/non-shared prefixes under matched conditions. Prefix reuse saves prefill work; do not interpret its TTFT gain as faster decoding. See references/04-benchmarking.md for the full sweep protocol.
- For production capacity testing, vLLM's docs recommend the separate GuideLLM framework; this skill's scope is the bundled
vllm benchtools.
Continuous batching tuning
- vLLM batches continuously by default: the scheduler admits sequences as capacity frees up, mixing prefill and decode.
--max-num-seqscaps sequences per iteration,--max-num-batched-tokenscaps tokens per iteration, and--enable-chunked-prefilllets prefill share an iteration with decode. - Inspect resolved defaults, then change one knob at a time against the frozen benchmark: raising
--max-num-seqsmay improve batching but can increase latency and KV pressure; a benefit is a hypothesis to test, not a guarantee. --enable-prefix-cachingreuses KV blocks across requests with shared prefixes (chat system prompts, RAG contexts); the hit rate is visible in/metricsand in the benchmark's input token accounting.--performance-modetrades betweeninteractivity(latency) andthroughputat the kernel level.
GPU operation
- Verify GPUs with
nvidia-smi(orrocm-smion AMD): device list, memory, utilization, temperature, and ECC errors before and after changes.CUDA_VISIBLE_DEVICESselects which GPUs avllm serveprocess sees; tensor parallel ranks map to the visible devices in order. - Watch the installed release's cache-usage, running/waiting, preemption, and token metrics. High occupancy plus waiting requests suggests pressure; correlate it with preemptions and latency rather than declaring capacity from occupancy alone. Bound concurrency or actual token demand when needed; changing a context cap only helps demand if it changes admitted work.
- Diagnose OOM from its phase and allocation evidence: weights, activations, graph capture, KV pool, and competing processes all matter. Reducing a request limit alone is not a guaranteed memory fix. Verify a scoped change on scratch before applying it to production.
Upgrade and rollback
- Pin everything: image tag or
pip install vllm==<version>, model revision, and the full serving command.latestimages and unpinned revisions make rollback impossible and upgrades unreproducible. - Upgrade path: read the release notes for the full version span, review changed/removed flags (
--engine-argschange frequently), validate the new version on a scratch instance with the real model and workload, re-run the frozen benchmark, then swap with a rollback plan: previous image tag and previous serving config ready to reapply. - Rollback: because the config is versioned, rollback is a redeploy of the previous pinned image + config. KV cache layout, defaults, and flag names change between releases — do not assume a config that ran on v0.25.x behaves identically on v0.26.x without re-validating and re-benchmarking.
Reference routing
| Load when | Reference |
|---|---|
| Sources, version observations, refresh procedure | references/00-source-index.md |
| Docker and Kubernetes deployment, image pinning, probes, storage | references/01-deployment.md |
| Model config: quantization, tensor parallelism, KV cache, memory budgeting | references/02-model-configuration.md |
| OpenAI-compatible API surface, chat templates, tools, auth | references/03-openai-api.md |
Benchmarking methodology and vllm bench commands |
references/04-benchmarking.md |
| Continuous batching, chunked prefill, prefix caching, performance mode | references/05-batching-and-tuning.md |
| GPU operation, observability, upgrade/rollback, troubleshooting | references/06-gpu-ops-and-lifecycle.md |
Included artifacts
scripts/vllm-health: read-only health/version/models/load/metrics probe (stdlib-only,--json,--checksubsets,--helpwithout a server).tests/test_vllm_health.py: deterministic tests against a local stub HTTP server, including the read-only contract.templates/serving-config.mdandtemplates/benchmark-run-record.md: fillable records that make deployments reproducible and benchmark evidence comparable.references/: seven dated, source-indexed references covering the operational topics above.evals/evals.json: output-quality cases for agent runs;evals/serving-evidence-challenges.mdrecords rubric changes and challenge examples, not runtime evidence.
Verification boundary
| Claim | Minimum evidence |
|---|---|
| The server is alive | vllm-health --check health reports /health 200 |
| The right model is served | /v1/models lists the expected served model name |
| Inference works | A representative /v1/chat/completions or /v1/completions request returns generated tokens with a finish_reason |
| The model fits | Startup log shows memory profiling completed and GPU KV cache size: N tokens for the configured parallelism |
| A tuning change helped | The frozen benchmark shows the declared metric improving with matched conditions, variance reported |
| The deployment is upgradable | Previous pinned image + serving config are recorded and the upgrade was rehearsed on a scratch instance |
| A diagnosis is sound | Evidence was collected before the claim, and the fix was verified by re-running the probe and the benchmark |
Hard boundaries
- Never restart, redeploy, scale, or upgrade a vLLM deployment without an explicit human directive naming the target and a stated rollback path. Read-only discovery may proceed freely.
- Never expose an unauthenticated server beyond loopback by accident; development-only endpoints and profiling routes must stay off production ingress.
- Never print or commit HF tokens,
.envcontents, or full server logs; summarize evidence instead. - Never compare benchmark numbers from different versions, models, quants, parallelism, contexts, batches, or workloads as if one variable changed.
- Never run
vllm-healthas anything but what it is — read-only. It has no mutation surface.
When not to use
- Model training, fine-tuning, evaluation-set design, quantization decisions, and serving methodology — that is ml-engineering.
- The llama.cpp stack (llama-cli, llama-server, GGUF conversion and quantization, local Metal/CUDA builds) — that is llama-cpp.
- Other inference engines (TGI, Ollama, Triton, vLLM's embedding/rerank-only workloads are in scope, but engine selection among them is not) — engine-selection trade-offs belong to
ml-engineering. - Kubernetes and Docker fundamentals (manifests, RBAC, image registries, GPU device plugins) — that is kubernetes and docker-compose.
- GPU infrastructure provisioning (drivers, cluster scheduling, capacity planning) — that is platform-engineering; this skill operates the GPUs a vLLM server already targets.
Files (agent-skills)
-
evals
-
evals.json 17.3 KB
Loading… -
serving-evidence-challenges.md 15.5 KB
Loading…
-
-
references
-
00-source-index.md 5.8 KB
Loading… -
01-deployment.md 5.3 KB
Loading… -
02-model-configuration.md 6.5 KB
Loading… -
03-openai-api.md 3.2 KB
Loading… -
04-benchmarking.md 8.7 KB
Loading… -
05-batching-and-tuning.md 5.1 KB
Loading… -
06-gpu-ops-and-lifecycle.md 5.2 KB
Loading…
-
-
scripts
-
vllm-health 7.2 KB · in bundle
-
-
templates
-
benchmark-run-record.md 4.6 KB
Loading… -
serving-config.md 3.3 KB
Loading…
-
-
tests
-
test_vllm_health.py 8.4 KB
Loading…
-
-
README.md 5.3 KB
# vLLM — Inference-Serving Skill Operate, configure, benchmark, and troubleshoot vLLM inference servers: Docker and Kubernetes deployment, quantization-aware model configuration (tensor parallelism, KV cache), the OpenAI-compatible API surface, throughput/latency benchmarking, continuous batching tuning, GPU operation, and upgrade/rollback. ## Why Install This Skill Your agent can run a vLLM deployment instead of guessing. Teams that self-serve open models in production need someone (or something) that knows how to start a `vllm serve` with the right flags, size the model and its KV cache for the GPUs at hand, confirm the OpenAI-compatible endpoints actually work, measure throughput and latency with evidence that comparisons mean something, tune continuous batching one knob at a time, and upgrade or roll back without burning the deployment. This skill ships that operating knowledge plus two fillable templates — a serving configuration record (so every deployment is reproducible) and a benchmark run record (so every performance claim is comparable) — and a read-only `vllm-health` probe that checks a running server's health, version, models, load, and metrics over HTTP without changing anything. The references are distilled from the official vLLM documentation with dated sources. Serving strategy and engine-selection methodology deliberately route up to `ml-engineering`; the llama.cpp stack routes to `llama-cpp`; this skill owns the day-to-day operation of vLLM itself. Capacity testing starts with a configurable 1, 2, 4, 8, 10 concurrency sweep, extends when useful, and stops at declared safety limits. It separates active agents from simultaneous inference, tracks per-request tails and accepted tasks/hour, and tests shared-prefix caching without mistaking prefill savings for faster decoding. Version-aware checks cover resolved V1 defaults, actual KV demand, and the experimental GGUF plugin path. ## What You Get | Directory | Purpose | |---|---| | `SKILL.md` | Agent-facing operating loop, mutation gates, and verification boundaries | | `references/` | Seven dated, source-indexed references: source index, deployment, model configuration, OpenAI API, benchmarking, batching/tuning, GPU ops and lifecycle | | `templates/serving-config.md` | Fillable record of every serving argument, model revision, and environment — the rollback unit | | `templates/benchmark-run-record.md` | Fillable record that makes throughput/latency evidence comparable across runs | | `scripts/vllm-health` | Read-only probe: health, version, models, load, and metrics; stdlib-only, `--json`, `--help` without a server | | `tests/` | Deterministic tests against a local stub HTTP server, including the read-only contract | | `evals/` | Output-quality cases plus assertion challenge examples; not performance measurements | ## Quick Start ```bash # Help works with no vLLM server scripts/vllm-health --help # Probe a running server, machine-readable scripts/vllm-health --url http://127.0.0.1:8000 --json # Targeted checks scripts/vllm-health --check health --check models --json # Record what you are about to run before you run it # (fill in vllm/templates/serving-config.md), then: docker run --runtime nvidia --gpus all \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=$HF_TOKEN" \ -p 8000:8000 --ipc=host \ vllm/vllm-openai:v0.26.0 \ --model <model-name> --served-model-name <api-name> --max-model-len <len> # Benchmark serving throughput/latency once the server is ready vllm bench serve --backend vllm --model <model-name> \ --endpoint /v1/completions --dataset-name custom \ --dataset-path prompts.jsonl --num-prompts 100 --request-rate inf ``` The `vllm-health` script uses only Python's standard library and issues GET requests only. Exit codes: 0 all checks passed, 1 issues found or a fatal error, 2 usage error, 124 timeout. Benchmark output includes request throughput (req/s), output token throughput (tok/s), and TTFT/TPOT/ITL percentiles — record them in `templates/benchmark-run-record.md`. ## Triggers Load this skill for vLLM operations: deploying or updating a `vllm serve` server (bare, Docker, or Kubernetes), choosing serving flags (`--quantization`, `--tensor-parallel-size`, `--max-model-len`, `--kv-cache-dtype`, `--gpu-memory-utilization`), wiring or debugging the OpenAI-compatible API surface (`/v1/chat/completions`, `/v1/completions`, `/v1/models`, `/health`, tool calling, chat templates), measuring serving throughput or latency (`vllm bench serve`/`bench throughput`), tuning continuous batching, running or diagnosing GPUs under a vLLM workload, or planning a vLLM upgrade or rollback. Do not load it for model training or fine-tuning (that's `ml-engineering`), for the llama.cpp stack (that's `llama-cpp`), or for generic Kubernetes/Docker administration (that's `kubernetes`/`docker-compose`). ## Requirements - A vLLM release: the `vllm/vllm-openai` Docker image (NVIDIA CUDA, AMD ROCm, or Intel XPU variants) or `pip install vllm==<pinned-version>`. - An accelerator with the matching driver (NVIDIA with the NVIDIA Container Toolkit for Docker, or the platform equivalent), or a supported CPU build for testing. - Hugging Face access to the model: a mounted `~/.cache/huggingface` and an `HF_TOKEN` for gated models. - Python 3.9+ for the `vllm-health` script (`--help` needs nothing else); live probes need HTTP(S) access to the running server. -
SKILL.md 17.8 KB
--- name: vllm description: >- Operate, configure, benchmark, and troubleshoot vLLM inference servers: Docker and Kubernetes deployment, quantization-aware model configuration (tensor parallelism, KV cache), OpenAI-compatible API serving, throughput and latency benchmarking, continuous batching tuning, GPU operation, and upgrade/rollback. Use when deploying or running a vLLM server (vllm serve, vllm/vllm-openai), sizing a model and its KV cache for GPUs, selecting quantization and parallelism, serving via /v1 endpoints, measuring serving throughput or latency, tuning batching, or diagnosing GPU, OOM, or startup failures in a vLLM deployment. Do not use for model training, fine-tuning, evaluation-set design, or engine-selection methodology (that is ml-engineering), or for operating the llama.cpp stack with GGUF models (that is llama-cpp); other inference engines (TGI, Ollama, Triton) are out of scope. license: MIT compatibility: >- Requires a vLLM release (v0.26.0 or a pinned older release), an NVIDIA CUDA, AMD ROCm, or Intel XPU GPU with the matching driver, or a supported CPU build. The bundled vllm-health script runs on Python 3.9+ and needs no vLLM server for --help; live probes require HTTP(S) access to a running vLLM server. metadata: source: https://docs.vllm.ai/en/latest/ source_index: references/00-source-index.md research_checked: "2026-11-08" --- # vLLM Inference Serving Use this skill to operate **vLLM** as a production inference server: deploy it with Docker or Kubernetes, configure the model and engine (quantization, tensor parallelism, KV cache, context length), serve the OpenAI-compatible API surface, benchmark throughput and latency with comparable evidence, tune continuous batching, operate the GPUs underneath, and upgrade or roll back safely. This is a **tool skill** for one named engine. Serving *methodology* — engine selection, quantization trade-offs, deployment plans, regression triage — belongs to [ml-engineering](../ml-engineering/SKILL.md); local single-node GGUF serving with the llama.cpp stack belongs to [llama-cpp](../llama-cpp/SKILL.md). This skill owns the day-to-day operation of vLLM itself. ## Operating contract 1. **Record the deployment before tuning it.** Capture the vLLM version or image digest, model and revision, quantization, parallelism, `max-model-len`, KV cache settings, batching limits, GPU inventory, and workload. Inspect the installed release's help and resolved startup configuration, not just supplied flags: V1 enables chunked prefill where supported, and prefix caching may already be on; model/backend exceptions matter. The [serving config template](templates/serving-config.md) exists for exactly this. 2. **Confirm the target, scope, and rollback path before acting.** Read-only discovery (health probes, `/metrics`, `nvidia-smi`) may proceed without confirmation. Mutations — restarting a server, changing serving args, scaling replicas, upgrading the image — require an explicit human directive naming the deployment. 3. **A server that responds is not a server that serves.** `/health` returning 200 proves liveness, not that the model loaded or that inference works. Verify at the delivery boundary: `/v1/models` reports the served model and a representative request returns generated tokens. 4. **Benchmark before and after every change.** vLLM flags, defaults, and behavior change between releases; an unmeasured tuning change is a guess. Compare only matched conditions (version, model, GPU, context, batch, workload) and record the evidence in the [benchmark run record](templates/benchmark-run-record.md). 5. **Keep evidence bounded.** Summarize logs, configs, and metrics; never dump full server logs, `.env` files, or HF tokens into chat. `--enable-log-requests` with debug logging can leak prompt content; keep request logging off or redacted in shared sessions. ## The vllm-health script `scripts/vllm-health` is an agent-first, read-only probe for a running vLLM server. It issues GET requests only, never mutates, and emits bounded JSON. ```bash scripts/vllm-health --help # no server needed scripts/vllm-health --url http://127.0.0.1:8000 --json scripts/vllm-health --check health --check models --json scripts/vllm-health --check metrics --timeout 10 --json ``` Exit codes: 0 all checks passed, 1 issues found or a fatal error, 2 usage error, 124 timeout. Checks: `health` (`/health`), `version` (`/version`), `models` (`/v1/models`), `load` (`/load`), and `metrics` (a bounded prefix of `/metrics`). The script never sends data anywhere and never writes files. ## Operating loop 1. **Identify the deployment**: vLLM version or image digest, model and revision, served model name, parallelism, and how it is deployed (bare `vllm serve`, Docker, Kubernetes). 2. **Collect evidence**: run `vllm-health --json` for health, version, models, and load; check `/metrics` counters (`vllm:num_requests_running`, `vllm:num_requests_waiting`, `vllm:gpu_cache_usage_perc`); inspect GPU state with `nvidia-smi`. 3. **Triage against the symptom**: map the problem to the evidence (OOM → KV cache or `gpu_memory_utilization`; high latency → batching, TTFT vs TPOT; model not found → served name or chat template; slow start → model download or compile cache). 4. **Act with confirmation**: bounded, scoped changes after a human directive, with a rollback path named first. 5. **Verify**: re-run the probe and the representative request at the delivery boundary, and re-benchmark if the change affects performance. ## Deployment: Docker and Kubernetes - **Docker**: the official image is `vllm/vllm-openai` (Docker Hub). Run with GPU access, the Hugging Face cache mounted, the HF token for gated models, port 8000 published, and `--ipc=host` (or a `--shm-size`) for the shared memory tensor parallelism relies on. See [references/01-deployment.md](references/01-deployment.md). - **Kubernetes**: a Deployment with `nvidia.com/gpu` (or `amd.com/gpu`) resources, a PVC for the model cache, an `emptyDir` backed by Memory at `/dev/shm`, liveness/readiness probes on `/health` port 8000, and a Service. Raise probe `failureThreshold` for large models that take minutes to load — a premature kill shows up as `KeyboardInterrupt: terminated` in the container log. - Pin image tags to a release (for example `vllm/vllm-openai:v0.26.0`) instead of `latest`, and persist the compile cache (default `~/.cache/vllm`) across restarts so `torch.compile` artifacts are reused. ## Model configuration - **Model identity**: `--model` is the HF repo or local path; `--revision` pins the exact weights. `--served-model-name` sets the name clients must use in `/v1` requests and in the `model` field of responses. `--trust-remote-code` is required for some model repos and should be reviewed before use. - **Context length**: `--max-model-len` bounds prompt plus output per request. Unset, it derives from the model config; `-1`/`auto` selects a length subject to memory/model limits on supporting releases. Distinguish this admission limit from the allocated KV pool and actual resident token lengths. Halving the configured limit does not automatically halve memory or double useful concurrency when actual token lengths stay fixed. - **Quantization-aware serving**: pass `--quantization` (or `-q`) only when the model weights require it (GPTQ/AWQ/GGUF checkpoints load their scheme from config). Weight types and activation dtypes must match what the kernels support; a quantized model served at the wrong dtype fails to load or silently degrades. Hardware support varies by method (see [references/02-model-configuration.md](references/02-model-configuration.md)). - **GGUF caveat**: upstream calls vLLM GGUF support experimental, under-optimized, and potentially incompatible with other features. Current docs use the out-of-tree `vllm-gguf-plugin` and recommend the base-model tokenizer. Verify the installed version/plugin path; a smaller checkpoint is not evidence of faster serving or feature parity. - **Tensor parallelism**: `--tensor-parallel-size N` shards one model across N GPUs in the same node; `--pipeline-parallel-size` splits layers across nodes. TP requires NVLink/fast interconnect and equal per-GPU memory; startup logs the memory profiling result, which is the evidence that the model fits. - **KV cache**: memory budgeting (`--gpu-memory-utilization`, or an explicit KV pool size on supporting releases) and startup profiling determine the allocated pool. `--kv-cache-dtype fp8` can shrink per-token storage on supported configurations. Record the startup token capacity and concurrency estimate with its assumed request length. This is a memory estimate, not measured SLO capacity or a universal client-concurrency ceiling. ## OpenAI-compatible API surface - Basic endpoints: `/health` (liveness), `/version`, `/v1/models` (served models), `/load` (load metrics), `/metrics` (Prometheus). Inference: `/v1/completions` and `/v1/chat/completions` (chat requires the model to ship a chat template, or pass `--chat-template`); `/v1/embeddings` for pooling models; `/v1/responses` for the Responses API. - Streaming, tool calling (`--enable-auto-tool-choice --tool-call-parser openai`), structured outputs, and parallel sampling are server-side options that change request/response behavior — verify each against the installed release rather than assuming parity. - Exposing the server beyond loopback requires an explicit decision about bind address, API keys, TLS or a trusted reverse proxy, and firewall rules. Development-only endpoints (`/reset_prefix_cache`, weight transfer, profiling) must not be exposed in production. ## Benchmarking: throughput and latency - **Online serving benchmark**: run `vllm bench serve` against a live server with a representative dataset (ShareGPT, a local `custom` JSONL, or your own prompts) and fixed `--num-prompts`, `--request-rate`, and `--max-concurrency`. It reports request throughput (req/s), output token throughput (tok/s), total token throughput, and TTFT/TPOT/ITL percentiles. - **Offline throughput**: `vllm bench throughput` measures raw engine throughput without the HTTP path; use it for engine-only comparisons, not end-to-end user latency. - **Comparable evidence**: the benchmark run record template freezes version, model, quantization, parallelism, context, batching, GPU, dataset, and load pattern. Never compare numbers across different conditions as if one variable changed. TTFT is a latency metric; token throughput is a throughput metric — an optimization that helps one can hurt the other. - **Capacity sweep**: use configurable levels **1, 2, 4, 8, 10** as a starting plan, extending beyond ten when safe and useful. Stop at predefined memory, latency, error, thermal, or budget constraints. Measure requested/in-flight, queued, and running inference separately from active agents. Keep per-request tails, actual token distributions, failures/retries, and task outcomes; accepted tasks/hour needs linked task-level evaluation, not just HTTP success. - **Cache controls**: compare cold/warm cache states and shared/non-shared prefixes under matched conditions. Prefix reuse saves prefill work; do not interpret its TTFT gain as faster decoding. See [references/04-benchmarking.md](references/04-benchmarking.md) for the full sweep protocol. - For production capacity testing, vLLM's docs recommend the separate GuideLLM framework; this skill's scope is the bundled `vllm bench` tools. ## Continuous batching tuning - vLLM batches continuously by default: the scheduler admits sequences as capacity frees up, mixing prefill and decode. `--max-num-seqs` caps sequences per iteration, `--max-num-batched-tokens` caps tokens per iteration, and `--enable-chunked-prefill` lets prefill share an iteration with decode. - Inspect resolved defaults, then change one knob at a time against the frozen benchmark: raising `--max-num-seqs` may improve batching but can increase latency and KV pressure; a benefit is a hypothesis to test, not a guarantee. - `--enable-prefix-caching` reuses KV blocks across requests with shared prefixes (chat system prompts, RAG contexts); the hit rate is visible in `/metrics` and in the benchmark's input token accounting. `--performance-mode` trades between `interactivity` (latency) and `throughput` at the kernel level. ## GPU operation - Verify GPUs with `nvidia-smi` (or `rocm-smi` on AMD): device list, memory, utilization, temperature, and ECC errors before and after changes. `CUDA_VISIBLE_DEVICES` selects which GPUs a `vllm serve` process sees; tensor parallel ranks map to the visible devices in order. - Watch the installed release's cache-usage, running/waiting, preemption, and token metrics. High occupancy plus waiting requests suggests pressure; correlate it with preemptions and latency rather than declaring capacity from occupancy alone. Bound concurrency or actual token demand when needed; changing a context cap only helps demand if it changes admitted work. - Diagnose OOM from its phase and allocation evidence: weights, activations, graph capture, KV pool, and competing processes all matter. Reducing a request limit alone is not a guaranteed memory fix. Verify a scoped change on scratch before applying it to production. ## Upgrade and rollback - **Pin everything**: image tag or `pip install vllm==<version>`, model revision, and the full serving command. `latest` images and unpinned revisions make rollback impossible and upgrades unreproducible. - **Upgrade path**: read the release notes for the full version span, review changed/removed flags (`--engine-args` change frequently), validate the new version on a scratch instance with the real model and workload, re-run the frozen benchmark, then swap with a rollback plan: previous image tag and previous serving config ready to reapply. - **Rollback**: because the config is versioned, rollback is a redeploy of the previous pinned image + config. KV cache layout, defaults, and flag names change between releases — do not assume a config that ran on v0.25.x behaves identically on v0.26.x without re-validating and re-benchmarking. ## Reference routing | Load when | Reference | |---|---| | Sources, version observations, refresh procedure | `references/00-source-index.md` | | Docker and Kubernetes deployment, image pinning, probes, storage | `references/01-deployment.md` | | Model config: quantization, tensor parallelism, KV cache, memory budgeting | `references/02-model-configuration.md` | | OpenAI-compatible API surface, chat templates, tools, auth | `references/03-openai-api.md` | | Benchmarking methodology and `vllm bench` commands | `references/04-benchmarking.md` | | Continuous batching, chunked prefill, prefix caching, performance mode | `references/05-batching-and-tuning.md` | | GPU operation, observability, upgrade/rollback, troubleshooting | `references/06-gpu-ops-and-lifecycle.md` | ## Included artifacts - `scripts/vllm-health`: read-only health/version/models/load/metrics probe (stdlib-only, `--json`, `--check` subsets, `--help` without a server). - `tests/test_vllm_health.py`: deterministic tests against a local stub HTTP server, including the read-only contract. - `templates/serving-config.md` and `templates/benchmark-run-record.md`: fillable records that make deployments reproducible and benchmark evidence comparable. - `references/`: seven dated, source-indexed references covering the operational topics above. - `evals/evals.json`: output-quality cases for agent runs; `evals/serving-evidence-challenges.md` records rubric changes and challenge examples, not runtime evidence. ## Verification boundary | Claim | Minimum evidence | |---|---| | The server is alive | `vllm-health --check health` reports `/health` 200 | | The right model is served | `/v1/models` lists the expected served model name | | Inference works | A representative `/v1/chat/completions` or `/v1/completions` request returns generated tokens with a `finish_reason` | | The model fits | Startup log shows memory profiling completed and `GPU KV cache size: N tokens` for the configured parallelism | | A tuning change helped | The frozen benchmark shows the declared metric improving with matched conditions, variance reported | | The deployment is upgradable | Previous pinned image + serving config are recorded and the upgrade was rehearsed on a scratch instance | | A diagnosis is sound | Evidence was collected before the claim, and the fix was verified by re-running the probe and the benchmark | ## Hard boundaries - Never restart, redeploy, scale, or upgrade a vLLM deployment without an explicit human directive naming the target and a stated rollback path. Read-only discovery may proceed freely. - Never expose an unauthenticated server beyond loopback by accident; development-only endpoints and profiling routes must stay off production ingress. - Never print or commit HF tokens, `.env` contents, or full server logs; summarize evidence instead. - Never compare benchmark numbers from different versions, models, quants, parallelism, contexts, batches, or workloads as if one variable changed. - Never run `vllm-health` as anything but what it is — read-only. It has no mutation surface. ## When not to use - **Model training, fine-tuning, evaluation-set design, quantization decisions, and serving methodology** — that is [ml-engineering](../ml-engineering/SKILL.md). - **The llama.cpp stack** (llama-cli, llama-server, GGUF conversion and quantization, local Metal/CUDA builds) — that is [llama-cpp](../llama-cpp/SKILL.md). - **Other inference engines** (TGI, Ollama, Triton, vLLM's embedding/rerank-only workloads are in scope, but engine selection among them is not) — engine-selection trade-offs belong to `ml-engineering`. - **Kubernetes and Docker fundamentals** (manifests, RBAC, image registries, GPU device plugins) — that is [kubernetes](../kubernetes/SKILL.md) and [docker-compose](../docker-compose/SKILL.md). - **GPU infrastructure provisioning** (drivers, cluster scheduling, capacity planning) — that is [platform-engineering](../platform-engineering/SKILL.md); this skill operates the GPUs a vLLM server already targets.
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.