Skip to content
BIASED

LLM inference systems

Block 1 of 6~3 min

Separate prefill and decode

Four requests need two, five, one and three output tokens. If a server reserves two slots for a whole batch, one short request can finish while its slot remains unavailable to waiting work. Language-model serving has to schedule repeated decoding steps and the memory retained between them.

The traces and model dimensions below are independently specified teaching inputs. No weights were loaded, no provider was called and no device speed was measured.

A request occupies many iterations

An autoregressive model produces a token conditional on the prefix, appends it and repeats until a stopping condition. Requests therefore differ in both prompt length and output length. Grouping them only at admission can leave unused capacity when shorter outputs finish. Iteration-level scheduling, developed in Orca, permits the active group to change between decoding steps (Yu et al.).

Prefill prepares the state; decode extends it

During prefill, the engine processes the known prompt and constructs keys and values for its tokens. During decode, each new position attends to the retained state and adds its own keys and values. The causal mask permits parallel processing of known prompt positions; future output tokens still depend on earlier generated ones.

Prefill can expose substantial matrix parallelism. Small-batch decode often spends much of its time moving weights and cache data relative to useful arithmetic. These are workload tendencies, not a guarantee that every prefill is compute-bound or every decode memory-bound. Context length, batch size, kernel, quantization and hardware change the bottleneck.

Answers are saved on the server and tied to this browser until you sign in.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • KV slots and speculative probability massoptional

    No model or accelerator is run. Token ticks have equal cost by assumption. KV arithmetic excludes weights and workspaces; block waste means final-block slack only. Exact probability correction does not establish a runtime speedup.

    ~20 min · easier on a computer · The corresponding lesson and basic Python functions.

    Self-check in the notebook — not part of mastery or the certificate.