Overview

You can run an LLM on CPU only: a model runs on CPU when its weights and KV cache sit in system RAM instead of VRAM, and the hard requirement is enough RAM to hold them. The byte formula does not change. What changes is which memory holds the bytes, and how wide the path to that memory is. This page does not publish a tokens-per-second comparison. The sizing formula is on llm-quantization-explained and the method is in methodology; for the VRAM versus RAM split see ram-vs-vram.

Can you run an LLM on CPU only?

Yes. The quantize README says the models are fully loaded into memory and that you need sufficient RAM to load them. If there is no GPU in the budget, that memory is system RAM. The weight size is still llm-quantization-explained: Llama 3.1 8B Q4_K_M is a 4.9 GB file in that README, and Llama 3.1 70B Q4_K_M is 43.1 GB, before KV cache. A machine without a GPU still has to hold those bytes.

Ollama’s FAQ describes a load as 100% GPU when the model is entirely on the GPU, and as a CPU/GPU percentage when it is split. Forcing NVIDIA GPUs off is documented on Ollama’s GPU page by setting CUDA_VISIBLE_DEVICES to an invalid id such as -1.

How does GPU offload work?

llama.cpp’s CLI README, read on 2026-10-12, defines -ngl / --gpu-layers / --n-gpu-layers as the maximum number of layers to store in VRAM. The value can be an exact number, auto, or all. Layers that are not stored in VRAM stay on the CPU.

Ollama’s generate API lists num_gpu as a runtime option. The example request sets "num_gpu": 1 next to "main_gpu": 0. The API page shows the key and does not define what the integer counts, so this page does not translate num_gpu into a layer count. Use the FAQ’s 100% GPU versus split CPU/GPU description for what a partial load means, and use llama.cpp’s --n-gpu-layers when you need a layer count.

How much system RAM do I need for CPU inference?

At least the weight bytes plus the KV bytes, plus the same 1 to 2 GB overhead assumption used on vram-requirements. For a CPU-only Qwen2.5-7B Q4_K_M estimate at 4,096 tokens: 4.6558 GB weights + 0.2349 GB KV + 1 to 2 GB = 5.8907 to 6.8907 decimal GB of system RAM for the model, before the operating system. For Llama 3.1 70B Q4_K_M, the README file is already 43.1 GB before KV. LM Studio recommends at least 16 GB of RAM on Windows. That recommendation is smaller than a 43.1 GB file, so it does not mean a 70B Q4_K_M file fits in 16 GB of RAM.

Mac RAM is how much RAM for a local LLM.

Why is CPU inference slower than GPU?

The weights have to be read from memory for each token. A discrete GPU’s memory is a separate device with its own interface width: 512-bit on the RTX 5090 page, 384-bit on the RTX 4090 and RTX 3090 pages, 256-bit on the RX 9070 XT page. System RAM is on the CPU’s memory bus. This page does not assign a GB/s number to that bus, because no motherboard or DRAM spec is cited here, and the NVIDIA pages fetched on 2026-10-12 did not list GPU memory bandwidth either. The qualitative point is the one the hardware already states: GPU weights that fit in VRAM move across the GPU’s own memory interface, and CPU weights move across system memory. No tokens-per-second ratio is inferred from that.

Do MoE models help on CPU?

A mixture-of-experts model can apply only some of its parameters to each token, so the parameters that move per token can be fewer than the file size. Use total parameters to decide whether the file fits in RAM and active parameters to reason about how many bytes move per token. See moe-cpu-offload for the offload page. A specific active-parameter count is unknown on this page: no MoE model card is quoted here. The llama.cpp quantize README mentions MoE work in its background links and does not, in the sections used above, give an active-versus-total count to copy. Do not treat the whole file size as the per-token traffic, and do not invent the active count either. The file still has to be stored. A 43.1 GB Q4_K_M file is still 43.1 GB on disk and in memory if the runtime loads it, whether or not every parameter is used on every token.

Is running an LLM on CPU or GPU better?

GPU is better when the whole model fits in VRAM, because the weights then sit behind the GPU’s own memory interface (see the bus widths in the section above). CPU is the option when the file does not fit in VRAM, or when there is no GPU. A split is the third case: llama.cpp keeps up to N layers in VRAM and the rest on the CPU. How much faster one is than the other is unknown here: no cited run names a machine, so no ratio is published. Check VRAM fit on vram-requirements.

Does RAM speed matter, and is DDR4 or DDR5 better?

Qualitatively yes, because the weights are read from system memory for each token (see the section above on why CPU is slower). The size of the effect is unknown here. A DDR4 versus DDR5 bandwidth number and a tokens-per-second difference are both unknown on this page: the AMD EPYC white paper and the Corsair memory guide were attempted on 2026-10-13 and could not be read (the AMD URL returned an HTML shell that is not the PDF, and Corsair returned HTTP 403), so no figure from them is used.

What is the best CPU for LLM inference?

Unknown. No CPU spec page or measured CPU run is cited here, so this page names no model. What the cited material supports is the rule above: capacity first (the file plus KV plus overhead must fit in RAM), then the width of the memory path. See local-llm-pc-build for the rest of the PC.

What is the best LLM to run on CPU only?

The one whose file fits in your RAM with room for the operating system. Using the figures already on this page, Qwen2.5-7B at Q4_K_M needs 5.8907 to 6.8907 decimal GB for the model at 4,096 context, while Llama 3.1 70B Q4_K_M is a 43.1 GB file before KV. A mixture-of-experts model fits by total size and moves fewer bytes per token, but no active-parameter count is cited here. For MoE and gpt-oss sizing see gpt-oss-vram-requirements and moe-cpu-offload.

How do I force Ollama to use the CPU instead of my GPU?

Ollama’s GPU documentation says: “If you want to ignore the GPUs and force CPU usage, use an invalid GPU ID (e.g., “-1”)“. For NVIDIA set CUDA_VISIBLE_DEVICES=-1; for AMD on Linux the same approach applies with ROCR_VISIBLE_DEVICES; for Vulkan GPUs, OLLAMA_VULKAN=0 or GGML_VK_VISIBLE_DEVICES=-1 disables them. Check the result with ollama ps: the Processor column shows 100% CPU when the model is loaded entirely in system memory. If Ollama is using the CPU when you wanted the GPU, see ollama-not-using-gpu.

Questions

Can I run an LLM without a GPU?

Yes. The weights and KV cache load into system RAM instead of VRAM, so the requirement is enough RAM: the weight file plus KV cache plus an assumed 1 to 2 GB overhead, before the operating system. Qwen2.5-7B Q4_K_M at 4,096 context is 5.8907 to 6.8907 decimal GB by that formula (methodology).

Is running an LLM on CPU or GPU better?

GPU when the model fits in VRAM; CPU or a CPU/GPU split when it does not. The speed ratio is unknown here because no cited run names a machine.

Does RAM speed matter for LLMs?

Qualitatively yes, since weights are read from memory for every token, but the size of the effect is unknown on this page. No bandwidth figure is cited.

DDR4 or DDR5 for LLM inference?

Unknown. No cited source on this page gives a DDR4 or DDR5 bandwidth or a tokens-per-second difference. Capacity comes first: the file must fit in RAM.

What is the best CPU for LLM inference?

Unknown. No CPU is named because no CPU spec or measured run is cited. Choose for RAM capacity and memory path width, and see local-llm-pc-build.

What is the best LLM to run on CPU only?

The largest one whose Q4-class file plus KV cache and overhead fits in your RAM, for example Qwen2.5-7B Q4_K_M at about 5.9 to 6.9 GB. Mixture-of-experts models fit by total size; see moe-cpu-offload.

How do I force Ollama to use the CPU instead of my GPU?

Set CUDA_VISIBLE_DEVICES to an invalid id such as -1 for NVIDIA GPUs, as Ollama’s GPU documentation describes, then confirm 100% CPU in ollama ps.

How many tokens per second will I get on CPU?

Unknown. No vendor page or project README cited here publishes a CPU tokens-per-second figure with a named machine, so none is given.

Can I run Gemma 4 without a GPU?

Possibly, if the chosen file fits in system RAM. The Gemma 4 parameter counts and file sizes were not read from a model card for this page, so the RAM needed is unknown here; apply the same formula once you have the card’s parameter count, and see gemma-vram-requirements. On a Mac, see Gemma on Mac.

Can I set llama.cpp to GPU for some layers only?

Yes. --n-gpu-layers N stores up to N layers in VRAM. all stores every layer it can. Layers past that stay on the CPU. That is the CLI README’s definition, not a speed promise.

What does Ollama’s num_gpu integer mean?

The API example includes it. The sentence that would define the integer is not on that page, so the meaning of a particular integer is unknown here.

Sources read on 2026-10-13