The GPU Does the Math. The CPU Runs the Show.
From the publisher’s feed, collected in the ZeroLabs newsroom.
The GPU Does the Math. The CPU Runs the Show.Nov 23, 2026 · @Srinivas KodaliThe GPU does the math. The CPU runs the loop around it. Agents make that loop longer, and that changes how we should size inference servers, from CPU cores to RAM.Most talk about inference capacity starts and ends with GPUs. I wanted to understand what the rest of the server is doing while the GPU works, so I went through serving-engine design notes, recent research papers and vendor benchmarks. The picture that came out is simple: the GPU can only go as fast as the CPU feeds it.For years, the CPU side was an afterthought. Agents have moved it to the center. An agent calls tools, reads the results and sends a longer prompt back to the model, and most of that work lands on the CPU. In 2026, server CPU demand rose largely for this reason (IEEE Spectrum).This article walks through the phases of inference one at a time and shows what the CPU and the GPU each do in every phase. Then it looks at what changes as a deployment scales, takes on a question that comes up in every server spec (is more RAM worth it?), and ends with what I would check before buying another GPU. It builds on my earlier pieces, PCIe in AI Inference: Where It Shines and Where It Lags and When the KV Cache Spills Over PCIe, which looked at the link between the two chips.1. A simple mental modelI personally like to cook, so the picture that works best for me is a restaurant kitchen. A restaurant kitchen makes a good picture. The GPU is a huge stove that can cook hundreds of dishes at once. The CPU is the expediter: it takes the orders, decides what goes on the stove next, plates the food and runs out for missing ingredients. A faster stove does not help if the expediter can’t keep up.Figure 1: The path of one request through a serving engine such as vLLM, SGLang or TensorRT-LLM.Three things in this picture matter most:The CPU touches every request first and last. Parsing, tokenizing, detokenizing and streaming are all CPU work.Decode is a tight loop between the two chips. After every step, the CPU collects the new tokens, updates each request, checks for stop conditions and launches the next step. This is the hot path.Agents add a second, slower loop. Each tool call runs on the CPU, and the whole conversation is tokenized again before it goes back to the GPU.2. Why the work splits this wayThe split is not random. The GPU is built for bulk math and fast memory. The CPU is built for branching logic, small varied tasks and large memory. Table 1 puts them side by side.Table 1: GPU vs. CPU at a glance: what each chip is built for.The row that explains the most is the decode limit. Decode reads all the model weights for every token, so it runs at the speed of memory. An 8B model in BF16 has about 16 GB of weights, so the speed limit for one user is roughly memory bandwidth divided by 16 GB.That one division explains the split. It is why the GPU does the model math, and why the CPU’s larger but slower memory works better as an overflow tier, or as a home for model parts that don’t fit on the GPU.3. The phases of inference, one by oneWhen people say “inference”, they usually mean the model math. In practice, one request passes through six phases, and only two of them are mostly GPU work. Figure 2 shows who is busy in each phase. Table 2 sums it up.Figure 2: Who is busy in each phase of one request. Not to scale.Table 2: The phases of inference at a glance.Phase 1: Intake (CPU)The request arrives as text over HTTP. The CPU parses it, applies the model’s chat template and turns the text into token IDs. If the engine keeps a prefix cache, the CPU also checks whether the start of this prompt has been seen before.Tokenizing sounds trivial, but its cost grows with prompt length. A 100-token chat message costs almost nothing. A 100,000-token document, or an agent that resends its whole history every turn, is a different story. All of this happens before the GPU sees anything, so it adds straight to time to first token (TTFT).Phase 2: Scheduling (CPU)Next, the scheduler decides which waiting requests join the next batch. It finds free space in GPU memory for each request’s KV cache, decides whether to split a long prompt into chunks, and sometimes pauses a request to make room. The result is a batch plan and a set of input tensors, which the CPU copies to the GPU.This is the engine’s brain, and its core loop usually runs on one main thread. That detail matters later: a single slow thread can hold back a whole GPU.Phase 3: Prefill (GPU, compute-bound)Prefill reads the whole prompt in one pass and writes the KV cache: the keys and values for every token, in every layer, that later tokens will look back at. Because the GPU processes thousands of tokens together, every weight it loads gets reused thousands of times. That makes prefill compute-bound. The tensor cores are the limit, not memory.To get a feel for the cost: a forward pass needs about 2 FLOPs per parameter per token. For an 8B model and an 8,000-token prompt, that comes to about 130 trillion FLOPs. An H100 peaks at 989 TFLOPS in dense BF16 (NVIDIA); if it sustains 500–600 TFLOPS in practice, prefill takes roughly a quarter of a second. That number comes back in the RAM section.The CPU’s role here is small but real. It launches the GPU kernels, and for very long prompts it feeds the GPU one chunk at a time so that other users’ decode steps don’t stall.Phase 4: Decode (GPU and CPU, every token)Decode writes the answer one token at a time for every request in the batch. Each step reads all the model weights and each request’s KV cache, but does very little math per byte it reads. That makes decode memory-bound.Here is the simple calculation that made decode click for me. A GPU has two speeds: how fast it does math, and how fast it reads data from its memory.Compare the two speeds. An H200-class GPU can do about 989 trillion math operations (FLOPs) per second, but it reads only about 4.8 trillion bytes per second from memory (NVIDIA). Divide one by the other and you get about 200. So for every byte the GPU reads, it can do about 200 operations. If a task does less math than that for each byte, the GPU spends most of its time waiting for data.Count the math in decode. For each new token, the GPU reads every weight in the model. Each weight is 2 bytes and is used for just 2 operations: one multiply and one add. That is only 1 operation per byte, so the compute units mostly sit and wait for memory.Add more requests to the batch. The GPU reads each weight once and uses it for every request in the batch. With about 200 requests, there is finally enough math for each byte read to keep the GPU busy.Remember the KV cache. Each request also reads its own KV cache, and that part can’t be shared with other requests. So every extra request adds more reading, and in practice the batch must be even larger before math becomes the limit.Two things follow from that:Adding users barely changes the step time. The step time is set mainly by reading the weights. For an 8B model, reading 16 GB at 4.8 TB/s takes about 3.3 ms, whether the batch holds one user or a few dozen.The CPU’s share keeps growing. After every step, the CPU collects the new tokens, updates each request, checks stop conditions and launches the next step. That work grows with every user, while the GPU’s step time barely moves.If the CPU does this work while the GPU waits, every step has a small gap, and thousands of steps add up. Modern engines hide the gap by preparing step N+1 on the CPU while the GPU runs step N (Figure 3). CUDA Graphs help too, by turning many small kernel launches into one. This overlap is now standard in vLLM, SGLang and TensorRT-LLM. With it, the GPU no longer sits idle while the CPU gets the next step ready.Figure 3: Without overlap, the GPU waits for the CPU at every step. With overlap, the CPU prepares the next step while the GPU works.Phase 5: Output (CPU)The new token IDs go back to the CPU, which turns them into text (detokenizing), checks for stop strings and streams the text to the user. The work per token is light, but it runs for every token of every user, so at high concurrency it adds up. Newer engines move this work out of the core loop so it can’t delay the next step.Phase 6: The agent loop (CPU)A plain chat request ends at Phase 5. An agent’s request doesn’t. Its output is a tool call: search the web, run code, query a database, read a file. The CPU runs the tool, often inside a sandbox, adds the result to the conversation and sends the longer prompt back to Phase 1.Three things make this phase heavy for the CPU:Tools are pure CPU and I/O work. While a tool runs, the GPU has nothing to do for that request.The context grows every turn. Tokenizing and prefill grow with it, unless the KV cache from the last turn is still around.Checks run around every step. Guardrails and safety filters, often small models, run before and after each turn, and they often stay on the CPU.This is the phase that changed the CPU story. In a study of agent workloads, tool processing on the CPU made up as much as 90.6% of end-to-end latency.4. What changes at scaleScaling inference is not one thing. A deployment can serve more users, run a bigger model, accept longer prompts, add more servers or add agents. Each one loads the GPU and the CPU differently, and it’s easy to scale the GPU side and forget the other.Table 3: What grows on each side at scale.More users on one GPUIn decode, adding users to the batch is the most efficient way to raise throughput, because the weights are read once per step for the whole batch. But CPU work per step grows with every user: more tokens to collect, more requests to update, more text to stream. At high concurrency, each step can end up waiting on the CPU instead of on GPU memory.A bigger model on more GPUsWhen a model is too big for one GPU, engines split each layer across several GPUs (tensor parallelism). Each GPU gets its own CPU worker process. Every step, all workers must launch their part before the GPUs can exchange results, so the group moves at the pace of its slowest worker. CPU needs therefore grow with the number of GPUs, not the size of the model, and one busy core can slow all eight GPUs.Longer promptsLonger context raises three costs at once: tokenizing (CPU, grows with length), prefill attention (GPU, grows faster than length) and KV cache size (memory, grows with length). For a model like Llama 3.1 8B (32 layers, 8 KV heads of size 128, BF16, per its published configuration), every token of context holds 2 × 32 × 8 × 128 × 2 bytes, or 128 KB, of KV cache. An 8,000-token conversation needs about 1 GB. A 128,000-token one needs about 16 GB, the same as the model’s own weights. Memory, not math, is usually the first wall.More serversPast one server, copies of the model sit behind a router. The router is CPU work too, and a smart one saves GPU work. If it sends a follow-up message to the copy that already holds that conversation’s KV cache, prefill is skipped entirely. That’s the technical case for routing by cache hits instead of plain round-robin: a hit skips prefill, the most compute-heavy phase of the request.More agentsAgent traffic scales with tool calls per second, not tokens per second. A coding agent that runs tests, or a research agent that fetches pages, can keep many CPU cores busy while barely touching the GPU. This is the part of the system most likely to be undersized, because it never shows up in a GPU-first capacity plan.5. Is more RAM worth adding?My short answer: yes, up to the size of the KV working set, if the traffic reuses context. Past that point, extra RAM mostly sits idle. Here is how I got there.What RAM does for inferenceGPU memory is small and fast. Server RAM is large and slower, but reading saved results from it avoids redoing the math. RAM earns its place in an inference server in three ways:A second tier for the KV cache. When GPU memory fills, the engine can move older KV blocks to RAM instead of throwing them away.A home for weights that don’t fit. Smaller setups can keep parts of a large model, such as the experts of a mixture-of-experts model, in RAM and run them on the CPU.Fast restarts and scale-up. Model files kept in RAM go straight to the GPU over PCIe, without waiting on disk or network storage.The first one carries most of the value, and a worked example shows why.A worked exampleThe example uses an 8B model on one 80 GB GPU. The weights use 16 GB. After the engine’s working buffers, roughly 50–60 GB is left for KV cache. At 128 KB per token, that’s room for about 400,000–480,000 tokens: 50–60 conversations of 8,000 tokens each.In the example, each GPU serves 200 active conversations of about 8,000 tokens, with users replying every minute or two. Their KV cache adds up to about 200 GB, and the GPU holds only about a quarter of it. Without a RAM tier, most replies mean running prefill again from scratch.With a RAM tier, the engine reloads the conversation’s 1 GB of KV cache over PCIe instead. A PCIe Gen5 x16 link carries about 64 GB/s in each direction, or around 50 GB/s after protocol overhead, so the reload takes about 20 milliseconds. Recomputing it takes about 250 milliseconds, as we saw in the prefill phase. The reason reloading is the better choice is technical: it only moves bytes over PCIe, while recomputing repeats about 130 trillion FLOPs of GPU work. During a reload, the GPU’s compute stays free for other users. Even if every conversation came back once a minute, reload traffic would be about 3–4 GB/s per GPU, well within what the link can carry.Across an 8-GPU server, those 1,600 conversations need about 1.6 TB of KV cache. That fits in the system memory of a typical 8-GPU server: NVIDIA’s DGX H100 pairs 640 GB of GPU memory with 2 TB of system memory.Figure 4: The KV working set outgrows GPU memory long before it outgrows server RAM. My estimate for the example above.When more RAM does not helpTraffic without reuse. One-shot requests with unique prompts never come back. Their KV cache is useless the moment the answer ends.Short prompts. If prefill takes a few milliseconds, recomputing takes about as long as reloading, so keeping the cache saves no time.Too few cores, not too little memory. If the GPU is waiting on scheduling or tools, more RAM changes nothing.A busy PCIe link. Reloads share the link with everything else. Past a point the link, not the RAM size, sets the limit. My earlier article, When the KV Cache Spills Over PCIe, goes deep on this.Past the working set. Once RAM holds the KV cache of every conversation likely to come back, extra capacity only holds conversations that won’t.Table 4: Does more RAM help? A quick check by workload.So is more RAM good? For chat and agent workloads with long conversations that keep coming back, yes. It lets the GPU serve a returning user without repeating prefill, because the conversation’s KV cache is still a PCIe transfer away. For short, one-shot traffic, the limit is somewhere else, so CPU cores or the engine version are the place to look.6. How to tell, and what to fixA CPU-starved GPU is easy to miss, because the GPU itself looks healthy. Its kernels run at normal speed while latency climbs.The cleanest test changes only the CPU side: the same load runs again with more cores per GPU. If latency improves while GPU kernel times stay the same, the CPU was the limit. A 2026 Georgia Tech study ran this kind of test on 8-GPU servers. With too few cores, time to first token on long prompts went up, while GPU kernel times changed by less than 1%. The GPU was waiting, not working.Current versions of vLLM, SGLang and TensorRT-LLM overlap CPU work with GPU work by default, so an upgrade removes the gap between steps. Dedicated cores give the tokenizer, the scheduler and each GPU worker room of their own, so none of them waits behind another.7. My rules of thumb for sizing the CPU sideEngine cores first. Start with 4–8 dedicated cores per GPU for the serving engine alone. A 2026 study measured slowdowns below that range, because the tokenizer, the scheduler and the GPU workers start competing for the same cores.Fast cores for the loop. The engine’s control loop runs largely on one thread, so per-core speed matters more than core count there.A separate pool for agents. Size tool and sandbox cores from the expected number of tool calls per second, not from the GPU count.RAM for the KV working set. Size RAM from the KV cache of the conversations likely to come back, not just the OS and the model files (Section 5).Re-profile after every GPU upgrade. The bottleneck often moves to the CPU.The industry is moving the same way. Training-era servers paired roughly one CPU with eight GPUs. Newer rack-scale designs pair one CPU with every two GPUs, and agent-heavy deployments are heading toward one-to-one .8. The takeawayOf the six phases, only prefill and the math inside decode belong to the GPU. Intake, scheduling, the per-step control, output and the agent loop all run on the CPU, and RAM decides whether a returning conversation is reloaded in about 20 milliseconds or recomputed in about 250.The GPU still does the math, and nothing I read changes that. What has changed is how much work surrounds the math. I now think of the CPU and its memory as part of the inference engine, not as the part that keeps the GPU fed. They should be sized from a profile of the actual workload, not from an old ratio.ReferencesChung, Jia, Jezghani, Kim (Georgia Tech), Characterizing CPU-Induced Slowdowns in Multi-GPU LLM Inference, arXiv, March 2026Raj et al. (Georgia Tech), Towards Understanding, Analyzing, and Optimizing Agentic AI Execution: A CPU-Centric Perspective, arXiv, 2025–2026M. S. Smith, The CPU Comeback Is Upon Us, IEEE Spectrum, August 2026Bowerman and Ableidinger, The CPU is back: Rethinking the CPU-GPU split for LLM inference, Red Hat, August 2026Tensormesh and University of Chicago, LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inference, arXiv, October 2025Chen et al., KTransformers: Unleashing the Full Potential of CPU/GPU Hybrid Inference for MoE Models, SOSP 2025The GPU Does the Math. The CPU Runs the Show. was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.