You can run a local language model on a CPU-only machine. The practical route is a small, quantized model served by an inference stack such as llama.cpp, Ollama, or LM Studio — and the honest expectation is slower generation than a suitable GPU, with results that remain useful for short offline writing, simple extraction from text you supply, and occasional chat.
This guide is for technically curious beginners and intermediate practitioners working on an ordinary laptop or desktop without a dedicated GPU. It explains why CPU inference works at all, what to install first, how to run a model with CPU-only flags, what a successful run looks like, and where CPU inference stops being practical. The commands below are reproduced from a published llama.cpp CPU walkthrough and a separate CPU-only guide; they are documented examples, not a benchmark of any specific machine.
Why a CPU can run a language model at all
Large language models are usually run at reduced numerical precision. Quantization stores model weights in fewer bits than the original training format, which makes the model smaller and cheaper to move through memory. llama.cpp is an inference stack implemented in C and C++ for running modern LLM architectures, and GGUF is a quantization format that llama.cpp can load. That pairing is what makes CPU inference realistic: the model fits in ordinary system RAM, and the runtime is compiled for the CPU instead of requiring CUDA or another GPU compute stack.
Generation on a CPU is still bounded by memory bandwidth and per-core throughput. Every weight has to travel through a comparatively narrow path, so token-by-token output is the part that feels slow — not the download, and usually not the initial load.
What CPU-only local AI is good for — and what it is not
The CPU-only guide is direct about the tradeoff: extra RAM may let a larger model load, but it does not make an ordinary CPU generate answers as quickly as a suitable GPU. The workloads it lists as reasonable are learning, short offline writing, simple extraction from text you supply, and occasional chat on a computer you already own. Long documents, large models, and coding agents can make the wait impractical.
That framing matters because it sets a decision rule rather than a promise. CPU inference is not a degraded version of GPU inference that you should feel bad about; it is a different operating point. If your task tolerates a wait measured in seconds per answer and your prompts are short, a CPU-only setup can be entirely sufficient. If your task is an interactive coding agent that reads a large repository, the same setup will feel broken even though nothing is malfunctioning.
Prerequisites to check before installing anything
Three facts about your machine determine almost every later choice: how much system RAM you have, whether your CPU supports the instruction sets your chosen app requires, and how much disk space you can spare for model files. A fourth factor, the context length you intend to use, affects memory use at runtime rather than at download time.
Memory planning should account for the quantized weights plus the context/KV cache and runtime overhead. Weight file size alone is not total memory use, and a model that appears to fit may still fail or swap once a long conversation fills the context window.
Step 1: choose one application
The CPU-only guide suggests picking a single app for the first test, because installing several duplicates model downloads without making the CPU faster:
- Ollama — useful if you are comfortable with a terminal and want local model commands or an API. Check its platform requirements before installing.
- LM Studio — useful if you want menus and a desktop chat interface. Its x64 Windows app requires AVX2 CPU instructions, so an old processor is not supported merely because it runs Windows.
- llama.cpp — useful if you want direct CPU control and can manage the build or the appropriate binaries. Its build guide documents CPU builds, and this is the more technical path.
Step 2: choose a model size that leaves headroom
The same guide offers starting points rather than measured performance tiers. For an 8 GB RAM computer, investigate a 1B–2B-class 4-bit model first. For 16 GB or more, a 3B–4B candidate may be worth comparing once the small model works. CPU, memory bandwidth, context length, and background applications all affect the result, so treat these as a starting range and adjust from there.
In Ollama, an example small download is:
ollama run qwen3:1.7bThat tag names a particular packaged model. The first run downloads it; later local runs reuse the local copy. Check the exact file and license before choosing a model for real work.
A minimal llama.cpp CPU setup, step by step
If you want explicit control over CPU-only execution, llama.cpp is the clearest path. The following sequence follows the published walkthrough, which demonstrates Mistral 7B Instruct v0.2 in GGUF form running on an older MacBook Pro without a GPU.
Build llama.cpp
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
makeOptional: install Python bindings
If you want to call the model from Python, the same walkthrough installs llama-cpp-python inside a virtual environment:
python3 -m pip install --user virtualenv
python3 -m venv venv
source venv/bin/activate
python3 -m pip install llama-cpp-pythonDownload a GGUF model
You can quantize models yourself, but many popular models already have GGUF versions on Hugging Face. The walkthrough uses mistral-7b-instruct-v0.2.Q6_K.gguf, stored under ./models/. Note that a Q6_K file is relatively large for CPU-only use; if your machine has limited RAM, a smaller model class or a lower-bit quantization is the more sensible first experiment.
Run with all layers on the CPU
To run the model on CPU only, the walkthrough stresses setting -ngl 0, which keeps zero layers offloaded to a GPU:
./main -m ./models/mistral-7b-instruct-v0.2.Q6_K.gguf
-ngl 0 -p 'Who is the president of USA?'You can also keep the prompt in a file and force deterministic sampling with --temp 0.0:
./main -m ./models/mistral-7b-instruct-v0.2.Q6_K.gguf
-ngl 0
-f ./prompts/my-prompt.txt
--temp 0.0The same flags apply in interactive mode:
./main -m ./models/mistral-7b-instruct-v0.2.Q6_K.gguf
-ngl 0
--color
-ins -b 256
--temp 0.0Call the model from Python
from llama_cpp import Llama
llm = Llama(
model_path="./models/mistral-7b-instruct-v0.2.Q6_K.gguf"
)
output = llm(
"Q: Who is the president of USA? A: ",
max_tokens=32,
stop=["Q:", "n"],
echo=True
)
print(output)What a successful run looks like
The model loads into system RAM without an error, the process prints generated tokens to the terminal (or returns a Python dictionary when called through llama-cpp-python), and no GPU is involved. In interactive mode you get a prompt loop where each answer appears after a visible delay. That delay is the observable you should record for your own machine: it, more than any published figure, determines whether CPU-only inference is useful for your task.
Likely problems and how to diagnose them
Treat each of these as a hypothesis to confirm rather than a diagnosis. Work from the cheapest check upward.
- Answers take far longer than expected, or the machine becomes unresponsive. The model may be too large for available RAM, forcing swapping. Drop to a smaller model class or a lower-bit quantization and retest the same prompt.
- The model fails to load or reports an out-of-memory condition. Check total RAM against the quantized weights plus context/KV cache and runtime overhead. Shortening the context length is often the fastest way to confirm this.
- You are unsure whether the GPU is being used. In llama.cpp,
-ngl 0is the CPU-only setting. If you see partial offload behavior, inspect the flag you actually passed. - LM Studio will not start on an older Windows machine. Its x64 Windows app requires AVX2 CPU instructions; a processor without them is outside the supported set regardless of the Windows version.
- Output is repetitive or incoherent. Verify the prompt format expected by the specific model, check your stop tokens, and try
--temp 0.0for a deterministic comparison run.
Limits worth planning around
Two constraints dominate CPU-only work. The first is generation speed, which is tied to memory bandwidth and does not improve much by adding RAM. The second is context: longer conversations and long source documents increase memory use and lengthen the wait per answer, which is why the CPU-only guide places long documents and coding agents outside the comfortable range.
A supported integrated GPU may be another option, but the guide is careful on this point — shared memory is not the same as dedicated VRAM, and it should not be counted as such when estimating what will fit. If your machine has an integrated GPU, test it as a separate configuration rather than assuming it changes the CPU-only picture.
A sensible next step
Install one application, download one small quantized model sized to your RAM, run a single short prompt, and time the answer. If the wait is acceptable for your task, expand from there — a slightly larger model, a longer context, a small script that feeds text in and captures output. If the wait is not acceptable, the problem is the operating point, not the setup, and the fix is a smaller model or different hardware rather than more configuration.
Readers working through this are welcome to share their goal, their machine’s RAM and CPU, the model and quantization they chose, and the wait they measured in the community — concrete environments and observed results are what make CPU-only guidance useful to the next person.
FAQ
Can a 7B model really run on a CPU-only machine?
Yes. A published walkthrough demonstrates Mistral 7B Instruct v0.2 in GGUF form running on an older MacBook Pro without a GPU using llama.cpp with -ngl 0. Whether the speed is acceptable depends on your CPU, RAM, quantization level, and how long you are willing to wait.
Does adding RAM make CPU generation faster?
No. The CPU-only guide states that extra RAM may let a larger model load, but it does not make an ordinary CPU generate answers as quickly as a suitable GPU. RAM affects what fits, not how fast tokens come out.
Which app should I install first?
Pick one and test it before installing others, since multiple apps duplicate model downloads without improving speed. Ollama suits terminal and API use, LM Studio suits a desktop chat interface (x64 Windows requires AVX2), and llama.cpp suits direct CPU control on a more technical path.
Can an integrated GPU help instead?
It may be worth trying, but the CPU-only guide cautions that shared memory is not dedicated VRAM and should not be counted as such. Treat an integrated GPU as a separate configuration to test rather than an assumed upgrade.