AIForum.

How to Compare CPU-Only vs GPU Offload for Local LLM Inference

On this page

THE SHORT ANSWER

The useful comparison is not CPU versus GPU in the abstract, but whether the model, its KV cache, and runtime overhead fit inside VRAM. A published layer sweep shows the transition is a cliff rather than a slope: 83% GPU offload delivered less than a third of full-offload throughput. This guide explains which metrics matter and how to run a reproducible sweep on your own hardware.
Quick facts

For local LLM inference, the comparison that matters is not CPU versus GPU in the abstract. It is whether the model, its KV cache, and runtime overhead fit inside GPU VRAM. When they fit, GPU offload is dramatically faster. When they do not, runtimes such as llama.cpp spill the overflow layers to system RAM, and throughput drops off a cliff rather than a slope. One published sweep of a 14B model on a single GPU measured 43.18 tokens per second with all layers on the GPU and 2.89 tokens per second with all layers on the CPU — roughly a 15× gap on the same model and the same quantization.

The guidance below is written for practitioners who already own a machine and want to know how to configure it, or who are deciding what to buy. It covers what the two configurations actually mean, which metrics make a comparison meaningful, how to run a reproducible sweep, and where the available evidence stops being generalizable to your hardware.

What CPU-only and GPU offload mean in practice

In a CPU-only configuration, every transformer layer executes on the processor and the weights live in system RAM. Decode speed is then limited mainly by how fast the CPU can stream weights out of memory, which is why memory bandwidth and the number of populated memory channels matter as much as core count when comparing CPU inference setups [1].

With GPU offload, the runtime keeps a chosen number of layers in VRAM and executes the rest on the CPU. In llama.cpp the relevant flag is -ngl, the number of layers to place on the GPU; a value of 0 is CPU-only, and a value at or above the model’s layer count is full offload [2]. Partial offload — the hybrid case — is what you normally end up with when a model is slightly too large for the card.

Two consequences follow. First, GPU offload is not one configuration but a spectrum, and the performance spectrum is not linear. Second, VRAM is not just weights: the KV cache grows with context length and batch size, and the runtime itself consumes memory, so the number of layers that fit is usually smaller than the weight size alone suggests.

Four metrics that make a comparison meaningful

A single tokens-per-second figure hides the differences that decide whether a setup is usable. Record at least four measurements.

  1. Decode throughput — generated tokens per second after the prompt has been processed. This is what determines whether interactive chat feels responsive.
  2. Prefill throughput — prompt tokens processed per second. Long prompts, RAG contexts, and document summarization are dominated by this phase rather than by decode [1].
  3. Time to first token (TTFT) — the wall-clock delay before the first generated token appears. It combines prefill cost and any model-loading overhead.
  4. Peak memory — VRAM and system RAM high-water marks. Without these, a throughput number cannot be reproduced or explained.

Hold everything else constant: the same model file, the same quantization, the same context length, the same batch size, the same sampling settings, the same runtime build, and the same prompt. Changing two variables at once — for example, moving layers to the GPU and shrinking the context — produces numbers that cannot be attributed to either change.

Also note that prefill and decode stress hardware differently. Decode is dominated by memory traffic per token; prefill is more parallel and benefits more from GPU compute [1]. A configuration that looks acceptable on a short prompt can behave very differently on a long one.

Why the curve is a cliff, not a slope

The most useful published evidence on this question is a layer sweep by InventiveHQ Lab, published 26 June 2026, using Qwen2.5-Coder-14B at Q4_K_M (48 layers) on an RTX 5060 Ti with llama.cpp. The team moved layers onto the GPU in steps and recorded throughput and VRAM at each step.

Measured throughput by number of GPU layers (Qwen2.5-Coder-14B, Q4_K_M, 48 layers, RTX 5060 Ti, llama.cpp). Source: InventiveHQ Lab, 26 June 2026.
-nglThroughputVRAM used
0 (all CPU)2.89 tok/s265 MB
83.58 tok/s2,161 MB
164.24 tok/s3,509 MB
245.61 tok/s4,875 MB
327.26 tok/s6,241 MB
4012.5 tok/s7,593 MB
99 (all 48)43.18 tok/s9,179 MB

Read the middle of that table carefully. At -ngl 40, 83% of the model’s layers were on the GPU, and throughput was 12.5 tok/s — less than a third of the full-offload figure. The final eight layers, moved off the CPU, produced a 3.5× jump in a single step. The authors describe the transition as a cliff rather than a slope, and the data supports that description.

The practical explanation is that per-token latency is set by the slowest stage in the pipeline. A small number of CPU-resident layers keeps the whole decode loop on the slow path, so adding GPU layers above that point buys little until the CPU-resident set is eliminated entirely. This is a general principle rather than something measured in the cited sweep, but it is consistent with both the shape of the curve and with the bandwidth-bound nature of decode [1].

The VRAM column is equally instructive. Full offload of a 14B Q4_K_M model consumed 9,179 MB — well above the raw weight size, because the figure includes runtime overhead and the KV cache. When you estimate whether a model will fit, estimate weights plus KV cache plus overhead, then verify by measurement.

A reproducible sweep protocol for your own hardware

The following is a suggested protocol, not a test performed for this article. Its purpose is to produce numbers you can defend and compare.

  1. Fix the model and quantization. Download one GGUF file and record its name, parameter count, quantization, and layer count.
  2. Fix the context and prompt. Choose a context length you actually use, and a prompt of a realistic length. Note both.
  3. Establish the CPU-only baseline. Run with -ngl 0 and record decode throughput, prefill throughput, TTFT, and peak RAM.
  4. Sweep the layer count. Step through increasing -ngl values up to the model’s layer count. Include the point just before the model stops fitting.
  5. Record VRAM at every step. Watch for the step where the runtime begins to fall back to shared memory or refuses to load.
  6. Repeat and take a median. Run each configuration at least three times; the first run is often slower because of caching and thermal state.
  7. Note the environment. GPU model and driver, CPU model, RAM capacity and channel configuration, runtime build and version, and operating system.

A llama-bench invocation that covers the sweep in one pass looks like this:

llama-bench -m ./models/model-q4_k_m.gguf -ngl 0,8,16,24,32,40,48 -p 512 -n 128 -r 3

For an interactive check of time to first token, use the CLI with the same settings:

llama-cli -m ./models/model-q4_k_m.gguf -ngl 40 -c 4096 -n 256 -p "Summarize the following report in five bullet points."

The observable result to look for is the point at which throughput stops improving roughly linearly and starts to jump. That point, not the theoretical maximum, is where you should place your default configuration.

Turning the results into a decision

Once you have the curve, the decision usually falls into one of four cases.

  • The model fits in VRAM with headroom. Use full offload. Reserve headroom for the KV cache at your real context length, and re-check after increasing context or batch size.
  • The model nearly fits. Prefer reducing memory demand over accepting the cliff: a smaller quantization, a shorter context, or a smaller model will often beat a hybrid configuration. The cited sweep shows why — 83% offload delivered less than a third of full-offload throughput.
  • The model does not fit and cannot be shrunk. Expect CPU-bound decode. If your workload is batch processing rather than interactive chat, low decode throughput may be acceptable; if it is interactive, it usually is not.
  • You are choosing hardware. For CPU inference, memory bandwidth and channel count are the levers that matter most [1]. For GPU offload, VRAM capacity determines whether you land on the fast side of the cliff at all.

Limitations of the available evidence

The sweep above covers one model, one quantization, one GPU, and one runtime family. It does not report prefill numbers, context length, prompt composition, repetition count, power draw, or thermal state, and it therefore cannot be generalized to other models or cards without your own measurement. Treat it as a demonstration of the shape of the curve, not as a prediction of your throughput.

The general explainer cited for bandwidth and channel guidance [1] is a community article compiled with AI assistance, so its architectural claims are useful for orientation but are not primary measurements. Where a specific number matters to a purchasing decision, verify it against your own sweep or a benchmark you can inspect.

Next step

Run the sweep on the model you actually intend to use, at the context length you actually use, and write down the four metrics. If you have already measured a configuration that surprised you — a hybrid setup that beat expectations, or a card that ran out of VRAM a layer earlier than predicted — share the model, quantization, hardware, and numbers in the community so others can compare against a real data point rather than a vendor claim.

FAQ

Does partial GPU offload always improve performance?

It improves performance, but not proportionally. In the cited sweep, putting 83% of a 14B model's layers on the GPU yielded 12.5 tok/s against 43.18 tok/s at full offload, so the last few CPU-resident layers carried most of the penalty.

How much VRAM does a 14B model at Q4 need?

The cited measurement used 9,179 MB at full offload for Qwen2.5-Coder-14B Q4_K_M, which is more than the raw weight size because it includes runtime overhead and the KV cache. Your own figure will depend on context length and batch size.

Is CPU-only inference ever the right choice?

It can be, when the model fits comfortably in system RAM and the workload tolerates low decode speed, such as offline batch processing. For interactive chat, the cited sweep puts CPU-only decode for a 14B Q4_K_M model at 2.89 tok/s on that machine, which is below comfortable reading speed.

What should I change first if a model does not fit in VRAM?

Reduce memory demand before accepting a hybrid configuration: use a smaller quantization, shorten the context, or choose a smaller model. Each of those moves can return the whole model to VRAM, which is where the large throughput gains are.

References

  1. CPU versus GPU inference for local open-source models — https://hub.llmnet.nl/en/cpu-versus-gpu-inferentie-voor-lokale-open-source-modellen
  2. The VRAM Cliff: 15× Slower the Moment Layers Spill to CPU — https://inventivehq.com/blog/vram-offload-cliff-gpu-layers-benchmark

Related terms

-ngl
The llama.cpp flag that sets how many model layers are placed on the GPU; 0 is CPU-only and a value at or above the layer count is full offload.
VRAM cliff
The sharp throughput drop that occurs when part of a model does not fit in GPU memory and layers spill back to the CPU, as opposed to a gradual slowdown.
Prefill vs decode
Prefill processes the input prompt in parallel; decode generates output tokens one at a time. They stress hardware differently and should be measured separately.
KV cache
Runtime memory holding attention keys and values for the current context. It grows with context length and batch size and competes with model weights for VRAM.
Q4_K_M
A 4-bit k-quant GGUF format commonly used for local inference, reducing weight size at some cost to output quality.

Leave a Reply

Your email address will not be published. Required fields are marked *