Key takeaways
- Memory decides what you can run: plan on about 2 GB per billion parameters at 16-bit, 1 GB at 8-bit and 0.6 GB at 4-bit, plus room for the KV cache.
- The KV cache grows linearly with context length and can outweigh a small model's weights at 128K tokens.
- 4-bit quantization (GGUF Q4_K_M or 4-bit MLX) is the practical default; move up to 5-8 bits when you have spare memory and need precision.
- Ollama and LM Studio are the easiest starting points, llama.cpp gives the most control, vLLM serves many users, and MLX is the native path on Apple Silicon.
- As of October 2026, Gemma 4, the Qwen3.5 to Qwen3.8 releases, gpt-oss and Mistral Small 4 cover hardware from 8 GB laptops to 128 GB Macs.
Running a language model on your own computer takes minutes once you know three things: how much memory the model needs, which file format to download and which tool will serve it. This guide covers the memory math, the main quantization formats, eight popular tools, a working Ollama setup and the open models that fit common hardware as of October 2026.
Why run an LLM locally
Local inference means the weights sit on your disk and every token is computed on your own CPU or GPU. Four reasons push people to do it.
- Privacy. Prompts, documents and outputs never have to leave the machine, which simplifies work with client files, unreleased code or regulated data. Treat it as one control among many, not a compliance guarantee.
- Cost. There are no per-token fees. Once you own the hardware, the marginal cost is electricity, which favors heavy, steady workloads such as bulk tagging or an all-day coding assistant.
- Offline use. A local model works on a plane, inside an air-gapped network and during a provider outage, with no rate limits.
- Control. You choose the exact model version, sampling settings and system prompt, and nothing gets retired unless you retire it. You can also fine-tune and run your own variants.
The trade-offs are real. The best open-weight models that fit on a desktop still trail the top hosted models on hard reasoning and long agentic tasks, and you become the operator responsible for updates and security.
Hardware basics: memory decides what you can run
VRAM, system RAM and unified memory
A model runs fastest when its weights and working memory fit entirely in GPU memory, or VRAM. Generating each token requires reading every active weight once, so speed is mostly limited by memory bandwidth. A GPU with about 1 TB/s of bandwidth holding a 16 GB model tops out near 60 tokens per second in theory (1,000 / 16), and real results land somewhat lower.
System RAM works too, but desktop memory delivers well under 100 GB/s, so CPU-only inference is several times slower. When a model slightly exceeds VRAM, llama.cpp-based tools split it between GPU and CPU, and speed drops as more layers move to the CPU.
Apple Silicon Macs use unified memory shared by the CPU and GPU, with bandwidth from roughly 100 GB/s on base chips to several hundred GB/s on Max and Ultra chips. A 64 GB or 128 GB Mac can load models no single consumer graphics card can hold. By default macOS lets the GPU use only part of that pool, commonly around two-thirds to three-quarters, so budget accordingly.
This is why mixture-of-experts (MoE) models are popular locally. Qwen3.6-35B-A3B stores 35 billion parameters but activates about 3 billion per token, so it needs the memory of a 35B model while generating at speeds closer to a small one.
A rule of thumb for weight memory
Weight memory is parameters times bytes per parameter. Quantized files carry a little extra for scaling factors, so 4-bit models work out to about 0.55-0.6 GB per billion parameters.
| Precision | Per 1B parameters | 8B model | 27B model | 70B model |
|---|---|---|---|---|
| 16-bit (FP16, BF16) | ~2 GB | ~16 GB | ~54 GB | ~140 GB |
| 8-bit (Q8_0, FP8) | ~1 GB | ~8 GB | ~27 GB | ~70 GB |
| 4-bit (Q4_K_M, AWQ, MLX 4-bit) | ~0.6 GB | ~5 GB | ~16 GB | ~42 GB |
Then add 10-20 percent for runtime buffers, the KV cache for your context length and 1-2 GB of headroom if the same GPU drives your displays. Ollama's default build of Qwen3.6 27B, for example, is a 17 GB download, which makes it a natural fit for a 24 GB card.
The KV cache grows with context
During generation the model stores attention keys and values for every token in the conversation. This KV cache grows linearly with context length and with the number of parallel requests.
KV cache bytes = 2 x layers x KV heads x head size x bytes per value x tokens
Llama 3.1 8B has 32 layers, 8 key-value heads and a head size of 128. At 16-bit precision that is 2 x 32 x 8 x 128 x 2 = 131,072 bytes, or 128 KiB per token. An 8K context needs 1 GiB, 32K needs 4 GiB and the full 128K needs 16 GiB, more than three times the 4-bit weights.
Newer designs that mix linear-attention layers with full attention, such as the Qwen3.5 and Qwen3.6 families, need much less per token. The VRAM calculator runs this arithmetic for specific models.
Quantization formats and quality trade-offs
Quantization stores weights in fewer bits. Going from 16-bit to 4-bit cuts weight memory by roughly 70 percent, and for most chat, writing and coding work the quality loss at 4 bits is small. Losses grow quickly below 4 bits and hit small models harder than large ones.
| Format | How it works | Where it runs | Best for |
|---|---|---|---|
| GGUF | Single file from the ggml project bundling quantized weights with tokenizer and chat-template metadata; levels from about 1.5 to 8 bits (Q4_K_M, Q5_K_M, Q8_0) | CPUs plus NVIDIA, AMD, Intel and Apple GPUs; supports CPU+GPU splits | Desktop use in llama.cpp, Ollama, LM Studio, Jan and GPT4All |
| GPTQ | Post-training method that quantizes one layer at a time, using a small calibration set to compensate for the error it introduces | GPUs | GPU serving with vLLM or Hugging Face Transformers |
| AWQ | Activation-aware method that protects the small share of weights that matter most, usually at 4 bits | GPUs | Fast 4-bit serving in vLLM |
| MLX | Apple's array framework and weight format, usually 4-bit or 8-bit, widely published by the mlx-community organization on Hugging Face | Apple Silicon only | Native-speed inference and LoRA fine-tuning on Macs |
| FP8 | 8-bit floating-point weights, often with 8-bit activations, accelerated in hardware | Recent data-center and workstation GPUs (NVIDIA Ada, Hopper and newer; AMD MI300 class) | Near-lossless production serving at half the memory of 16-bit |
Practical defaults:
- Start with Q4_K_M in GGUF or 4-bit MLX. Step up to Q5_K_M, Q6_K or Q8_0 when memory allows and the task punishes small errors, such as code, math, structured extraction or less common languages.
- A common rule of thumb holds down to about 4 bits: a larger model quantized harder usually beats a smaller model at higher precision in the same memory. Below 4 bits, test carefully.
- Prefer files from the model's publisher or well-known quantizers. Some labs ship quantized weights directly; OpenAI released gpt-oss in the 4-bit MXFP4 format, which avoids an extra lossy conversion.
- If you create your own GPU quantizations, note that the original AutoAWQ package has not shipped a release since May 2025, while GPTQModel and the vLLM project's llm-compressor are actively maintained.
Local LLM tools compared
Most tools are front ends or servers built on a few engines: llama.cpp for GGUF, MLX for Apple Silicon and vLLM for GPU servers. Status below reflects each project's releases as of October 2026.
| Tool | Best for | Formats and hardware | API | License and status |
|---|---|---|---|---|
| Ollama | Quickest path to a local model plus an API | GGUF on Windows, macOS, Linux and Docker; MLX engine on Apple Silicon (preview since March 2026) | Native REST on port 11434; OpenAI- and Anthropic-compatible endpoints | MIT; frequent releases (v0.40.x in October 2026) |
| LM Studio | Browsing and testing models in a GUI | GGUF via llama.cpp; MLX on Apple Silicon; Windows, macOS, Linux | OpenAI- and Anthropic-compatible server; lms CLI; headless llmster daemon | Free desktop app; paid plans add hosted features |
| llama.cpp | Maximum control on any hardware | GGUF from 1.5 to 8 bits; CUDA, HIP, Metal, Vulkan, SYCL and CPU | OpenAI-compatible server with built-in web UI | MIT; continuous builds |
| vLLM | Serving many concurrent users | Hugging Face weights, FP8, AWQ, GPTQ, GGUF; NVIDIA, AMD and Intel GPUs plus accelerator plugins | OpenAI-compatible and Anthropic Messages APIs | Apache 2.0; v0.31 (October 2026) |
| MLX / mlx-lm | Mac-native inference and fine-tuning | MLX format; Apple Silicon only | Python API and the mlx_lm.server HTTP server | MIT; mlx-lm v0.32 (October 2026) |
| Jan | Open-source ChatGPT-style desktop app | llama.cpp and MLX engines, plus optional cloud providers; Windows, macOS, Linux | OpenAI-compatible server on localhost:1337; MCP support | Apache 2.0; v0.8.6 (October 2026) |
| GPT4All | Simple offline chat with local documents | GGUF; Windows, macOS, Ubuntu x86-64 | Desktop app plus Python bindings | MIT; last desktop release v3.10.0 (February 2025), so check activity first |
| Open WebUI | Shared browser chat interface for a team | No engine of its own; connects to Ollama and any OpenAI-compatible server | Built-in RAG with hybrid search; user management | Open WebUI License (branding must stay on deployments over 50 users); v0.11 (September 2026) |
A sensible path: start with Ollama or LM Studio, add Open WebUI when several people need a chat interface and switch to vLLM when an application needs real concurrency.
Quick start with Ollama
1. Install. On macOS or Linux, run the script below. On Windows, use the installer from the Ollama website or run irm https://ollama.com/install.ps1 | iex in PowerShell. A Docker image, ollama/ollama, is also available.
curl -fsSL https://ollama.com/install.sh | sh
2. Pull a model sized for your machine. Gemma 4 E2B is about a 7 GB download and suits 8 GB machines; on a 24 GB GPU, try Qwen3.6 27B (17 GB).
ollama pull gemma4:e2b
ollama pull qwen3.6:27b
3. Chat in the terminal. Type /bye to exit. The --verbose flag prints generation speed after each reply.
ollama run gemma4:e2b --verbose
4. Confirm it runs on the GPU. Run ollama ps. The PROCESSOR column should read 100% GPU; a split such as 40%/60% CPU/GPU means part of the model spilled into system memory. The CONTEXT column shows the context length actually allocated.
5. Call the API. Ollama listens on port 11434.
curl http://localhost:11434/api/chat -d '{
"model": "gemma4:e2b",
"messages": [{"role": "user", "content": "Explain the KV cache in two sentences."}],
"stream": false
}'
6. Reuse OpenAI-style code. Point any OpenAI SDK at http://localhost:11434/v1 with a placeholder API key.
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "gemma4:e2b", "messages": [{"role": "user", "content": "Say hello"}]}'
7. Raise the context length. Ollama's docs list a 4,096-token default on machines with under 24 GB of VRAM, which silently truncates long documents. Set a server-wide value as below, or pass "options": {"num_ctx": 32768} per request.
OLLAMA_CONTEXT_LENGTH=32768 ollama serve
Ollama binds to 127.0.0.1 by default. If you set OLLAMA_HOST=0.0.0.0 to share it on your network, put it behind a firewall or an authenticating reverse proxy, because the local API has no login of its own.
Which open models fit your hardware
The table assumes roughly 4-bit quantization and 8K-32K tokens of context. Picks are open-weight releases available as of October 2026, mostly Apache 2.0; confirm the license on each model card and check that your runtime supports the architecture.
| Memory tier | Good fits | Notes |
|---|---|---|
| 8 GB GPU, or a laptop running on CPU | Gemma 4 E2B; Qwen3.5 4B; Qwen3.5 9B at 4-bit | Fine for chat, summaries and light code help; keep context modest |
| 16 GB GPU, or a 24 GB Mac | gpt-oss-20b; Gemma 4 E4B or 12B; Qwen3.5 9B at 8-bit | gpt-oss-20b has 21B parameters but only 3.6B active, and OpenAI designed it to run within 16 GB |
| 24 GB GPU (RTX 3090/4090 class) | Qwen3.6-27B or Qwen3.8-27B; Gemma 4 31B; Gemma 4 26B A4B | Qwen3.6-35B-A3B's 24 GB Ollama build slightly overflows, but MoE models tolerate partial CPU offload better than dense ones |
| 48 GB and up (two 24 GB cards or a workstation GPU) | 27-35B models at 8-bit; Llama 3.3 70B at 4-bit; gpt-oss-120b on an 80 GB+ card | Use vLLM if several people share the machine |
| Apple Silicon, 32-48 GB | Gemma 4 26B A4B; 27B dense models at 4-bit; Qwen3.6-35B-A3B on 48 GB | At its March 2026 launch, Ollama's MLX engine preview required more than 32 GB of unified memory |
| Apple Silicon, 64 GB | 27-35B models at 8-bit; Llama 3.3 70B at 4-bit | Leave room for macOS and your other apps |
| Apple Silicon, 96-128 GB | gpt-oss-120b; Qwen3.5-122B-A10B; Mistral Small 4 (119B, 6.5B active) | 96 GB runs gpt-oss-120b with modest contexts; 128 GB fits all three with room for longer ones |
Frontier-scale open models, such as the DeepSeek V4 family and Qwen3.8's 2.4-trillion-parameter flagship, need multi-GPU servers. Browse the model directory for specs and licenses.
Performance tips
- Keep the whole model on the GPU. Check
ollama psor your tool's logs. A smaller quant that fits fully usually beats a bigger one that spills. - Size the context to the job. Allocating 128K tokens when you need 8K wastes memory and can force CPU offload.
- Quantize the KV cache. In Ollama,
OLLAMA_KV_CACHE_TYPE=q8_0roughly halves KV memory with very little quality loss; it requires flash attention, which Ollama enables automatically on supported hardware. - Prefer MoE models for speed. Few active parameters mean fewer bytes read per token, which matters most on Macs and CPUs.
- Try multi-token prediction drafts. Gemma 4 and Qwen3.6 support speculative decoding variants in llama.cpp, LM Studio and Ollama; gains depend on model and hardware.
- Keep models loaded. Ollama unloads idle models after five minutes; set
OLLAMA_KEEP_ALIVEhigher to avoid reload delays. - Use a server built for concurrency. Ollama handles one request per model at a time unless you raise
OLLAMA_NUM_PARALLEL, which multiplies KV memory. vLLM's continuous batching and PagedAttention deliver far higher total throughput for many users.
Troubleshooting common problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Model fails to load or crashes with out-of-memory errors | Weights plus KV cache exceed available memory | Use a smaller quant or model, shorten the context, close other GPU apps, quantize the KV cache |
| Output crawls at 1-5 tokens per second | Part or all of the model is running on the CPU | Check ollama ps, update GPU drivers, confirm the CUDA, ROCm or Metal backend is detected |
| Replies ramble, repeat or contain odd tokens | Wrong chat template or a broken quantization | Use official model tags or reputable GGUF files, update the runtime, lower the temperature |
| The model ignores the start of a long document | Input exceeded the context length and was truncated | Raise the context setting and check the CONTEXT column |
| Another app or a Docker container cannot connect | Server bound to 127.0.0.1 only | Set OLLAMA_HOST deliberately; from containers use host.docker.internal |
| Mac slows to a crawl or swaps | Model exceeds the GPU share of unified memory | Pick a smaller model or quant and leave headroom for macOS |
Common mistakes
- Buying hardware first. Test the exact model on a rented GPU or hosted endpoint before spending thousands of dollars.
- Judging a model by a 2-bit or 3-bit file. Those squeeze huge models into small machines and lose noticeable quality.
- Forgetting the KV cache. A model that loads at 4K tokens can fail at 64K.
- Assuming local means private. Ollama and LM Studio also offer cloud-hosted models, so confirm a model actually runs on your machine before sending sensitive data.
- Downloading random re-uploads. Stick to the publisher or well-known quantizers, and check the license allows your use.
- I know my usable memory: VRAM, or about two-thirds to three-quarters of a Mac's unified memory.
- Weights at my chosen quant, plus 20 percent, plus the KV cache for my context, fit in that budget.
- I tested the model on 20-50 of my real prompts.
- The server is bound to localhost or protected by authentication.
- The model license allows my intended use.
Next steps
Estimate memory for a specific model, quant and context length with the VRAM calculator. If cost is your main motivation, compare hardware and hosting against per-token prices in the self-host vs API calculator. For the bigger picture on licenses and capability gaps, read open-source vs closed LLMs. If you are planning a private deployment for a team and want hands-on help, you can work with an LLM expert.
Sources
- Ollama documentation: context length
- Ollama FAQ: GPU use, KV cache quantization and network binding
- Ollama blog: Ollama is now powered by MLX on Apple Silicon (preview, March 2026)
- llama.cpp repository (ggml-org)
- GGUF file format specification (ggml)
- Efficient Memory Management for Large Language Model Serving with PagedAttention (Kwon et al., 2023)
- MLX LM repository (Apple ml-explore)
- LM Studio documentation
- Gemma 4 model card (Google, Hugging Face)
- Introducing gpt-oss (OpenAI, August 2025)
Written by the LLModel editorial team and checked against the sources above on October 10, 2026. Found an error? Send a correction.