Awesome Open Source AI Awesome Open Source AI

Running a local LLM without a GPU

Yes—quantized small models can run locally on system CPU and RAM without a discrete GPU. Responses will be slower than dedicated GPU inference, so start with a small model to confirm everything works before trying larger ones.

Updated July 21, 2026

Fastest working route: Ollama on Linux

Ollama picks hardware based on what it finds at runtime. When no compatible GPU compute runtime is present, it runs the model on system CPU threads and system memory.

1. Install Ollama via official installer
curl -fsSL https://ollama.com/install.sh | sh

This downloads the binary and sets up a background service.

2. Execute small smoke-test model
ollama run tinyllama

The first run downloads the model once, then opens interactive chat. TinyLlama is only a low-memory smoke test to confirm execution—not a quality recommendation.

3. Verify active CPU placement
ollama ps

Check that the model is listed under CPU execution. Note: ollama serve is only needed if the CLI cannot connect to the service—not during normal operation.

Terminal output showing ollama ps reporting 100% CPU usage for tinyllama on a clean CPU-only Linux test machine
Clean Ubuntu CPU-only verification: Produced from a baseline test environment with 4 GiB system RAM, no /dev/dri devices, and no NVIDIA runtime. Running Ollama 0.32.1 with TinyLlama (637 MB download / 735 MB shown for the loaded model), ollama ps confirms 100% CPU allocation. This clean test confirms CPU placement; it is not a universal memory measurement or speed benchmark. Results will not generalize to higher-spec CPUs or larger models.

Choose a model that fits your RAM

Memory is shared by model weights, conversation context, the runner, and the OS. If RAM fills up, the machine may start swapping to disk and feel very slow. These tiers are conservative starting points only—actual fit depends on quantization, runner, OS memory use, and context length. Check the model file size and your runner’s docs, and test a small quantized model first before assuming a larger one will fit. If you hit pressure, shorten context or pick a smaller model before upgrading hardware.

RAMTierGood first testRealistic Expectation
4 GBSmoke test / MinimalTiny ~1B quantized models (e.g. TinyLlama) — test a small model firstConfirms setup works; little room left for OS or long context
8 GBEntry levelMay fit small quantized models (roughly 1B–3B class); verify file size firstBasic chat and short prompts; keep context modest
16 GBPractical workstationMay fit mid-size quantized models (often in the 7B–8B class at 4-bit)Practical starting point for local CPU chat and light coding help
32 GBExpanded capacityMay fit larger quantized models or longer context; check runner docsMore headroom for bigger weights and longer conversations
64 GB+High capacityMay fit very large quantized models or several concurrent CPU jobsCapacity-focused when speed is secondary; still test before committing

What will feel slow on CPU?

On CPU, two different waits often get mixed up with “how fast the model talks”:

  • Time-to-first-token (prompt prefill): Before the first word appears, the CPU has to work through the whole prompt. Long prompts, system instructions, or pasted code make this wait longer.
  • Token generation (streaming speed): After that, how quickly new words appear is often limited more by memory bandwidth than by raw core count alone.

Practical tips: keep context short (for example 2k–4k when you can), start with the runner’s default thread setting then compare a physical-core-count setting on your real prompts, and prefer 4-bit quantized models (such as Q4_K_M when available) to lower memory use per token.

If you prefer a desktop app: LM Studio

LM Studio is a desktop app for finding, downloading, and trying local models on Windows, macOS, and Linux. Without a discrete GPU, set GPU offload to zero (or use the CPU load path below).

Documented CLI CPU load mode
lms load <model_key> --gpu off

For CLI details, see the official LM Studio CLI documentation.

If you need more control: llama.cpp

llama.cpp is the core engine behind many local quantized runners. You point it at a model file and control how much (if any) work goes to a GPU.

Server command forcing CPU execution
llama-server -m /path/to/model.gguf --n-gpu-layers 0

--n-gpu-layers 0 (or -ngl 0) keeps model layers on CPU/system RAM. Optional flags include -t <threads> for thread count and -c <tokens> for max context—start from defaults, then compare settings on your own prompts.

Troubleshooting CPU execution

Cannot connect to Ollama daemon

If commands exit with could not connect to ollama app, start the service with ollama serve in another terminal, or check systemctl status ollama.

Out of Memory (OOM) & disk swapping

If the machine crawls or disk activity spikes while you prompt, RAM is likely full and swapping. Close other apps, lower context (for example num_ctx 2048), or use a smaller model / heavier quantization.

Excessive prefill delays on prompt submission

If you wait a long time before any tokens stream, the prompt is expensive to process on CPU. Shorten the system prompt, trim chat history, or reduce max context.

Apple Silicon distinction (Macs)

Apple Silicon Macs (M1 and later) have an integrated GPU and unified memory shared with the CPU, so they are not a strictly CPU-only setup. Supported runners can use Metal acceleration when available—check your runner’s macOS docs for current behavior rather than assuming pure CPU execution.

CPU vs GPU vs Hosted API

Pick a path based on budget, privacy needs, and how fast responses need to feel:

  • CPU-only: Good fit for hardware you already own, private local work, or batch jobs where waiting is acceptable.
  • Discrete GPU: Better when you want snappier interactive chat, faster coding help, vision workloads, or multi-step agent loops. See running local models on 8 GB VRAM.
  • Hosted APIs: Useful for occasional access to large frontier models without buying hardware. Explore open-source web UIs on the self-hosted ChatGPT stack registry.

Inference engines in the registry

llama.cpp logo

Baseline engine for CPU inference; supports explicit CPU-only runs with --n-gpu-layers 0 and common quantized model files.

Ollama logo

Runs on CPU when no compatible GPU runtime is available, with a simple install and built-in model management.

llamafile logo

llama.cpp bundled into a single cross-platform executable that runs on Linux, macOS, and Windows with minimal setup.

Frequently asked questions

Can I run an LLM without a discrete GPU?

Yes. Small quantized models run on system CPU and RAM with tools like Ollama, LM Studio, or llama.cpp. Expect slower responses than a GPU setup—start with a small model to see how your machine feels before trying anything larger.

Why does the first response take longer on CPU?

Before any output appears, the runner processes the full prompt (time-to-first-token / prefill). Long prompts, large system instructions, or pasted files make that wait more noticeable on CPU.

Does adding more CPU threads make inference faster?

Not always. Start with the runner’s default thread setting, then try a physical-core-count setting and compare both on your real prompts. The better choice depends on your CPU, OS, and workload—measure rather than assuming.

Is an Apple Silicon Mac considered a CPU-only machine?

Usually not in the strict sense. Apple Silicon has an integrated GPU and unified memory shared with the CPU. Supported runners can use Metal acceleration when available, so macOS setups are often hybrid rather than pure CPU-only.

Sources

Every tool listed is indexed in the Awesome Open Source AI registry, updated twice daily from the curated upstream source. For more serving engines and CPU backends, browse the Inference Engines & Serving category.

by Alvin