What is CPU offloading?

CPU offloading is a technique that keeps part of the model weights, key and value cache or training optimiser state that do not fit GPU memory in system memory, moving them to the GPU when needed, so a model can run or train with limited GPU memory.

Unlike CPU inference, where all computation runs on the processor, offloading keeps most computation on the GPU, using system memory mostly as extra storage. KV cache offloading is the form applied only to the cache.

Topic
Inference and performance
Also known as
Offloading, CPU offload

How CPU offloading works

  1. Based on the memory budget, the system decides which layers or data stay in system memory.
  2. When needed, this data moves to the GPU over the bus between processor and GPU.
  3. Well-designed systems overlap transfer with computation to cut waiting; some computation can also run on the processor.
  4. As the amount and frequency of transfers grow, bus bandwidth becomes the bottleneck for speed.

In more detail

Dynamic swapping, hybrid execution and expert offloading

Modern offloading separates two distinct patterns: dynamic weight/KV swapping over PCIe (moving tensors to the GPU just-in-time) and hybrid execution (running cold layers or sparse MoE experts directly on the CPU). In current Mixture-of-Experts (MoE) inference, keeping shared attention layers and hot experts in VRAM while executing cold routed experts on CPU/RAM avoids transferring large weight matrices per token.

Pinned memory, DMA and double buffering

Efficient offloading requires page-locked (pinned) host memory so the GPU can pull tensors asynchronously via Direct Memory Access (DMA) across separate CUDA streams while compute kernels execute. Without pinned memory and double-buffering, the OS must copy pages through staging buffers, stalling GPU execution and creating severe PCIe contention.

Arithmetic intensity and the bus bandwidth arithmetic

Because a GPU reads HBM at terabytes per second while PCIe Gen4/Gen5 x16 delivers roughly 32 to 64 GB/s per direction, offloading is viable only when arithmetic intensity is high enough to hide transfer latency, as in large-batch prefill or training, rather than memory-bandwidth-bound autoregressive decoding with batch size 1. In unified/coherent interconnect architectures (such as NVLink-C2C), CPU-GPU bandwidth rises substantially, narrowing this gap.

Commonly confused terms

TermHow it differs
Gradient checkpointingActivation checkpointing trades extra GPU compute for lower activation memory by discarding and recomputing intermediate activations during backpropagation, without moving weights to system RAM.
Model parallelismTensor and pipeline parallelism split a model across multiple GPUs over high-speed NVLink/InfiniBand interconnects to scale both memory and compute, whereas CPU offloading spills across the much slower host PCIe bus to fit a single or small GPU budget.

Why CPU offloading matters for on-premises AI

CPU offloading is a cheap way to try a larger model or fit optimiser state without new GPUs, useful for in-house testing and latency-insensitive batch jobs. The cost is speed: the bus is far slower than GPU memory, so response time can grow markedly in latency-sensitive work such as interactive chat. It suits temporary or batch work rather than user-facing production systems.

ON-PREMISES EXAMPLE

A research institute uses a model too large for its single-GPU in-house workstation by offloading some layers to system memory for overnight batch document classification; the same setup is not used for user-facing chat.

Common questions

Can CPU offloading replace GPU memory?

No. It adds capacity, but the bus is much slower, so speed drops. It is used carefully for latency-sensitive work.

How does CPU offloading differ from CPU inference?

With offloading, computation mostly stays on the GPU while system memory adds storage. In CPU inference all computation runs on the processor.

Sources

In the glossary: Glossary, A to D

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.