Can OS paging techniques reduce LLM serving memory waste?
Does borrowing virtual memory paging from operating systems address the fragmentation and duplication waste in key-value caches during concurrent LLM inference? This matters because KV cache inefficiency limits how many requests can run together, capping serving throughput.
The paper proposes PagedAttention, "an attention algorithm inspired by the classical virtual memory and paging techniques in operating systems," built into a serving engine called vLLM. The problem it targets is the key-value cache (KV cache), the per-request memory that stores earlier tokens' key and value tensors so the model does not recompute them at every decoding step. On a 13B-parameter model on an A100 GPU, the paper reports "approximately 65% of the memory is allocated for the model weights" and "close to 30%" to this per-request KV cache, which "grows and shrinks dynamically" and is "huge." Existing systems waste much of that 30% to fragmentation and duplication, which caps how many requests can be batched together and therefore caps throughput. The paper's evaluations find vLLM "improves the throughput of popular LLMs by 2-4× with the same level of latency compared to the state-of-the-art systems, such as FasterTransformer and Orca," with the gain "more pronounced with longer sequences, larger models, and more complex decoding algorithms."
The mechanism follows the OS analogy directly. PagedAttention splits each request's KV cache into fixed-size "KV blocks" and lets the attention computation run block by block, so the blocks "can be stored in non-contiguous physical memory." A KV cache manager then tracks, per request, a "block table" mapping logical blocks to physical ones, the same separation an OS makes between a program's logical pages and physical memory. Because physical blocks are allocated only as new tokens are generated rather than reserved upfront for an unknown final length, "this eliminates most memory waste in existing systems." The same block structure also lets requests share KV blocks within and across a batch, further cutting memory use. The paper is explicit that this only pays off because LLM serving is memory-bound and allocation sizes are not known in advance — it says the same paging idea would not help, and could even "degrade the performance," for workloads that are compute-bound or have static tensor shapes, such as ordinary DNN training or non-LLM DNN serving.
This sits in a cluster of notes about memory as the binding constraint on LLM inference, but at a different point in the stack. What actually limits language models on mobile phones? and Does recomputing weights cost less than moving them on mobile? both treat memory-bound serving as a hardware limit on a single device and respond by shrinking or reusing static weights. PagedAttention instead leaves the model and its weights untouched and attacks waste in the dynamic KV cache on data-center GPUs serving many concurrent requests — a batching-and-fragmentation problem, not a parameter-count problem. Can recursive subtask trees overcome context window limits? shares the object of attack, the KV cache, but a different tool and goal: TIM prunes entries to free capacity for longer reasoning in a single request, where PagedAttention repacks entries to fit more simultaneous requests without discarding any of them.
What the excerpt does not establish is cost in dollar or energy terms — the throughput gain is reported in requests-per-unit-time and latency parity, not as a measured reduction in serving cost per request, though higher throughput on the same hardware implies a lower cost per request if utilization was the binding constraint. The excerpt also does not say how the gain scales past the specific comparisons tested (FasterTransformer, Orca) or quantify "near-zero waste" numerically within this passage. The cited claim that "processing an LLM request can be 10× more expensive than a traditional keyword query" is attributed in the source to a separate reference the excerpt does not identify, so it should be read as a cited estimate from elsewhere, not a finding of this paper.
Inquiring lines that read this note 9
This note is a source for these research framings, grouped by the broader line of inquiry each explores. Scan the bold lines of inquiry; follow any specific question forward.
How can language models effectively manage long-context memory without quality degradation?- Why does KV cache memory waste grow worse with longer sequences and larger models?
- How does block-wise KV cache pruning differ from PagedAttention's packing strategy?
- How does PagedAttention differ from LMCache in solving KV cache memory limits?
- Can KV cache offloading generalize beyond vLLM and SGLang inference engines?
- What latency tradeoffs emerge when moving KV cache between GPU and CPU storage?
- What storage hardware conditions are needed for offloading to reduce latency?
Related concepts in this collection 3
This note in its neighbourhood — explore the map, then jump to a related concept in the list below.
Click a node to walk · click center to open · click Open in graph to see this note in the full knowledge graph
-
Can recursive subtask trees overcome context window limits?
Explores whether modeling reasoning as prunable trees of subtasks could eliminate the context length constraints that currently force developers into multi-agent architectures. Asks if working memory can become truly unlimited through selective KV cache retention.
both manage the KV cache directly, but pruning frees capacity within one request where paging fits more requests at once
-
Does recomputing weights cost less than moving them on mobile?
Explores whether mobile hardware's memory bottleneck makes it cheaper to recompute transformer blocks than to fetch their weights twice, and whether this trades accuracy for efficiency.
both exploit a memory-bound serving regime, but one reuses static weights on-device, the other repacks dynamic per-request state in a data center
-
What actually limits language models on mobile phones?
Is the shift toward smaller LLMs driven by quality trade-offs, or by hard physical constraints on device memory and battery life? This note examines whether sub-billion models are a practical necessity rather than a compromise.
contrasts the memory ceiling: fixed mobile DRAM capping model size versus data-center GPU memory fragmented by request batching
Related papers in this collection 8
Papers most semantically related to this note, ranked by cosine similarity in the embedding space.
- Efficient Memory Management for Large Language Model Serving with PagedAttention
- LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inference
- QoS-Efficient Serving of Multiple Mixture-of-Expert LLMs Using Partial Runtime Reconfiguration
- Don't Break the Cache: An Evaluation of Prompt Caching for Long-Horizon Agentic Tasks
- MobileLLM: Optimizing Sub-billion Parameter Language Models for On-Device Use Cases
- GateMem: Benchmarking Memory Governance in Multi-Principal Shared-Memory Agents
- Hogwild! Inference: Parallel LLM Generation via Concurrent Attention
- The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMs
Original note title
PagedAttention borrows OS virtual memory paging to cut KV cache waste and lifts vLLM throughput 2-4× over existing serving systems