[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECX470CKH40CRCDCK34RKS":3,"skill-same:01M7ECX470CKH40CRCDCK34RKS":49},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":13,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":6,"ownerDescription":27,"updatedAt":28,"install":29,"resources":42},"01M7ECX470CKH40CRCDCK34RKS","serving-llms-vllm",null,"jonahthan433\u002FCortexOS","jonahthan433","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F211465495?v=4","01M7ECH9HPHGA89DCXHHJBTS3C","jonah.ai","01M7ECH9JCEM45DZMWPT7148S1",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002Fmlops\u002Fserving-llms-vllm\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"# serving-llms-vllm\n\n# vLLM - High-Performance LLM Serving\n\n## When to use\n\nUse when deploying production LLM APIs, optimizing inference latency\u002Fthroughput, or serving models with limited GPU memory. Supports OpenAI-compatible endpoints, quantization (GPTQ\u002FAWQ\u002FFP8), and tensor parallelism.\n\n## Quick start\n\nvLLM achieves 24x higher throughput than standard transformers through PagedAttention (block-based KV cache) and continuous batching (mixing prefill\u002Fdecode requests).\n\n**Installation**:\n```bash\npip install vllm\n```\n\n**Basic offline inference**:\n```python\nfrom vllm import LLM, SamplingParams\n\nllm = LLM(model=\"meta-llama\u002FMeta-Llama-3-8B-Instruct\")\nsampling = SamplingParams(temperature=0.7, max_tokens=256)\n\noutputs = llm.generate([\"Explain quantum computing\"], sampling)\nprint(outputs[0].outputs[0].text)\n```\n\n**OpenAI-compatible server**:\n```bash\nvllm serve meta-llama\u002FMeta-Llama-3-8B-Instruct\n\n# Query with OpenAI SDK\npython -c \"\nfrom openai import OpenAI\nclient = OpenAI(base_url='http:\u002F\u002Flocalhost:8000\u002Fv1', api_key='EMPTY')\nprint(client.chat.completions.create(\n    model='meta-llama\u002FMeta-Llama-3-8B-Instruct',\n    messages=[{'role': 'user', 'content': 'Hello!'}]\n).choices[0].message.content)\n\"\n```\n\n## Common workflows\n\n### Workflow 1: Production API deployment\n\nCopy this checklist and track progress:\n\n```\nDeployment Progress:\n- [ ] Step 1: Configure server settings\n- [ ] Step 2: Test with limited traffic\n- [ ] Step 3: Enable monitoring\n- [ ] Step 4: Deploy to production\n- [ ] Step 5: Verify performance metrics\n```\n\n**Step 1: Configure server settings**\n\nChoose configuration based on your model size:\n\n```bash\n# For 7B-13B models on single GPU\nvllm serve meta-llama\u002FMeta-Llama-3-8B-Instruct \\\n  --gpu-memory-utilization 0.9 \\\n  --max-model-len 8192 \\\n  --port 8000\n\n# For 30B-70B models with tensor parallelism\nvllm serve meta-llama\u002FMeta-Llama-3-70B-Instruct \\\n  --tensor-parallel-size 4 \\\n  --gpu-memory-utilization 0.9 \\\n  --quantization awq \\\n  --port 8000\n\n# For production with caching (Prometheus metrics are exposed\n# automatically at \u002Fmetrics on the API port)\nvllm serve meta-llama\u002FMeta-Llama-3-8B-Instruct \\\n  --gpu-memory-utilization 0.9 \\\n  --enable-prefix-caching \\\n  --port 8000 \\\n  --host 0.0.0.0\n```\n\n**Step 2: Test with limited traffic**\n\nRun load test before production:\n\n```bash\n# Install load testing tool\npip install locust\n\n# Create test_load.py with sample requests\n# Run: locust -f test_load.py --host http:\u002F\u002Flocalhost:8000\n```\n\nVerify TTFT (time to first token) \u003C 500ms and throughput > 100 req\u002Fsec.\n\n**Step 3: Enable monitoring**\n\nvLLM exposes Prometheus metrics at `\u002Fmetrics` on the API port (default 8000):\n\n```bash\ncurl http:\u002F\u002Flocalhost:8000\u002Fmetrics | grep vllm\n```\n\nKey metrics to monitor:\n- `vllm:time_to_first_token_seconds` - Latency\n- `vllm:num_requests_running` - Active requests\n- `vllm:gpu_cache_usage_perc` - KV cache utilization\n\n**Step 4: Deploy to production**\n\nUse Docker for consistent deployment:\n\n```bash\n# Run vLLM in Docker\ndocker run --gpus all -p 8000:8000 \\\n  vllm\u002Fvllm-openai:latest \\\n  --model meta-llama\u002FMeta-Llama-3-8B-Instruct \\\n  --gpu-memory-utilization 0.9 \\\n  --enable-prefix-caching\n```\n\n**Step 5: Verify performance metrics**\n\nCheck that deployment meets targets:\n- TTFT \u003C 500ms (for short prompts)\n- Throughput > target req\u002Fsec\n- GPU utilization > 80%\n- No OOM errors in logs\n\n### Workflow 2: Offline batch inference\n\nFor processing large datasets without server overhead.\n\nCopy this checklist:\n\n```\nBatch Processing:\n- [ ] Step 1: Prepare input data\n- [ ] Step 2: Configure LLM engine\n- [ ] Step 3: Run batch inference\n- [ ] Step 4: Process results\n```\n\n**Step 1: Prepare input data**\n\n```python\n# Load prompts from file\nprompts = []\nwith open(\"prompts.txt\") as f:\n    prompts = [line.strip() for line in f]\n\nprint(f\"Loaded {len(prompts)} prompts\")\n```\n\n**Step 2: Configure LLM engine**\n\n```python\nfrom vllm import LLM, SamplingParams\n\nllm = LLM(\n    model=\"meta-llama\u002FMeta-Llama-3-8B-Instruct\",\n    tensor_parallel_size=2,  # Use 2 GPUs\n    gpu_memory_utilization=0.9,\n    max_model_len=4096\n)\n\nsampling = SamplingParams(\n    temperature=0.7,\n    top_p=0.95,\n    max_tokens=512,\n    stop=[\"\u003C\u002Fs>\", \"\\n\\n\"]\n)\n```\n\n**Step 3: Run batch inference**\n\nvLLM automatically batches requests for efficiency:\n\n```python\n# Process all prompts in one call\noutputs = llm.generate(prompts, sampling)\n\n# vLLM handles batching internally\n# No need to manually chunk prompts\n```\n\n**Step 4: Process results**\n\n```python\n# Extract generated text\nresults = []\nfor output in outputs:\n    prompt = output.prompt\n    generated = output.outputs[0].text\n    results.append({\n        \"prompt\": prompt,\n        \"generated\": generated,\n        \"tokens\": len(output.outputs[0].token_ids)\n    })\n\n# Save to file\nimport json\nwith open(\"results.jsonl\", \"w\") as f:\n    for result in results:\n        f.write(json.dumps(result) + \"\\n\")\n\nprint(f\"Processed {len(results)} prompts\")\n```\n\n### Workflow 3: Quantized model serving\n\nFit large models in limited GPU memory.\n\n```\nQuantization Setup:\n- [ ] Step 1: Choose quantization method\n- [ ] Step 2: Find or create quantized model\n- [ ] Step 3: Launch with quantization flag\n- [ ] Step 4: Verify accuracy\n```\n\n**Step 1: Choose quantization method**\n\n- **AWQ**: Best for 70B models, minimal accuracy loss\n- **GPTQ**: Wide model support, good compression\n- **FP8**: Fastest on H100 GPUs\n\n**Step 2: Find or create quantized model**\n\nUse pre-quantized models from HuggingFace:\n\n```bash\n# Search for AWQ models\n# Example: TheBloke\u002FLlama-2-70B-AWQ\n```\n\n**Step 3: Launch with quantization flag**\n\n```bash\n# Using pre-quantized model\nvllm serve TheBloke\u002FLlama-2-70B-AWQ \\\n  --quantization awq \\\n  --tensor-parallel-size 1 \\\n  --gpu-memory-utilization 0.95\n\n# Results: 70B model in ~40GB VRAM\n```\n\n**Step 4: Verify accuracy**\n\nTest outputs match expected quality:\n\n```python\n# Compare quantized vs non-quantized responses\n# Verify task-specific performance unchanged\n```\n\n## When to use vs alternatives\n\n**Use vLLM when:**\n- Deploying production LLM APIs (100+ req\u002Fsec)\n- Serving OpenAI-compatible endpoints\n- Limited GPU memory but need large models\n- Multi-user applications (chatbots, assistants)\n- Need low latency with high throughput\n\n**Use alternatives instead:**\n- **llama.cpp**: CPU\u002Fedge inference, single-user\n- **HuggingFace transformers**: Research, prototyping, one-off generation\n- **TensorRT-LLM**: NVIDIA-only, need absolute maximum performance\n- **Text-Generation-Inference**: Already in HuggingFace ecosystem\n\n## Common issues\n\n**Issue: Out of memory during model loading**\n\nReduce memory usage:\n```bash\nvllm serve MODEL \\\n  --gpu-memory-utilization 0.7 \\\n  --max-model-len 4096\n```\n\nOr use quantization:\n```bash\nvllm serve MODEL --quantization awq\n```\n\n**Issue: Slow first token (TTFT > 1 second)**\n\nEnable prefix caching for repeated prompts:\n```bash\nvllm serve MODEL --enable-prefix-caching\n```\n\nFor long prompts, enable chunked prefill:\n```bash\nvllm serve MODEL --enable-chunked-prefill\n```\n\n**Issue: Model not found error**\n\nUse `--trust-remote-code` for custom models:\n```bash\nvllm serve MODEL --trust-remote-code\n```\n\n**Issue: Low throughput (\u003C50 req\u002Fsec)**\n\nIncrease concurrent sequences:\n```bash\nvllm serve MODEL --max-num-seqs 512\n```\n\nCheck GPU utilization with `nvidia-smi` - should be >80%.\n\n**Issue: Inference slower than expected**\n\nVerify tensor parallelism uses power of 2 GPUs:\n```bash\nvllm serve MODEL --tensor-parallel-size 4  # Not 3\n```\n\nEnable speculative decoding for faster generation (pass config as JSON;\n`--speculative-model` was removed in favor of `--speculative-config`):\n```bash\nvllm serve MODEL \\\n  --speculative-config '{\"model\": \"DRAFT_MODEL\", \"num_speculative_tokens\": 5, \"method\": \"draft_model\"}'\n```\n\n## Advanced topics\n\n**Server deployment patterns**: See [references\u002Fserver-deployment.md](references\u002Fserver-deployment.md) for Docker, Kubernetes, and load balancing configurations.\n\n**Performance optimization**: See [references\u002Foptimization.md](references\u002Foptimization.md) for PagedAttention tuning, continuous batching details, and benchmark results.\n\n**Quantization guide**: See [references\u002Fquantization.md](references\u002Fquantization.md) for AWQ\u002FGPTQ\u002FFP8 setup, model preparation, and accuracy comparisons.\n\n**Troubleshooting**: See [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) for detailed error messages, debugging steps, and performance diagnostics.\n\n## Hardware requirements\n\n- **Small models (7B-13B)**: 1x A10 (24GB) or A100 (40GB)\n- **Medium models (30B-40B)**: 2x A100 (40GB) with tensor parallelism\n- **Large models (70B+)**: 4x A100 (40GB) or 2x A100 (80GB), use AWQ\u002FGPTQ\n\nSupported platforms: NVIDIA (primary), AMD ROCm, Intel GPUs, TPUs\n\n## Resources\n\n- Official docs: https:\u002F\u002Fdocs.vllm.ai\n- GitHub: https:\u002F\u002Fgithub.com\u002Fvllm-project\u002Fvllm\n- Paper: \"Efficient Memory Management for Large Language Model Serving with PagedAttention\" (SOSP 2023)\n- Community: https:\u002F\u002Fdiscuss.vllm.ai\n",{},"main","38b32c99e7ed0b8e215d638e92cfa452c1ec3079","skills\u002Fimported\u002Fmlops\u002Fserving-llms-vllm","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS","https:\u002F\u002Fgithub.com\u002Fjonahthan433","AI Consultant","2026-10-24 05:13:39",{"source":7,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add jonahthan433\u002FCortexOS --skill serving-llms-vllm",{"tool":35,"command":36},"bunx","bunx skills add jonahthan433\u002FCortexOS --skill serving-llms-vllm",{"tool":38,"command":39},"pnpm","pnpm dlx skills add jonahthan433\u002FCortexOS --skill serving-llms-vllm","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002Fmlops\u002Fserving-llms-vllm\u002FSKILL.md",true,[43],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"skill.json","REFERENCE","参考文档",352,"https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002Fmlops\u002Fserving-llms-vllm\u002Fskill.json",[50,56,62,68,74,80],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":18},"01M7EDQZDQX3Q8Y7GCQX6KN9V7","opportunity-brief","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fsales\u002Fopportunity-brief\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M7EDQYA0V9Y99VKBREJJ3MRT","morning-intel","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fmorning-intel\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M7EDQVX1JVY0B6PDHKKGM19G","decision-brief","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fdecision-brief\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M7EDQV1GENZAC2SZSD8KZ3GM","weekly-review","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fweekly-review\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M7EDQT2KETJ1Y3CGVN9EKW2J","system-health","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fops\u002Fsystem-health\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M7EDQQN2JK3XPWMS1M4T0F3K","backup-restore","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fops\u002Fbackup-restore\u002FSKILL.md",[],[]]