Part II · The Economics of InferencePublishedChapter 05 of 13

Prefill, Decode, KV Cache and Serving Efficiency

Inference efficiency is an architectural achievement. Memory management and scheduling determine productive serving capacity.

← Publication Contents

Prefill and Decode

Prefill processes input context and establishes state required for generation. Decode generates subsequent tokens sequentially. At smaller batch sizes, repeated access to model parameters frequently makes memory bandwidth the dominant constraint.

KV-Cache Architecture

The key-value cache preserves attention states for reuse. Cache requirements generally increase with sequence length and concurrency. PagedAttention uses block-based management to reduce memory fragmentation and enable greater concurrency.

Continuous Batching

Continuous batching allows requests to enter and leave active batches as generation progresses. Larger batches can increase aggregate throughput. Excessive batching can compromise latency. The objective is service-compliant throughput.

Quantization and Speculative Decoding

Quantization reduces numerical precision and memory requirements subject to hardware support and acceptable quality. Speculative decoding proposes token sequences for target-model verification. Its advantage depends on acceptance rates and verification overhead.

Disaggregated Inference

Separate prefill and decode resources enable independent optimization. State transfer introduces communication overhead. Economic advantage depends on efficiency gains relative to coordination costs.

Service-Level-Constrained Goodput

Time to first token measures initial latency. Time per output token measures generation speed. Goodput captures the rate of requests satisfying service-level objectives.

Investment Judgment

Serving architecture influences infrastructure productivity. Competitive advantage resides in greater service-compliant output from committed resources.

Evidence & Sources
  1. Source 1
    Kwon et al. Efficient Memory Management for Large Language Model Serving with PagedAttention. SOSP, 2023.
    https://doi.org/10.1145/3600006.3613165
  2. Source 2
    Zhong et al. DistServe. OSDI, 2024.
    https://www.usenix.org/conference/osdi24/presentation/zhong-yinmin
  3. Source 3
    Leviathan et al. Fast Inference from Transformers via Speculative Decoding. ICML, 2023.
    https://proceedings.mlr.press/v202/leviathan23a.html
  4. Source 4
    Yu et al. Orca. OSDI, 2022.
    https://www.usenix.org/conference/osdi22/presentation/yu
Editorial Note

Serving optimizations produce workload-dependent results. Comparative assessments require equivalent quality and latency requirements.

Connected Work

Connected Practices

Practices are commercial advisory offerings of Built by Sentient, a separate business that shares Sentient Review's founder. They are not part of Sentient Review's editorial work.