# Serwowanie i dekodowanie

EN: **Serving and decoding** · id `serving`

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Inferencja i infrastruktura](https://aiatlasgraph.com/t/systems.md) › Serwowanie i dekodowanie

## Description

- PL: Obsługa zapytań i generowanie odpowiedzi.
- EN: Handling requests and generating responses.

## In one sentence

- PL: To organizowanie zapytań do modelu i wybieranie kolejnych fragmentów odpowiedzi, żeby sprawnie obsługiwać użytkowników.
- EN: This schedules model requests and selects successive response fragments to serve users efficiently.

## Problem it solves

- PL: Wiele osób pyta jednocześnie, odpowiedzi mają różną długość, a pamięć i czas serwera są ograniczone.
- EN: Many people ask simultaneously, responses vary in length, and server memory and time are limited.

## What it does

- PL: System grupuje pracę, zarządza pamięcią wcześniejszych obliczeń i dobiera generowanie, mierząc czas oczekiwania oraz liczbę obsłużonych zapytań.
- EN: A system groups work, manages cached computations and configures generation while measuring waiting times and handled request volumes.

## Everyday example

- PL: Serwer asystenta obsługuje krótkie pytania razem z długimi rozmowami, dopasowując kolejkę i wykorzystanie pamięci.
- EN: An assistant server handles short questions alongside long conversations, adapting its queue and memory use.

## This concerns you if you…

- PL: udostępniasz model wielu osobom
- PL: chcesz ograniczyć czas oczekiwania i koszt obsługi
- EN: serve a model to many people
- EN: want shorter waits and lower serving costs

## Keywords

prefill · decode · continuous batching · KV cache · chunked prefill · speculative decoding · prefix caching · multi-LoRA serving · token streaming · request scheduling

## How it works

- PL: Serwer tokenizuje i kolejkuje wejścia, wykonuje prefill, a następnie kolejne kroki generowania ze stanem zachowanym między nimi. Harmonogram łączy zapytania, zarządza pamięcią i strumieniowaniem, kontrolując zakończenie, anulowanie oraz obciążenie.
- EN: A server tokenises and queues inputs, runs prefill, then successive generation steps with retained state. Scheduling combines requests and manages memory and streaming while controlling completion, cancellation and load.

## Limits

- PL: Współbieżność zwiększa przepustowość, ale może pogarszać czas pojedynczego zapytania. Długie konteksty zużywają pamięć; kolejki i przeciążenie wymagają limitów oraz pomiaru na rzeczywistym ruchu.
- EN: Concurrency increases throughput but can worsen individual request latency. Long contexts consume memory; queues and overload require limits and measurement on actual traffic.

## Key terms

- PL: **prefill**: Przetwarzanie wejściowego kontekstu przed generowaniem kolejnych tokenów.
- PL: **decode**: Kolejne kroki wyboru i generowania tokenów odpowiedzi.
- EN: **prefill**: Processing input context before generating subsequent tokens.
- EN: **decode**: Successive steps selecting and generating response tokens.

## Know first

- [Tokenizacja tekstu (BPE, WordPiece, SentencePiece) (Text tokenisation (BPE, WordPiece, SentencePiece))](https://aiatlasgraph.com/t/tokenization.md)
- [Statystyka i niepewność (Statistics and uncertainty)](https://aiatlasgraph.com/t/probability.md)

## Examples

- PL: Batching · KV cache · sampling

## Subtopics (7 direct, 7 in total)

- [Ciągłe batchowanie (Continuous batching)](https://aiatlasgraph.com/t/contbatch.md): Adding requests to a running batch instead of waiting for it to finish.
- [Dekodowanie spekulatywne (Speculative decoding)](https://aiatlasgraph.com/t/specdec.md): A cheap model guesses several tokens ahead; the big one only verifies them.
- [Metryki wydajności inferencji LLM (TTFT, TPOT, przepustowość) (Inference performance metrics (TTFT, TPOT, throughput, goodput))](https://aiatlasgraph.com/t/inferencemetrics.md): Core measures of LLM serving speed: time to first token (TTFT), average time for subsequent output tokens (TPOT/ITL), throughput in tokens or requests per second, and goodput — requests served within defined SLOs.
- [Rozdzielenie fazy prefill i decode (Disaggregated prefill and decode)](https://aiatlasgraph.com/t/disaggregation.md): Running prompt processing (prefill, compute-bound) and token generation (decode, memory-bound) on separate GPU pools, transferring the KV cache between them, so TTFT and per-token latency can be tuned independently.
- [Serwowanie wielu adapterów LoRA na jednym modelu (Multi-LoRA serving)](https://aiatlasgraph.com/t/multilora.md): One base model in GPU memory serves requests for many fine-tuned variants at once: a LoRA adapter is selected per request, and adapters are loaded and swapped on the fly.
- [Strategie dekodowania (Decoding strategies)](https://aiatlasgraph.com/t/decoding.md): How the next token is picked from the model's distribution.
- [Zarządzanie KV cache (KV cache management)](https://aiatlasgraph.com/t/kvcache.md): The attention cache during generation: paging, sharing, compression.

## Related topics

Untyped, symmetric "see also" links.

- [Odczuwalna szybkość: strumieniowanie i wskaźniki postępu (Perceived latency and progress feedback)](https://aiatlasgraph.com/t/perceivedlatency.md)

## Courses

- [Fast LLM Inference with Cerebras](<https://www.deeplearning.ai/courses/fast-llm-inference-with-cerebras>)

## Sources

- [Stanford CS336 · Language Modeling from Scratch (2025)](<https://cs336.stanford.edu/spring2025/>) `cs336` · reference: Budowa modeli, dane, trening, systemy, inferencja i post-training.
- [Full Stack Deep Learning (2022, archiwum)](<https://fullstackdeeplearning.com/course/2022/>) `fsdl` · reference: Pełny cykl systemu ML: dane, testy, wdrażanie, monitoring, zespoły i etyka.
- [FSDL · LLM Bootcamp (2023, archiwum)](<https://fullstackdeeplearning.com/llm-bootcamp/spring-2023/>) `bootcamp` · reference: Aplikacje LLM, prompting, retrieval, UX i LLMOps.
- [DeepLearning.AI — course catalogue](<https://www.deeplearning.ai/courses>) `dlai` · course catalogue: 42 topic labels with counts, about 130 courses.
- [Performance Engineering for AI Infra — learning guide](<https://github.com/wafer-ai/gpu-perf-engineering-resources>) `wafer-gpu` · GitHub repository · tiered curriculum (Tier 1–3) · MIT licence · by Wafer (wafer-ai): Company material with a hiring note, but the evidence is mostly primary sources. Table of contents sieved: only topics became nodes; tiers kept as link labels.

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/serving · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
