Operating systems split memory into flexible chunks to avoid waste — does that trick backfire when it's borrowed for serving AI models?
When would OS paging techniques actually harm rather than help LLM serving performance?
This explores the limits of borrowing operating-system memory tricks, such as splitting memory into pages, for running LLMs at scale: when do they stop paying off or start costing more than they save?
This explores when OS-style memory paging stops helping LLM serving and starts getting in the way. To be clear up front, the corpus has strong material on why paging helps and almost nothing that directly measures where it hurts. So the answer below works from neighboring evidence rather than one study that tests this.
Start with what paging fixes. While a model generates text, it keeps a running memory of the conversation so far, called the KV cache. Older serving systems reserved one large unbroken block of GPU memory for each request, sized for the longest output that request might produce. Most of that space was never used. PagedAttention splits the KV cache into small blocks that can sit anywhere in memory, the same way an operating system manages virtual memory. It also lets requests share blocks they have in common. Together this removes about 30% of wasted memory and gives 2-4× higher throughput at the same latency Can OS paging techniques reduce LLM serving memory waste?. That points to where the benefit lives: memory waste and memory sharing. If a workload has little of either (short, predictable requests, small batches, or memory that isn't the bottleneck), there is less to gain. Paging still adds a cost, because the model has to look up where each block lives every time it reads the cache. The corpus doesn't measure that cost, but the logic of the result implies it.
The clearest lateral warning comes from a close cousin of paging: prompt caching. A benchmark across OpenAI, Anthropic, and Google found caching cuts agentic API costs by 41-80%. But caching the full context naively can make things slower, because it spends effort storing dynamic content that will never be reused Does prompt caching actually reduce agentic LLM costs?. The same lesson likely carries over to paging and block sharing. Memory management that assumes content will be reused costs you when it isn't. What matters is whether your workload actually repeats itself, more than which technique you pick.
The workload itself also keeps changing, which shifts where paging pays off. Agent designs that separate reasoning from tool results stop the prompt from growing so fast and allow steps to run in parallel Can reasoning and tool execution be truly decoupled?. That means fewer, shorter caches to manage. Going the other way, long-context systems that read 4K-token chunks instead of short snippets Can long-context models resolve retriever-reader imbalance?, or that compress documents into short gist summaries Can LLMs read long documents like humans do?, change how much cache each request needs and how much requests have in common. Routing easy queries to smaller models Can routers select the right model before generation happens? changes the request mix again. Paging is a bet on one kind of memory pressure, many requests whose lengths vary and which share prefixes, and design choices like these can raise or lower that pressure.
The takeaway you might not have expected: the useful question is less "does paging help?" and more "does my workload actually reuse and fragment memory?" The best documented harm in this neighborhood comes from optimizing for reuse that never happens, not from paging itself. If you want to measure paging's own overhead, the corpus doesn't cover it yet. That's a real gap.
Sources 6 notes
PagedAttention applies OS virtual memory paging to the KV cache, storing blocks non-contiguously and enabling sharing across requests. This eliminates ~30% of memory waste from fragmentation, lifting vLLM throughput 2-4× over FasterTransformer and Orca on the same latency.
A benchmark across OpenAI, Anthropic, and Google found caching reduces API costs 41–80% and improves time-to-first-token 13–31% in multi-turn agentic tasks. However, naive full-context caching can increase latency by caching dynamic content that will never be reused.
ReWOO and Chain-of-Abstraction both decouple reasoning from tool responses through different mechanisms—planning-before-execution and abstract placeholders respectively—eliminating quadratic prompt growth and sequential latency while maintaining reasoning quality.
LongRAG shows that 4K-token units and long-context readers outperform 100-word retrieval on standard benchmarks. The optimal RAG design shifts from precise retrieval to coarse ranking plus deep reading as context windows expanded.
ReadAgent compresses documents into gist memories before knowing the task, then retrieves details only when needed, extending effective context 3–20× and outperforming retrieval baselines on long-document QA.
Show all 6 sources
RouteLLM and Hybrid-LLM both achieve 40-50% cost reduction by routing to a single model based on query difficulty prediction, not response evaluation. Single-model routing minimizes latency compared to ensemble or cascade alternatives.
Papers this line draws on 8
The research behind the notes this line reads — ranked by how closely each paper relates.
- A Human-Inspired Reading Agent with Gist Memory of Very Long Contexts
- Faith and Fate: Limits of Transformers on Compositionality
- Don't Break the Cache: An Evaluation of Prompt Caching for Long-Horizon Agentic Tasks
- Long-context LLMs Struggle with Long In-context Learning
- Know It, Act on It: Investigating Memory Utilization in LLM Personalization
- LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inference
- Hogwild! Inference: Parallel LLM Generation via Concurrent Attention
- Hybrid LLM: Cost-Efficient and Quality-Aware Query Routing