davila7/claude-code-templates

inference-serving-vllm

Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching.

  • SKILL.md 已保存
  • 英文来源资料
  • 安装与运行未实测
先判断是否解决你的问题

inference-serving-vllm 是什么?

Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching. Use when deploying production LLM APIs, optimizing inference latency/throughput, or serving models with limited GPU memory. Supports OpenAI-compatible endpoints, quantization (GPTQ/AWQ/FP8), and tensor parallelism.

以上为来源原文,中文用途说明尚待整理。

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 inference-serving-vllm,然后告诉 Agent 你的任务和实际输入,让它先核对触发条件。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 inference-serving-vllm

请在 Codex 的当前工作环境中安装并检查 inference-serving-vllm 这个 Skill。

项目身份:davila7/claude-code-templates / inference-serving-vllm
来源:https://github.com/davila7/claude-code-templates/blob/c1bc5c1df4ff0bffb9a04d8f7790543681232423/cli-tool/components/skills/ai-research/inference-serving-vllm/SKILL.md
已定位的源文件:cli-tool/components/skills/ai-research/inference-serving-vllm/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-23T04:29:48.865Z
中文使用说明
尚待整理,保留英文来源内容
安装与任务测试
本站未执行安装或任务测试
来源复核
已保留来源记录;当前完整用法未逐项人工复核
展开 SKILL.md 原文、章节与历史收录资料

cli-tool/components/skills/ai-research/inference-serving-vllm/SKILL.md · 抓取时间 2026-11-23T04:29:48.865Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching. Use when deploying production LLM APIs, optimizing inference latency/throughput, or serving models with limited GPU memory. Supports OpenAI-compatible endpoints, quantization (GPTQ/AWQ/FP8), and tensor parallelism.

查看源文件章节 / Source sections
  • 原文:vLLM - High-Performance LLM Serving
  • 快速开始 / Quick start
  • 原文:Common workflows
  • 原文:Workflow 1: Production API deployment
  • 原文:Workflow 2: Offline batch inference
  • 原文:Workflow 3: Quantized model serving
  • 原文:When to use vs alternatives
  • 原文:Common issues
  • 原文:Advanced topics
  • 原文:Hardware requirements
  • 原文:Resources
快速开始 / Quick start

vLLM achieves 24x higher throughput than standard transformers through PagedAttention (block-based KV cache) and continuous batching (mixing prefill/decode requests). **Installation**: ```bash pip install vllm ``` **Basic offline inference**: ```python from vllm import LLM, SamplingParams llm = LLM(model="meta-llama/Llama-3-8B-Instruct") sampling = SamplingParams(temperature=0.7, max_tokens=256) outputs = llm.generate(["Explain quantum computing"], sampling) print(outputs[0].outputs[0].text) ``` **OpenAI-compatible server**: ```bash vllm serve meta-llama/Llama-3-8B-Instruct # Query with OpenAI SDK python -c " from openai import OpenAI client = OpenAI(base_url='http://localhost:8000/v1', api_key='EMPTY') print(client.chat.completions.create( model='meta-llama/Llama-3-8B-Instruct', messages=[{'role': 'user', 'content': 'Hello!'}] ).choices[0].message.content) " ```

原文:Workflow 1: Production API deployment

Copy this checklist and track progress: ``` Deployment Progress: - [ ] Step 1: Configure server settings - [ ] Step 2: Test with limited traffic - [ ] Step 3: Enable monitoring - [ ] Step 4: Deploy to production - [ ] Step 5: Verify performance metrics ``` **Step 1: Configure server settings** Choose configuration based on your model size: ```bash # For 7B-13B models on single GPU vllm serve meta-llama/Llama-3-8B-Instruct \ --gpu-memory-utilization 0.9 \ --max-model-len 8192 \ --port 8000 # For 30B-70B models with tensor parallelism vllm serve meta-llama/Llama-2-70b-hf \ --tensor-parallel-size 4 \ --gpu-memory-utilization 0.9 \ --quantization awq \ --port 8000 # For production with caching and metrics vllm serve meta-llama/Llama-3-8B-Instruct \ --gpu-memory-utilization 0.9 \ --enable-prefix-caching \ --enable-metrics \ --metrics-port 9090 \ --port 8000 \ --host 0.0.0.0 ``` **Step 2: Test with limited traffic** Run load test before production: ```bash # Install load testing tool pip install locust # Create test_load.py with sample requests # Run: locust -f test_load.py --host http://localhost:8000 ``` Verify TTFT (time to first token) < 500ms and throughput > 100 req/sec. **Step 3: Enable monitoring** vLLM exposes Prometheus metrics on port 9090: ```bash curl http://localhost:9090/metrics | grep vllm ``` Key metrics to monitor: - `vllm:time_to_first_token_seconds` - Latency - `vllm:num_requests_running` - Active requests - `vllm:gpu_cache_usage_perc` - KV cache utilization **Step 4: Deploy to production** Use Docker for consistent deployment: ```bash # Run vLLM in Docker docker run --gpus all -p 8000:8000 \ vllm/vllm-openai:latest \ --model meta-llama/Llama-3-8B-Instruct \ --gpu-memory-utilization 0.9 \ --enable-prefix-caching ``` **Step 5: Verify performance metrics** Check that deployment meets targets: - TTFT < 500ms (for short prompts) - Throughput > target req/sec - GPU utilization > 80% - No OOM errors in logs

原文:Workflow 2: Offline batch inference

For processing large datasets without server overhead. Copy this checklist: ``` Batch Processing: - [ ] Step 1: Prepare input data - [ ] Step 2: Configure LLM engine - [ ] Step 3: Run batch inference - [ ] Step 4: Process results ``` **Step 1: Prepare input data** ```python # Load prompts from file prompts = [] with open("prompts.txt") as f: prompts = [line.strip() for line in f] print(f"Loaded {len(prompts)} prompts") ``` **Step 2: Configure LLM engine** ```python from vllm import LLM, SamplingParams llm = LLM( model="meta-llama/Llama-3-8B-Instruct", tensor_parallel_size=2, # Use 2 GPUs gpu_memory_utilization=0.9, max_model_len=4096 ) sampling = SamplingParams( temperature=0.7, top_p=0.95, max_tokens=512, stop=["</s>", "\n\n"] ) ``` **Step 3: Run batch inference** vLLM automatically batches requests for efficiency: ```python # Process all prompts in one call outputs = llm.generate(prompts, sampling) # vLLM handles batching internally # No need to manually chunk prompts ``` **Step 4: Process results** ```python # Extract generated text results = [] for output in outputs: prompt = output.prompt generated = output.outputs[0].text results.append({ "prompt": prompt, "generated": generated, "tokens": len(output.outputs[0].token_ids) }) # Save to file import json with open("results.jsonl", "w") as f: for result in results: f.write(json.dumps(result) + "\n") print(f"Processed {len(results)} prompts") ```

原文:Workflow 3: Quantized model serving

Fit large models in limited GPU memory. ``` Quantization Setup: - [ ] Step 1: Choose quantization method - [ ] Step 2: Find or create quantized model - [ ] Step 3: Launch with quantization flag - [ ] Step 4: Verify accuracy ``` **Step 1: Choose quantization method** - **AWQ**: Best for 70B models, minimal accuracy loss - **GPTQ**: Wide model support, good compression - **FP8**: Fastest on H100 GPUs **Step 2: Find or create quantized model** Use pre-quantized models from HuggingFace: ```bash # Search for AWQ models # Example: TheBloke/Llama-2-70B-AWQ ``` **Step 3: Launch with quantization flag** ```bash # Using pre-quantized model vllm serve TheBloke/Llama-2-70B-AWQ \ --quantization awq \ --tensor-parallel-size 1 \ --gpu-memory-utilization 0.95 # Results: 70B model in ~40GB VRAM ``` **Step 4: Verify accuracy** Test outputs match expected quality: ```python # Compare quantized vs non-quantized responses # Verify task-specific performance unchanged ```

原文:When to use vs alternatives

**Use vLLM when:** - Deploying production LLM APIs (100+ req/sec) - Serving OpenAI-compatible endpoints - Limited GPU memory but need large models - Multi-user applications (chatbots, assistants) - Need low latency with high throughput **Use alternatives instead:** - **llama.cpp**: CPU/edge inference, single-user - **HuggingFace transformers**: Research, prototyping, one-off generation - **TensorRT-LLM**: NVIDIA-only, need absolute maximum performance - **Text-Generation-Inference**: Already in HuggingFace ecosystem

原文:Common issues

**Issue: Out of memory during model loading** Reduce memory usage: ```bash vllm serve MODEL \ --gpu-memory-utilization 0.7 \ --max-model-len 4096 ``` Or use quantization: ```bash vllm serve MODEL --quantization awq ``` **Issue: Slow first token (TTFT > 1 second)** Enable prefix caching for repeated prompts: ```bash vllm serve MODEL --enable-prefix-caching ``` For long prompts, enable chunked prefill: ```bash vllm serve MODEL --enable-chunked-prefill ``` **Issue: Model not found error** Use `--trust-remote-code` for custom models: ```bash vllm serve MODEL --trust-remote-code ``` **Issue: Low throughput (<50 req/sec)** Increase concurrent sequences: ```bash vllm serve MODEL --max-num-seqs 512 ``` Check GPU utilization with `nvidia-smi` - should be >80%. **Issue: Inference slower than expected** Verify tensor parallelism uses power of 2 GPUs: ```bash vllm serve MODEL --tensor-parallel-size 4 # Not 3 ``` Enable speculative decoding for faster generation: ```bash vllm serve MODEL --speculative-model DRAFT_MODEL ```

文件 SHA256:436574e986dfa5bc7a5cb7f3f25b19e025b50ff96e6214338f2439676a0a6d1f

仓库许可证记录:MIT;skill-declaration-captured-not-interpreted,查看来源。

SKILL.md原文description · 2026-11-23T04:29:48.865Z

Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching. Use when deploying production LLM APIs, optimizing inference latency/throughput, or serving models with limited GPU memory. Supports OpenAI-compatible endpoints, quantization (GPTQ/AWQ/FP8), and tensor parallelism.

查看历史简介来源

历史收录数据

来源仓库davila7/claude-code-templates
Skill源路径cli-tool/components/skills/ai-research/inference-serving-vllm/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源