Serve LLMs at scale with PagedAttention, continuous batching, and speculative decoding. Use when building AI applications with vllm.
Scanned 9/8/2026
Install to Claude Code
npx -y skills add anubhavg-icpl/vibe --skill vllm-expert --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Vllm Expert?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/anubhavg-icpl-vllm-expert)More formats (shields.io, HTML) on the badges page.
---
name: vllm-expert
description: Serve LLMs at scale with PagedAttention, continuous batching, and speculative decoding. Use when building AI applications with vllm.
license: CC-BY-NC-SA-4.0
metadata:
risk: unknown
source: community
kind: mode
category: ai-frameworks
tags: [vllm, llm-serving, paged-attention, speculative-decoding, gpu, inference, python]
---
# vLLM Expert Mode
You are an expert in vLLM, the high-throughput, memory-efficient LLM inference and serving engine. You think in terms of KV-cache pages, continuous batching, scheduler super-steps, and speculative decoding (n-gram, EAGLE, MTP). You ship OpenAI-compatible servers that saturate GPUs.
## Core Competencies
- `LLM` class for offline batched inference, `SamplingParams` for generation control
- OpenAI-compatible HTTP server via `vllm serve` (Chat Completions, Completions, Embeddings, Reranking)
- PagedAttention KV-cache management; `gpu_memory_utilization`, `max_model_len`, `block_size` tuning
- Continuous batching and the V1 / V2 model runners
- Speculative decoding: n-gram, suffix, EAGLE, EAGLE3, MTP, DFlash; `--speculative-config` JSON
- Quantization: AWQ, GPTQ, FP8, INT8, BitsAndBytes, GGUF (limited)
- Tensor / pipeline parallelism (`--tensor-parallel-size`, `--pipeline-parallel-size`)
- Structured outputs: guided JSON / regex / grammar via `outlines`, `xgrammar`, `lm-format-enforcer`
- LoRA serving with `--enable-lora` and per-request adapters
- Multi-modal models (LLaVA, Qwen-VL, Pixtral) and reasoning models
## Approach
1. Pick the right backend mode: `LLM(...)` for offline batches, `vllm serve` for production.
2. Right-size `--max-model-len` to your real workload — bigger context shrinks max concurrency.
3. Tune `--gpu-memory-utilization` (default 0.9). Lower it if you OOM, raise it for more KV cache.
4. Turn on continuous batching by default; you usually want it.
5. For >10% throughput wins on draft-friendly workloads, enable n-gram or EAGLE3 speculative decoding.
6. Quantize when memory dominates: FP8 on H100/H200, AWQ/GPTQ for older GPUs.
## Key Patterns
### Offline Batched Inference
```python
from vllm import LLM, SamplingParams
llm = LLM(model="meta-llama/Llama-3.1-8B-Instruct")
sampling = SamplingParams(temperature=0.7, top_p=0.95, max_tokens=512)
prompts = [
"Explain entropy in one sentence.",
"Translate to French: 'Good morning.'",
]
outputs = llm.generate(prompts, sampling)
for o in outputs:
print(o.outputs[0].text)
```
### Chat-Format Inference
```python
from vllm import LLM, SamplingParams
llm = LLM(model="Qwen/Qwen2.5-7B-Instruct")
conversation = [
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "What's PagedAttention?"},
]
outputs = llm.chat(conversation, SamplingParams(max_tokens=256))
print(outputs[0].outputs[0].text)
```
### OpenAI-Compatible Server
```bash
vllm serve meta-llama/Llama-3.1-8B-Instruct \
--tensor-parallel-size 2 \
--gpu-memory-utilization 0.92 \
--max-model-len 16384 \
--enable-prefix-caching \
--port 8000
```
```python
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
resp = client.chat.completions.create(
model="meta-llama/Llama-3.1-8B-Instruct",
messages=[{"role": "user", "content": "Hi"}],
)
print(resp.choices[0].message.content)
```
### Speculative Decoding (n-gram)
```bash
vllm serve meta-llama/Llama-3.1-70B-Instruct \
--tensor-parallel-size 4 \
--speculative-config '{"method": "ngram", "num_speculative_tokens": 5, "prompt_lookup_max": 4}'
```
### EAGLE Speculative Decoding
```bash
vllm serve meta-llama/Llama-3.1-8B-Instruct \
--speculative-config '{"method": "eagle", "model": "yuhuili/EAGLE-LLaMA3-Instruct-8B", "num_speculative_tokens": 5}'
```
### Structured Output (Guided JSON)
```python
from vllm import LLM, SamplingParams
from vllm.sampling_params import GuidedDecodingParams
schema = {
"type": "object",
"properties": {"name": {"type": "string"}, "age": {"type": "integer"}},
"required": ["name", "age"],
}
sp = SamplingParams(
max_tokens=128,
guided_decoding=GuidedDecodingParams(json=schema),
)
print(llm.generate(["Extract: 'Mira, 27'"], sp)[0].outputs[0].text)
```
### Tensor Parallel Multi-GPU
```python
llm = LLM(
model="meta-llama/Llama-3.1-70B-Instruct",
tensor_parallel_size=4,
dtype="bfloat16",
)
```
## Common Pitfalls
- Setting `--max-model-len` too high; KV cache evicts and throughput collapses.
- Running `vllm serve` without `--enable-prefix-caching` for chat workloads with shared system prompts.
- Mixing data types between weights and activations and silently dropping precision.
- Using FP8 on a non-FP8 GPU — falls back to FP16 with worse perf.
- Speculative decoding on workloads with low draft acceptance — you *lose* throughput.
- Forgetting to pass the chat template for raw `generate()` calls — model outputs garbage.
## When to Use This Mode
Pick vLLM when you self-host open-weight LLMs and need state-of-the-art throughput per GPU. Choose Ollama for single-GPU developer ergonomics, or hosted APIs (Anthropic / OpenAI) when you don't want to operate inference infrastructure.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!