LLMOps – Inference & Optimization – Production Skill Hub
Modern Best Practices (January 2026):
This skill provides production-ready operational patterns for optimizing LLM inference performance, cost, and reliability. It centralizes decision rules, optimization strategies, configuration templates, and operational checklists for inference workloads.
No theory. No narrative. Only what Claude can execute.
When to Use This Skill
Claude should activate this skill whenever the user asks for:
- Optimizing LLM inference latency or throughput
- Choosing quantization strategies (FP8/FP4/INT8/INT4)
- Configuring vLLM, TensorRT-LLM, or DeepSpeed inference
- Scaling LLM inference across GPUs (tensor/pipeline parallelism)
- Building high-throughput LLM APIs
- Improving context window performance (KV cache optimization)
- Using speculative decoding for faster generation
- Reducing cost per token
- Profiling and benchmarking inference workloads
- Planning infrastructure capacity
- CPU/edge deployment patterns
- High availability and resilience patterns
Scope Boundaries (Use These Skills for Depth)
- Prompting, tuning, datasets → ai-llm
- RAG pipeline construction → ai-rag
- Deployment, APIs, monitoring → ai-mlops
- Safety, governance → ai-mlops
Quick Reference
| Task |
Tool/Framework |
Command/Pattern |
When to Use |
| Latency budget |
SLO + load model |
TTFT/ITL + P95/P99 under load |
Any production endpoint |
| Tail-latency control |
Scheduling + timeouts |
Admission control + queue caps + backpressure |
Prevent p99 explosions |
| Throughput |
Batching + KV-cache aware serving |
Continuous batching + KV paging |
High concurrency serving |
| Cost control |
Model tiering + caching |
Cache (prefix/response) + quotas |
Reduce spend and overload risk |
| Long context |
Prefill optimization |
Chunked prefill + prompt compression |
Long inputs and RAG-heavy apps |
| Parallelism |
TP/PP/DP |
Choose by model size and interconnect |
Models that do not fit one device |
| Reliability |
Resilience patterns |
Timeouts + circuit breakers + idempotency |
Avoid cascading failures |
Decision Tree: Inference Optimization Strategy
Need to optimize LLM inference: [Optimization Path]
├─ Primary constraint: Throughput?
│ ├─ Many concurrent users? → batching + KV-cache aware serving + admission control
│ └─ Mostly batch/offline? → batch inference jobs + large batches + spot capacity
│
├─ Primary constraint: Cost?
│ ├─ Can accept lower quality tier? → model tiering (small/medium/large router)
│ └─ Must keep quality? → caching + prompt/context reduction before quantization
│
├─ Primary constraint: Latency?
│ ├─ Draft model acceptable? → speculative decoding
│ └─ Long context? → prefill optimizations + attention kernels + context budgets
│
├─ Large model (>70B)?
│ ├─ Multiple GPUs? → Tensor parallelism (NVLink required)
│ └─ Deep model? → Pipeline parallelism (minimize bubbles)
│
└─ Edge deployment?
└─ CPU + quantization → Optimized for constrained resources
Core Concepts & Practices
Core Concepts (Vendor-Agnostic)
- Latency components: queueing + prefill + decode; optimize the largest contributor first.
- Tail latency: p99 is dominated by queuing and long prompts; fix with admission control and context budgets.
- Retries: retries can multiply load; bound retries and use hedged requests only with strict budgets.
- Caching: prefix caching helps repeated system/tool scaffolds; response caching helps repeated questions (requires invalidation).
- Security & privacy: prompts/outputs can contain sensitive data; scrub logs, enforce auth/tenancy, and rate-limit abuse (OWASP LLM Top 10: https://owasp.org/www-project-top-10-for-large-language-model-applications/).
Implementation Practices (Tooling Examples)
- Measure under load: benchmark TTFT/ITL and p95/p99 with realistic concurrency and prompt lengths.
- Separate environments: dev/stage/prod model configs; promote only after passing the inference review checklist.
- Export telemetry: request-level tokens, TTFT/ITL, queue depth, GPU memory headroom, and error classes (OpenTelemetry GenAI semantic conventions: https://opentelemetry.io/docs/specs/semconv/gen-ai/).
Do / Avoid
Do
- Do enforce
max_input_tokens and max_output_tokens at the API boundary.
- Do cap concurrency and queue depth; return overload errors quickly.
- Do validate quality after any quantization or kernel change.
Avoid
- Avoid unbounded retries (amplifies outages).
- Avoid unbounded context windows (OOM + latency spikes).
- Avoid benchmarking on single requests; always test with realistic concurrency.
Resources (Detailed Operational Guides)
For comprehensive guides on specific topics, see:
Infrastructure & Serving
- Infrastructure Tuning - OS, container, Kubernetes optimization for GPU workloads
- Serving Architectures - Production serving stack patterns
- Resilience & HA Patterns - Multi-region, failover, traffic management
Performance Optimization
- Quantization Patterns - FP8/FP4/INT8/INT4 decision trees and validation
- KV Cache Optimization - PagedAttention, FlashAttention, prefix caching
- Parallelism Patterns - Tensor/pipeline/expert parallelism strategies
- Optimization Strategies - Throughput, cost, memory optimization
- Batching & Scheduling - Continuous batching and throughput patterns
Deployment & Operations
- Edge & CPU Optimization - llama.cpp, GGUF, mobile/browser deployment
- GPU Optimization Checklists - Hardware-specific tuning
- Speculative Decoding Guide - Advanced generation acceleration
- Profiling & Capacity Planning - Benchmarking, SLOs, replica sizing
Templates
Inference Configs
Production-ready configuration templates for leading inference engines:
- vLLM Configuration - Continuous batching, PagedAttention setup
- TensorRT-LLM Configuration - NVIDIA kernel optimizations
- DeepSpeed Inference - PyTorch-friendly inference
Quantization & Compression
Model compression templates for reducing memory and cost:
- GPTQ Quantization - GPU post-training quantization
- AWQ Quantization - Activation-aware weight quantization
- GGUF Format - CPU/edge optimized formats
Serving Pipelines
High-throughput serving architectures:
- LLM API Server - FastAPI + vLLM production setup
- High-Throughput Setup - Multi-replica scaling patterns
Caching & Batching
Performance optimization templates:
- Prefix Caching - KV cache reuse strategies
- Batching Configuration - Continuous batching tuning
Benchmarking
Performance measurement and validation:
- Latency & Throughput Testing - Load testing framework
Checklists
- Inference Performance Review Checklist - Baseline, bottlenecks, rollout readiness
Navigation
Resources
- resources/serving-architectures.md
- resources/profiling-and-capacity-planning.md
- resources/gpu-optimization-checklists.md
- resources/speculative-decoding-guide.md
- resources/resilience-ha-patterns.md
- resources/optimization-strategies.md
- resources/kv-cache-optimization.md
- resources/batching-and-scheduling.md
- resources/quantization-patterns.md
- resources/parallelism-patterns.md
- resources/edge-cpu-optimization.md
- resources/infrastructure-tuning.md
Templates
- templates/serving/template-llm-api.md
- templates/serving/template-high-throughput-setup.md
- templates/inference/template-vllm-config.md
- templates/inference/template-tensorrtllm-config.md
- templates/inference/template-deepspeed-inference.md
- templates/quantization/template-awq.md
- templates/quantization/template-gptq.md
- templates/quantization/template-gguf.md
- templates/batching/template-batching-config.md
- templates/caching/template-prefix-caching.md
- templates/benchmarking/template-latency-throughput-test.md
- templates/checklists/inference-review-checklist.md
Data
- data/sources.json — Curated external references
Related Skills
This skill focuses on inference-time performance. For related workflows:
- ai-llm - Prompting, fine-tuning, application architecture
- ai-rag - RAG pipeline construction and optimization
- ai-mlops - Deployment, monitoring, safety, and governance
- qa-observability - Performance monitoring and optimization
- ops-devops-platform - Infrastructure and platform operations
External Resources
See data/sources.json for:
- Serving frameworks (vLLM, TensorRT-LLM, DeepSpeed-MII)
- Quantization libraries (GPTQ, AWQ, bitsandbytes, LLM Compressor)
- FlashAttention, FlashInfer, xFormers
- GPU hardware guides and optimization docs
- Benchmarking frameworks and tools
Use this skill whenever the user needs LLM inference performance, cost reduction, or serving architecture guidance.
1---2name: ai-llm-inference-23description: Operational patterns for LLM inference: latency budgeting, tail-latency control, caching, batching/scheduling, quantization/compression, parallelism, and reliable serving at scale. Emphasizes production-grade performance, cost control, and observability.4---5
6# LLMOps – Inference & Optimization – Production Skill Hub
7
8**Modern Best Practices (January 2026)**:
9
10- Treat inference as a **systems problem**: SLOs, tail latency, retries, overload, and cache strategy.
11- Use **continuous batching / smart scheduling** when serving many concurrent requests (Orca scheduling: https://www.usenix.org/conference/osdi22/presentation/yu).
12- Use **KV-cache aware serving** (PagedAttention/vLLM: https://arxiv.org/abs/2309.06180) and **efficient attention kernels** (FlashAttention: https://arxiv.org/abs/2205.14135).
13- Use **speculative decoding** when latency is critical and draft-model quality is acceptable (speculative decoding: https://arxiv.org/abs/2302.01318).
14- Quantize only with **measured** quality impact and rollback plan (quantization must be validated on your eval set).
15
16This skill provides **production-ready operational patterns** for optimizing LLM inference performance, cost, and reliability. It centralizes **decision rules**, **optimization strategies**, **configuration templates**, and **operational checklists** for inference workloads.
17
18No theory. No narrative. Only what Claude can execute.
19
20---
21
22## When to Use This Skill
23
24Claude should activate this skill whenever the user asks for:
25
26- Optimizing LLM inference latency or throughput
27- Choosing quantization strategies (FP8/FP4/INT8/INT4)
28- Configuring vLLM, TensorRT-LLM, or DeepSpeed inference
29- Scaling LLM inference across GPUs (tensor/pipeline parallelism)
30- Building high-throughput LLM APIs
31- Improving context window performance (KV cache optimization)
32- Using speculative decoding for faster generation
33- Reducing cost per token
34- Profiling and benchmarking inference workloads
35- Planning infrastructure capacity
36- CPU/edge deployment patterns
37- High availability and resilience patterns
38
39## Scope Boundaries (Use These Skills for Depth)
40
41- **Prompting, tuning, datasets** → [ai-llm](../ai-llm/SKILL.md)
42- **RAG pipeline construction** → [ai-rag](../ai-rag/SKILL.md)
43- **Deployment, APIs, monitoring** → [ai-mlops](../ai-mlops/SKILL.md)
44- **Safety, governance** → [ai-mlops](../ai-mlops/SKILL.md)
45
46---
47
48## Quick Reference
49
50| Task | Tool/Framework | Command/Pattern | When to Use |
51|------|----------------|-----------------|-------------|
52| Latency budget | SLO + load model | TTFT/ITL + P95/P99 under load | Any production endpoint |
53| Tail-latency control | Scheduling + timeouts | Admission control + queue caps + backpressure | Prevent p99 explosions |
54| Throughput | Batching + KV-cache aware serving | Continuous batching + KV paging | High concurrency serving |
55| Cost control | Model tiering + caching | Cache (prefix/response) + quotas | Reduce spend and overload risk |
56| Long context | Prefill optimization | Chunked prefill + prompt compression | Long inputs and RAG-heavy apps |
57| Parallelism | TP/PP/DP | Choose by model size and interconnect | Models that do not fit one device |
58| Reliability | Resilience patterns | Timeouts + circuit breakers + idempotency | Avoid cascading failures |
59
60---
61
62## Decision Tree: Inference Optimization Strategy
63
64```text
65Need to optimize LLM inference: [Optimization Path]
66 ├─ Primary constraint: Throughput?
67 │ ├─ Many concurrent users? → batching + KV-cache aware serving + admission control
68 │ └─ Mostly batch/offline? → batch inference jobs + large batches + spot capacity
69 │
70 ├─ Primary constraint: Cost?
71 │ ├─ Can accept lower quality tier? → model tiering (small/medium/large router)
72 │ └─ Must keep quality? → caching + prompt/context reduction before quantization
73 │
74 ├─ Primary constraint: Latency?
75 │ ├─ Draft model acceptable? → speculative decoding
76 │ └─ Long context? → prefill optimizations + attention kernels + context budgets
77 │
78 ├─ Large model (>70B)?
79 │ ├─ Multiple GPUs? → Tensor parallelism (NVLink required)
80 │ └─ Deep model? → Pipeline parallelism (minimize bubbles)
81 │
82 └─ Edge deployment?
83 └─ CPU + quantization → Optimized for constrained resources
84```
85
86---
87
88## Core Concepts & Practices
89
90### Core Concepts (Vendor-Agnostic)
91
92- **Latency components**: queueing + prefill + decode; optimize the largest contributor first.
93- **Tail latency**: p99 is dominated by queuing and long prompts; fix with admission control and context budgets.
94- **Retries**: retries can multiply load; bound retries and use hedged requests only with strict budgets.
95- **Caching**: prefix caching helps repeated system/tool scaffolds; response caching helps repeated questions (requires invalidation).
96- **Security & privacy**: prompts/outputs can contain sensitive data; scrub logs, enforce auth/tenancy, and rate-limit abuse (OWASP LLM Top 10: https://owasp.org/www-project-top-10-for-large-language-model-applications/).
97
98### Implementation Practices (Tooling Examples)
99
100- **Measure under load**: benchmark TTFT/ITL and p95/p99 with realistic concurrency and prompt lengths.
101- **Separate environments**: dev/stage/prod model configs; promote only after passing the inference review checklist.
102- **Export telemetry**: request-level tokens, TTFT/ITL, queue depth, GPU memory headroom, and error classes (OpenTelemetry GenAI semantic conventions: https://opentelemetry.io/docs/specs/semconv/gen-ai/).
103
104### Do / Avoid
105
106**Do**
107- Do enforce `max_input_tokens` and `max_output_tokens` at the API boundary.
108- Do cap concurrency and queue depth; return overload errors quickly.
109- Do validate quality after any quantization or kernel change.
110
111**Avoid**
112- Avoid unbounded retries (amplifies outages).
113- Avoid unbounded context windows (OOM + latency spikes).
114- Avoid benchmarking on single requests; always test with realistic concurrency.
115
116---
117
118## Resources (Detailed Operational Guides)
119
120For comprehensive guides on specific topics, see:
121
122### Infrastructure & Serving
123
124- [Infrastructure Tuning](resources/infrastructure-tuning.md) - OS, container, Kubernetes optimization for GPU workloads
125- [Serving Architectures](resources/serving-architectures.md) - Production serving stack patterns
126- [Resilience & HA Patterns](resources/resilience-ha-patterns.md) - Multi-region, failover, traffic management
127
128### Performance Optimization
129
130- [Quantization Patterns](resources/quantization-patterns.md) - FP8/FP4/INT8/INT4 decision trees and validation
131- [KV Cache Optimization](resources/kv-cache-optimization.md) - PagedAttention, FlashAttention, prefix caching
132- [Parallelism Patterns](resources/parallelism-patterns.md) - Tensor/pipeline/expert parallelism strategies
133- [Optimization Strategies](resources/optimization-strategies.md) - Throughput, cost, memory optimization
134- [Batching & Scheduling](resources/batching-and-scheduling.md) - Continuous batching and throughput patterns
135
136### Deployment & Operations
137
138- [Edge & CPU Optimization](resources/edge-cpu-optimization.md) - llama.cpp, GGUF, mobile/browser deployment
139- [GPU Optimization Checklists](resources/gpu-optimization-checklists.md) - Hardware-specific tuning
140- [Speculative Decoding Guide](resources/speculative-decoding-guide.md) - Advanced generation acceleration
141- [Profiling & Capacity Planning](resources/profiling-and-capacity-planning.md) - Benchmarking, SLOs, replica sizing
142
143---
144
145## Templates
146
147### Inference Configs
148
149Production-ready configuration templates for leading inference engines:
150
151- [vLLM Configuration](templates/inference/template-vllm-config.md) - Continuous batching, PagedAttention setup
152- [TensorRT-LLM Configuration](templates/inference/template-tensorrtllm-config.md) - NVIDIA kernel optimizations
153- [DeepSpeed Inference](templates/inference/template-deepspeed-inference.md) - PyTorch-friendly inference
154
155### Quantization & Compression
156
157Model compression templates for reducing memory and cost:
158
159- [GPTQ Quantization](templates/quantization/template-gptq.md) - GPU post-training quantization
160- [AWQ Quantization](templates/quantization/template-awq.md) - Activation-aware weight quantization
161- [GGUF Format](templates/quantization/template-gguf.md) - CPU/edge optimized formats
162
163### Serving Pipelines
164
165High-throughput serving architectures:
166
167- [LLM API Server](templates/serving/template-llm-api.md) - FastAPI + vLLM production setup
168- [High-Throughput Setup](templates/serving/template-high-throughput-setup.md) - Multi-replica scaling patterns
169
170### Caching & Batching
171
172Performance optimization templates:
173
174- [Prefix Caching](templates/caching/template-prefix-caching.md) - KV cache reuse strategies
175- [Batching Configuration](templates/batching/template-batching-config.md) - Continuous batching tuning
176
177### Benchmarking
178
179Performance measurement and validation:
180
181- [Latency & Throughput Testing](templates/benchmarking/template-latency-throughput-test.md) - Load testing framework
182
183### Checklists
184
185- [Inference Performance Review Checklist](templates/checklists/inference-review-checklist.md) - Baseline, bottlenecks, rollout readiness
186
187## Navigation
188
189**Resources**
190- [resources/serving-architectures.md](resources/serving-architectures.md)
191- [resources/profiling-and-capacity-planning.md](resources/profiling-and-capacity-planning.md)
192- [resources/gpu-optimization-checklists.md](resources/gpu-optimization-checklists.md)
193- [resources/speculative-decoding-guide.md](resources/speculative-decoding-guide.md)
194- [resources/resilience-ha-patterns.md](resources/resilience-ha-patterns.md)
195- [resources/optimization-strategies.md](resources/optimization-strategies.md)
196- [resources/kv-cache-optimization.md](resources/kv-cache-optimization.md)
197- [resources/batching-and-scheduling.md](resources/batching-and-scheduling.md)
198- [resources/quantization-patterns.md](resources/quantization-patterns.md)
199- [resources/parallelism-patterns.md](resources/parallelism-patterns.md)
200- [resources/edge-cpu-optimization.md](resources/edge-cpu-optimization.md)
201- [resources/infrastructure-tuning.md](resources/infrastructure-tuning.md)
202
203**Templates**
204- [templates/serving/template-llm-api.md](templates/serving/template-llm-api.md)
205- [templates/serving/template-high-throughput-setup.md](templates/serving/template-high-throughput-setup.md)
206- [templates/inference/template-vllm-config.md](templates/inference/template-vllm-config.md)
207- [templates/inference/template-tensorrtllm-config.md](templates/inference/template-tensorrtllm-config.md)
208- [templates/inference/template-deepspeed-inference.md](templates/inference/template-deepspeed-inference.md)
209- [templates/quantization/template-awq.md](templates/quantization/template-awq.md)
210- [templates/quantization/template-gptq.md](templates/quantization/template-gptq.md)
211- [templates/quantization/template-gguf.md](templates/quantization/template-gguf.md)
212- [templates/batching/template-batching-config.md](templates/batching/template-batching-config.md)
213- [templates/caching/template-prefix-caching.md](templates/caching/template-prefix-caching.md)
214- [templates/benchmarking/template-latency-throughput-test.md](templates/benchmarking/template-latency-throughput-test.md)
215- [templates/checklists/inference-review-checklist.md](templates/checklists/inference-review-checklist.md)
216
217**Data**
218- [data/sources.json](data/sources.json) — Curated external references
219
220---
221
222## Related Skills
223
224This skill focuses on **inference-time performance**. For related workflows:
225
226- **[ai-llm](../ai-llm/SKILL.md)** - Prompting, fine-tuning, application architecture
227- **[ai-rag](../ai-rag/SKILL.md)** - RAG pipeline construction and optimization
228- **[ai-mlops](../ai-mlops/SKILL.md)** - Deployment, monitoring, safety, and governance
229- **[qa-observability](../qa-observability/SKILL.md)** - Performance monitoring and optimization
230- **[ops-devops-platform](../ops-devops-platform/SKILL.md)** - Infrastructure and platform operations
231
232---
233
234## External Resources
235
236See [data/sources.json](data/sources.json) for:
237
238- Serving frameworks (vLLM, TensorRT-LLM, DeepSpeed-MII)
239- Quantization libraries (GPTQ, AWQ, bitsandbytes, LLM Compressor)
240- FlashAttention, FlashInfer, xFormers
241- GPU hardware guides and optimization docs
242- Benchmarking frameworks and tools
243
244---
245
246Use this skill whenever the user needs **LLM inference performance, cost reduction, or serving architecture** guidance.