AlgoViz

Batching, decoding and serving caches

hard 7 min

Serving combines admission control, prefill, autoregressive decoding and memory management.

Where it shows up

The same pattern appears across everyday software.

  • A second request arrives while the first is decoding

    The scheduler can admit and retire requests at different times. Prefill builds a prefix cache while decode extends each active sequence. B completes after one step. Continuous batching can reuse the freed capacity for a waiting request rather than waiting for A. Paged allocation reduces some fragmentation. A future request benefits from prefix caching only when its prefix is eligible and compatible.