Run an LLM on CPU: How Much RAM You Need Without a GPU
By LLM Hardware team · Methodology ·
LLM Hardware team
Yes, you can run an LLM on CPU
Run an LLM on CPU and the model weights live in system RAM instead of GPU VRAM, so the question becomes how much RAM you have. The site formula is GB = params (billions) x bytes per parameter x 1.2 + 2. At Q4 (Q4_K_M, about 0.5 bytes per parameter), an 8B model needs 8 x 0.5 x 1.2 + 2 = 6.8 GB, and a 14B model needs 14 x 0.5 x 1.2 + 2 = 10.4 GB. If that number fits in your free RAM, the model can load and run without a GPU.
This guide covers the RAM math, how to confirm a model is running on the CPU, and the official settings that force Ollama or llama.cpp to stay off the GPU. If you have never run a local model, start with how to run LLMs locally and come back here for the CPU details. For a RAM sizing table from 8 to 128 GB, see how much RAM an LLM needs.
How much RAM you need to run an LLM on CPU
Use the same estimate the site uses for VRAM. On a CPU-only machine, read the result as system RAM:
- Formula: GB = params_billion x bytes_per_param x 1.2 + 2
- Q4 (0.5 bytes per parameter) simplifies to params_billion x 0.6 + 2
- Q8 (1 byte per parameter) simplifies to params_billion x 1.2 + 2
The 1.2 factor and the extra 2 GB cover activations and a short context of about 4K tokens. You can run other sizes through the VRAM calculator, which uses the same formula.
| Model size | Quant | Math | Estimated RAM |
|---|---|---|---|
| 4B | Q4 | 4 x 0.5 x 1.2 + 2 | 4.4 GB |
| 7B | Q4 | 7 x 0.5 x 1.2 + 2 | 6.2 GB |
| 8B | Q4 | 8 x 0.5 x 1.2 + 2 | 6.8 GB |
| 8B | Q8 | 8 x 1.0 x 1.2 + 2 | 11.6 GB |
| 14B | Q4 | 14 x 0.5 x 1.2 + 2 | 10.4 GB |
| 32B | Q4 | 32 x 0.5 x 1.2 + 2 | 21.2 GB |
| 70B | Q4 | 70 x 0.5 x 1.2 + 2 | 44 GB |
Families on the site that come in these sizes include Qwen3 (8B, 14B, 32B), Llama 3.1 (8B), Llama 3.3 (70B), Gemma 3, and Phi-4 (14B). The sizes are examples for the math only, not a quality ranking. For a 1.7B model that runs in about 3 GB at Q4, see the LFM3 hardware requirements guide.
Reading the table by machine size
Your operating system, browser and other apps also use RAM, so the estimate has to fit in what is left, not in the total on the spec sheet.
- On an 8 GB machine, a 4B Q4 model (4.4 GB) fits. An 8B Q4 model (6.8 GB) is tight on an 8 GB machine, because the OS and other apps share the same 8 GB.
- On a 16 GB machine, an 8B Q4 model (6.8 GB) fits with room. A 14B Q4 model (10.4 GB) fits with less room.
- On a 32 GB machine, a 32B Q4 model (21.2 GB) fits.
- On a 64 GB machine, a 70B Q4 model (44 GB) fits.
Longer context needs more RAM
The table assumes a short context of about 4K tokens, which is the default Ollama lists for under 24 GiB of VRAM. Ollama's context-length page, read 22 November 2026, also lists 32k from 24 to 48 GiB and 256k at 48 GiB or more, so the default can be larger than 4k. Check the CONTEXT column in ollama ps for the length in use. If you raise it, for example with OLLAMA_CONTEXT_LENGTH=8192 ollama serve or /set parameter num_ctx inside ollama run, the KV cache grows and adds RAM on top of the estimate above. Leave headroom if you plan to feed in long documents.
How to tell if your LLM is running on CPU
In Ollama, load a model and run:
ollama ps The Processor column tells you where the model loaded. Ollama's FAQ lists these values:
100% CPU: the model is loaded entirely in system memory. This is CPU-only.100% GPU: the model is loaded entirely into the GPU.- A split such as
48%/52% CPU/GPU: the model is loaded partly onto both.
A split is not CPU-only. It means part of the model is on the GPU and the rest has been offloaded to system RAM. If that is the setup you want, read the hybrid GPU and CPU offloading guide instead.
How to force Ollama to use the CPU
If your machine has a GPU and you want Ollama to ignore it, the official GPU docs say to hide the GPU with an invalid device ID. Set the variable in the environment of the Ollama server (the process started by ollama serve or the Ollama service), not only in the shell where you type ollama run.
- On NVIDIA, set
CUDA_VISIBLE_DEVICESto an invalid GPU ID such as-1. - On AMD (ROCm), set
ROCR_VISIBLE_DEVICESto an invalid GPU ID such as-1. - For Vulkan, set
OLLAMA_VULKAN=0orGGML_VK_VISIBLE_DEVICES=-1.
For example, on an NVIDIA machine:
CUDA_VISIBLE_DEVICES=-1 ollama serve Then load a model in another terminal and check ollama ps for 100% CPU.
Choosing the CPU library
Ollama ships multiple LLM libraries, including cpu, cpu_avx, and cpu_avx2, alongside the GPU ones. The troubleshooting page has an experimental override if you need a specific one:
OLLAMA_LLM_LIBRARY="cpu_avx2" ollama serve Per that page, cpu_avx2 performs best, followed by cpu_avx, and cpu is the slowest but most compatible. Rosetta emulation under macOS works with the cpu library. The server log lists the libraries it found in a line that starts with Dynamic LLM libraries. The exact list depends on your install.
Running llama.cpp on CPU
llama.cpp is the other common way to run an LLM on CPU. Its README says the main goal is LLM (and MLLM) inference with minimal setup and top performance on a wide range of hardware, locally and in the cloud. You can install it from llama.app or use the pre-built binaries, and the build docs include a CPU Build section if you compile it yourself.
Two documented CLI options matter on a CPU machine:
-t, --threads N: the number of CPU threads to use during generation (default: -1).-ngl, --gpu-layers, --n-gpu-layers N: the maximum number of layers to store in VRAM. It takes an exact number,auto, orall(default:auto).
-ngl decides how many layers go into VRAM. The RAM table above still applies to the portion of the model that is not stored in VRAM.
Is a Mac running CPU-only?
No. Apple Silicon Macs are not a CPU-only setup. Ollama's docs say it "supports GPU acceleration on Apple devices via the Metal API." When Metal is in use, the model is running on the Mac's GPU, not only its CPU, so the CPU-only advice on this page does not describe a typical Apple Silicon Mac. The cpu library note about Rosetta above is the one macOS case the troubleshooting page ties to a CPU library.
When a GPU helps
Running an LLM on CPU is a good way to try local models on the machine you already have. If you find that you want larger models in VRAM, or you see a CPU/GPU split in ollama ps and want the whole model on a card, a GPU is the upgrade path. The same formula tells you what fits: an 8B Q4 model at 6.8 GB sits under 8 GB of VRAM, and a 14B Q4 model at 10.4 GB sits under 12 GB.
Cards in that range include the NVIDIA GeForce RTX 4060 8GB, the RTX 4070 12GB and the Intel Arc B580 12GB. Compare them in the best budget GPU for LLMs guide. This site does not measure generation speed, so it does not quote a CPU versus GPU speed figure.
FAQ
Can I run an LLM on CPU?
Yes. Ollama and llama.cpp both run models on the CPU with the weights in system RAM. Size the model to your RAM with GB = params x bytes per param x 1.2 + 2. At Q4, an 8B model needs about 6.8 GB.
How much RAM do I need for an 8B model on CPU?
About 6.8 GB at Q4 (8 x 0.5 x 1.2 + 2) and about 11.6 GB at Q8 (8 x 1.0 x 1.2 + 2), for a short context of about 4K tokens. On an 8 GB machine, 8B Q4 is tight. On 16 GB it fits with room.
How do I force Ollama to use the CPU?
Hide the GPU from the Ollama server with an invalid device ID: CUDA_VISIBLE_DEVICES=-1 for NVIDIA, ROCR_VISIBLE_DEVICES=-1 for AMD ROCm or OLLAMA_VULKAN=0 or GGML_VK_VISIBLE_DEVICES=-1 for Vulkan. Restart the server, load a model and check that ollama ps shows 100% CPU.
What does 100% CPU in ollama ps mean?
It means the model is loaded entirely in system memory and is running on the CPU. 100% GPU means it is entirely on the GPU, and a split such as 48%/52% CPU/GPU means it is loaded partly onto both.
Is a Mac CPU-only for local LLMs?
No. Ollama supports GPU acceleration on Apple devices via the Metal API, so an Apple Silicon Mac running Ollama with Metal is not a CPU-only setup.
Does a longer context use more RAM on CPU?
Yes. The estimates assume about 4K tokens, which is the default Ollama lists for under 24 GiB of VRAM. The context-length page also lists 32k from 24 to 48 GiB and 256k at 48 GiB or more. Raising the context with OLLAMA_CONTEXT_LENGTH or num_ctx adds KV cache memory on top. The CONTEXT column in ollama ps shows the length in use.
Sources
| # | URL | Claim it supports | Date checked (PT) |
|---|---|---|---|
| 1 | https://llmhardware.io/methodology | Formula GB = params x bytes per param x 1.2 + 2; 1.2 and 2 GB cover activations and about 4K context | 2026-11-21 |
| 2 | https://llmhardware.io/vram-calculator | Same formula; worked Q4 figures; example tags qwen3:8b, qwen3:14b, llama3.3:70b | 2026-11-21 |
| 3 | https://docs.ollama.com/faq | ollama ps Processor column values (100% GPU, 100% CPU, CPU/GPU split); FAQ still states a default of 4096 tokens; OLLAMA_CONTEXT_LENGTH and num_ctx examples | 2026-11-22 |
| 4 | https://docs.ollama.com/gpu | Force CPU with CUDA_VISIBLE_DEVICES=-1, ROCR_VISIBLE_DEVICES=-1, OLLAMA_VULKAN=0 or GGML_VK_VISIBLE_DEVICES=-1; Metal GPU acceleration on Apple devices | 2026-11-21 |
| 5 | https://docs.ollama.com/troubleshooting | LLM libraries cpu, cpu_avx, cpu_avx2 and their order; Rosetta with cpu; OLLAMA_LLM_LIBRARY="cpu_avx2" ollama serve; Dynamic LLM libraries log line | 2026-11-21 |
| 6 | https://github.com/ggml-org/llama.cpp | README main goal, paraphrased; install via llama.app and pre-built binaries | 2026-11-21 |
| 7 | https://github.com/ggml-org/llama.cpp/blob/master/tools/cli/README.md | -t, --threads and -ngl, --gpu-layers, --n-gpu-layers definitions and defaults | 2026-11-21 |
| 8 | https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md | CPU Build section exists | 2026-11-21 |
| 9 | https://llmhardware.io/guides/best-budget-gpu-for-llms | Budget GPU comparison for 8 GB and 12 GB cards, linked from When a GPU helps | 2026-11-21 |
| 10 | https://llmhardware.io/hardware | Catalog listings for NVIDIA GeForce RTX 4060 (8GB), NVIDIA GeForce RTX 4070 (12GB), and Intel Arc B580 (12GB), named in When a GPU helps | 2026-11-21 |
| 11 | https://docs.ollama.com/context-length | Default context by VRAM: 4k under 24 GiB, 32k from 24 to 48 GiB, 256k at 48 GiB or more; CONTEXT column in ollama ps; OLLAMA_CONTEXT_LENGTH override | 2026-11-22 |