inference-serving-optimization
/inference-serving-optimization
Dostraja serwowanie LLM tak, by utrzymać cele opóźnień SLO przy wyższej przepustowości GPU, łącząc harmonogram partii, pamięć KV cache i paged attention.
- Autor
- Amey-Thakur ↗
- Repozytorium
- AI-SKILLS ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 05.09.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 05.09.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Dostraja serwowanie LLM tak, by utrzymać cele opóźnień SLO przy wyższej przepustowości GPU, łącząc harmonogram partii, pamięć KV cache i paged attention.
Oryginalny opis (EN)
Tune LLM serving to hold latency SLOs while raising GPU throughput, working the batch scheduler, KV cache, and paged attention together. Use when a serving replica misses its latency target or leaves memory and utilization on the table.
Jak działa
- Method
- Litmus tests
- Boundaries
Podgląd SKILL.md
--- name: inference-serving-optimization description: Tune LLM serving to hold latency SLOs while raising GPU throughput, working the batch scheduler, KV cache, and paged attention together. Use when a serving replica misses its latency target or leaves memory and utilization on the table. --- # Inference serving optimization A serving replica has two failure modes that trace back to the same place: the GPU sits half idle, or tail latency blows past budget. Both come from how the loop forms batches and how it spends memory on the key-value (KV) cache. The work is to trade throughput against tail latency on purpose, one dial at a time, instead of guessing and breaking a second target while fixing the first. ## Method 1. **Pin the SLO to two numbered percentiles.** State a time-to-first-token (TTFT) target and an inter-token latency target, each at a percentile: for example TTFT p99 under 500 ms, inter-token p99 under 40 ms. Throughput is the quantity you maximize under those two constraints, never a target on its own. 2. **Profile prefill and decode as separate phases.** Prefill is compute-bound and grows with prompt length; decode is memory-bandwidth-bound and grows with KV cache size. A change that helps one often hurts the other, so measure them apart. Chunked prefill caps how much a long prompt preempts live decodes. 3. **Budget the KV cache in bytes.** Per token, KV bytes are 2 x layers x kv_heads x head_dim x dtype_bytes. Multiply by max sequence length and by concurrent sequences: at long context that product, not the weights, is what fills an 80 GB H100 and sets how many requests fit. 4. **Enable paged attention so uneven sequences share the pool.** Allocating the KV cache in fixed blocks (vLLM PagedAttention, commonly 16 tokens per block) removes the per-slot worst-case reservation that fragments memory. That is what lets a large continuous batch actually reside on the card. 5. **Run continuous batching, not static batches.** Admit and retire sequences every decode step rather than waiting for a fixed batch to drain. When output lengths vary widely, which is the normal case for chat, this keeps the GPU fed instead of stalling on the one request still generating. 6. **Quantize the cache only after you have profiled.** An FP8 or INT8 KV cache roughly halves decode memory and lifts the concurrency ceiling; AWQ or GPTQ weights free more room for KV. Confirm quality on your eval set first, since each trades a little accuracy for headroom. 7. **Ramp concurrency until p99 bends, then back off one step.** Plot latency percentiles against in-flight requests. Throughput climbs then flattens while p99 rises: the largest concurrency that still meets both SLOs is your operating point, and it came from the curve, not intuition. ## Litmus tests - Can you name your TTFT and inter-token targets with a percentile attached? - Do you know how many concurrent sequences the KV cache holds at max context? - Under load, does GPU utilization clear 80 percent while p99 stays in budget? - Did a percentile-versus-concurrency curve, not a hunch, set the batch size? ## Boundaries This is scheduler-level and memory-level tuning of one serving replica. Picking and configuring a specific runtime is vllm-serving; graph compilation and kernel precision on the model itself is tensorrt-optimization. Autoscaling replicas and routing traffic across them is a cluster concern this skill does not cover.
Wersje
W bazie nie ma innych skilli o nazwie inference-serving-optimization.
Migawka bazy z 13.11.2026 · wersja paczki 66ce993a9c87 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100paged-attention
Wyjaśnia zarządzanie pamięcią KV cache w PagedAttention i stroi silniki serwujące LLM, np. vLLM, pod kątem pojemności i przepustowości. - 95llm-kv-cache-paged-attention
Wyjaśnia pamięć cache KV w modelach językowych: paged attention, prefix caching, kwantyzację KV i wpływ na liczbę równoległych sekwencji w vLLM. - 100tune-model-serving-aks
Dostraja serwowanie modeli na AKS: wykorzystanie GPU, kwantyzację, rozmiar partii, spot node pools i koszt wnioskowania. - 95inference-engineering
Pomaga podejmować decyzje o architekturze i wydajności serwowania modeli generatywnej AI, w tym o sprzęcie, opóźnieniach i kosztach. - 100model-serving
Stroi serwery inferencji LLM, takie jak vLLM, SGLang i TensorRT-LLM, pod kątem opóźnień i przepustowości oraz doboru GPU. - 90model-inference-optimize
Optymalizuje wnioskowanie modeli: profilowanie, TensorRT, ONNX, PyTorch, FP8, cache i kontrolę jakości po zmianach.