Local AI: Advanced

Why local models run at the speed they do, how to tune them, and how I serve one to my whole house from a server with no GPU.

For people comfortable with a terminal and DockerReal data measured on my home server

Last updated November 15, 2026. New to this? Start with the beginner guide.

Part 1 · How a model uses memory

Three things take up memory: the weights (the model itself), the KV cache (the context of your conversation), and a little overhead.

Weights

Size ≈ parameters × bits per weight ÷ 8. At 4-bit quantization (Q4) that is about 0.6 GB per billion parameters. My own files fit that closely: a 30B model came out at 18.6 GB, a 20B model at 12 GB, a 24B model at 14 GB.

KV cache

Every token of context needs memory too, and it grows with the context window. A bigger window is not free: if you raise it from 4,096 to 32,768 tokens you pay for it in memory (and speed).

Quantization formats

You'll see names like Q4_K_M or MXFP4. Roughly: fewer bits is smaller and faster but loses a little quality. Q4 is the usual sweet spot; go to Q5/Q6 only if you have spare memory and notice quality problems.

Part 1 · Speed is memory bandwidth

To write one token, the machine reads (nearly) all the weights that are active for it from memory. So there is a hard ceiling:

tokens/second  ≤  memory bandwidth  ÷  bytes read per token

Take my server: four channels of DDR4-2133 give a theoretical ≈ 68 GB/s (2133 MT/s × 8 bytes × 4 channels). A dense model whose weights are 18.6 GB could never beat about 3.7 tokens/s. This is why speed depends on memory more than on how many cores you have, and why GPUs (hundreds of GB/s) feel so fast.

Why Local AI Speed Depends on Memory Bandwidth Comparison of token generation throughput between a dense model and a mixture-of-experts model under identical memory bandwidth. Lane 1: Dense model (about 18.6 GB of weights) Every token reads ALL the weights Memory bandwidth about 68 GB/s Ceiling about 3.7 tokens/s Lane 2: Mixture-of-experts model (30B total, about 3B active, about 2 GB read per token) Each token reads only the active experts Memory bandwidth about 68 GB/s Ceiling about 30-35 tokens/s (measured 19.4) Note: Tokens per second is at most bandwidth divided by bytes read per token
Illustrative diagram: Generation speed depends on memory bandwidth and active weights read per token, giving MoE models higher throughput.

Part 1 · Why mixture-of-experts wins on CPU

In a mixture-of-experts (MoE) model, the file is big, but only a small group of “experts” works on each token. The name tells you how many: Qwen3-30B-A3B has 30B parameters in total but only about 3B active per token.

Apply the formula: ≈ 3B active at Q4 is about 2 GB read per token, so the ceiling on my memory is roughly 30–35 tokens/s. I measured 19.4, a believable fraction of that. A dense 30B model would crawl at under 4. So on a machine without a GPU, a big MoE model is the best trade: the knowledge of a large model at the speed of a small one.

The price is memory capacity: you still have to fit the whole file (18.6 GB here).

Part 1 · Tuning: threads, context, thinking

  • Threads: match your physical cores, not logical ones. More is not better (see above).
  • Context: use the smallest window you need. I tested at 4,096.
  • Thinking models: they spend tokens reasoning before they answer. With a limited token budget they can run out before finishing: in my tests Gemma 4 26B and Qwen3.6 35B didn't reach an answer on coding and logic questions within 900 tokens. On a slow CPU, prefer a non-reasoning “instruct” model, or raise the token limit and be patient.
  • Test with your tasks: a model that wins a benchmark may not win on yours.

Part 2 · Where to run it

OptionStrengthWatch out for
PC with a gaming GPUFastest per dollar; 8–24 GB of VRAM is plenty for most modelsModels that don't fit in VRAM slow down a lot
Apple Silicon MacLarge unified memory; quiet and efficientBandwidth varies by chip; RAM is not upgradeable
Mini PC or home server (CPU)Always on, silent-ish, cheap to run; lots of RAM is affordableBound by memory bandwidth, so choose MoE models
Used workstation or serverMany memory channels = surprisingly good bandwidthPower draw, noise and size

There is no single right answer. Pick by what you already have, and by whether you want it on only when you use it (a PC or Mac) or always available (a server).

Part 3 · My setup: a home server

I wanted a model available to every device at home, 24/7, without buying a GPU. This is how I did it, so you can copy the parts that fit.

Hardware

  • Xeon E5-2630 v4: 10 cores, AVX2 only
  • 128 GB of DDR4 ECC in four channels, 2133 MT/s (the ideal layout for bandwidth)
  • No GPU. Tests ran in Docker capped at 10 cores and 40 GB of RAM.

Tools

llama.cpp in Docker: llama-bench to measure and llama-server to serve. Models are .gguf files from Hugging Face.

Measure a model

bash
docker run --rm --cpus=10 --memory=40g \
  -v ~/models:/m --entrypoint /app/llama-bench \
  ghcr.io/ggml-org/llama.cpp:full \
  -m /m/MODEL.gguf -t 10 -p 256 -n 64 -r 2

In the output, pp is prompt processing speed and tg is token generation (the one you feel).

Serve a model

bash
docker run -d --name llm --cpus=10 --memory=40g \
  -p 127.0.0.1:8080:8080 -v ~/models:/m \
  --entrypoint /app/llama-server \
  ghcr.io/ggml-org/llama.cpp:full \
  -m /m/MODEL.gguf -t 10 -c 4096 --host 0.0.0.0

Check it's alive, then talk to it through the OpenAI-style endpoint:

bash
curl http://127.0.0.1:8080/health
curl http://127.0.0.1:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Hello!"}]}'

Results (generation speed, Q4, 10 threads)

ModelFile sizeGenerationPromptNotes
LFM2.5-24B-A2B14 GB24.1 tok/s65Fastest. Thinks a lot; own license, not Apache
Qwen3-30B-A3B-Instruct-250718.6 GB19.4 tok/s49No reasoning: direct, correct answers (code ran, riddle solved)
gpt-oss-20b (MXFP4)12 GB16.6 tok/s35Little reasoning, correct answers; Apache 2.0
Gemma 4 26B-A4B16.9 GB11.3 tok/s37Thinks a lot: didn't finish within 900 tokens
Qwen3.6-35B-A3B22 GB11.2 tok/s45Long reasoning (over a minute per answer)

My takeaway: on this machine, Qwen3-30B-A3B-Instruct gives the best mix of speed and quality for everyday use, gpt-oss-20b is the pick if you want a permissive license, and reaching ~30 tok/s with good quality just isn't possible without a GPU.

Part 3 · Serve it to your network

A model nobody can reach isn't much use. The easy way is a web interface like Open WebUI, in a container next to your model server. With Ollama on the same machine:

bash
docker run -d -p 3000:8080 \
  --add-host=host.docker.internal:host-gateway \
  -v open-webui:/app/backend/data \
  -e WEBUI_SECRET_KEY=CHANGE_ME \
  --name open-webui --restart always \
  ghcr.io/open-webui/open-webui:main

Generate a real secret with openssl rand -hex 32 and keep it. Open http://localhost:3000: the first account you create becomes the administrator, and sign-ups close after that.

If Open WebUI runs in Docker and Ollama on the host, Ollama has to listen beyond localhost (set OLLAMA_HOST=0.0.0.0).

Caveats

  • These numbers come from my machine, with short prompts and a 4,096 context in November 2026. Yours will differ; measure.
  • The model landscape moves every few months. Use this guide for the method (fit, bandwidth, MoE, measure), not as a fixed leaderboard.
  • Quality was judged on a handful of questions (code, a logic puzzle). It is a sanity check, not a scientific benchmark.