Local LLMs on a CPU: great at background jobs, painful at long context
Measured on a 16-core CPU with no GPU: a local model reached 98% of Claude Haiku's extraction accuracy and tied it on polishing, but a 16k-token input took 15 minutes to start. Plus a local model you can try right here: this site's in-browser search.
On this page
- In short
- Why I run local models at all
- The machine
- Short context: fast enough, and accurate
- Long context: where it falls apart
- Why the CPU and RAM go through the roof
- The fix is not more hardware: it is a queue
- Load the context once, then stream the jobs through
- Jobs that work well this way
- Local vs Claude Haiku: the benchmark
- Task A: turn messy messages into JSON
- Task C: polish rough blog drafts
- Smaller local models
- What the numbers say
- Downloads
- A local model you can try here: this site’s search
- When not to use a local model
- FAQ
- Can a local LLM run without a GPU?
- Why are local LLMs so slow with long context?
- Can an AI model run inside the browser?
- What are local models good for?
I have tested a lot of local AI models over the past months. On short inputs they are surprisingly good: accurate, fast enough, and free to run as often as you like. Give them a long document and the picture changes. The CPU pins at 100%, RAM climbs, and you wait minutes for the first word.
So I stopped asking whether local models are “ready” and started asking what they are ready for. The answer turned out to be background jobs: work that sits in a queue, has a deadline measured in hours rather than seconds, and never talks to a user directly.
This post has the measurements behind that, taken on a plain desktop machine with no GPU involved, plus the kind of jobs where local models have been worth it for me.
In short
- Accuracy on short inputs is close to Claude Haiku. Qwen3 30B-A3B got 98.0% of extraction fields right (Haiku 99.3%) and tied it on polishing drafts in blind judging (8.3 vs 8.0 out of 10).
- It is about 10 times slower: ~11 seconds a message on a 16-core CPU against ~1 second for Haiku.
- Long input is the real wall. With a 27B model, a 16k-token input took 15 minutes before the first word. When jobs share the same context, the cache helps: the first job waited 68 s, every later one under a second.
- Smaller models are not the shortcut. 1B to 2B models were only about twice as fast and got most messages partly wrong.
- Cost is cents either way at this scale. Local wins on predictability, not price.
- Best fits: background queues with hours of slack, and small focused jobs. This site’s search and its “Ask this article” feature are examples: small models running in your browser, shown at the end.
Why I run local models at all
Not to save money on API calls. Claude handles everything that faces real users, and that is not going to change. Local models are for two other reasons:
- Learning. You understand inference much better once you have watched your own CPU do it.
- Background work without a meter running. I helped a small team automate some of their background tasks with local models, so they can run them as often as they like without worrying about an API bill growing later.
The machine
Everything below ran on one desktop, CPU only:
- Intel Core i9-12900K: 16 cores, 24 threads
- 92 GB of DDR4 RAM
- LocalAI with the llama.cpp backend, 16 threads per model
- Quantized GGUF models (4-bit and 8-bit)
Short context: fast enough, and accurate
With about 1,000 tokens of input, Qwen3 4B (8-bit, a 4.3 GB file) read the prompt at 111 tokens per second, started answering after 9 seconds and found the detail it was asked about. For short jobs like rewriting a paragraph, tagging an item or pulling fields out of an email, that is perfectly usable.
Long context: where it falls apart
Before a model writes its first word, it has to process the entire input. This “prefill” step is pure computation, and on a CPU it is slow. Worse, the cost per token grows as the context grows, because every new token attends to all the tokens before it.
I measured it on a large dense model, Qwen3.8 27B (4-bit, a 16.5 GB file), with the same question asked after inputs of different lengths:
| Input | Wait before the first word | Reading speed | Writing speed | RAM |
|---|---|---|---|---|
| ~1,000 tokens | 57 s | 18.7 tokens/s | 2.4 tokens/s | 20.6 GB |
| ~4,000 tokens | 3.4 min | 19.1 tokens/s | 2.7 tokens/s | 21.2 GB |
| ~8,000 tokens | 7.2 min | 18.1 tokens/s | 1.9 tokens/s | 22.0 GB |
| ~16,000 tokens | 15.3 min | 17.1 tokens/s | 1.6 tokens/s | 23.1 GB |
The CPU reads input at a steady 17 to 19 tokens per second, so every 1,000 tokens of context costs about a minute before anything comes out. Writing also slows as the context grows, from 2.4 to 1.6 tokens per second, because every new word looks back over a bigger cache. A 16,000-token document is a quarter of an hour of waiting before the answer even starts. That is the lag I kept running into.
Why the CPU and RAM go through the roof
Two different things hit you on long inputs:
- CPU, during prefill. Processing the prompt is large matrix multiplication, which is exactly what CPUs are weakest at compared with GPUs. All 16 threads run flat out for the whole wait.
- RAM, for the KV cache. The model stores keys and values for every token it has seen (I wrote about how the KV cache works). For Qwen3 4B that is about 144 KiB per token, so a 32k context needs roughly 4.8 GB on top of the 4.3 GB of weights. That matches what I measured: the model process used 8.8 GB, with most of the cache reserved up front.
Writing the answer is limited by something else again: memory bandwidth. Every generated token reads all of the model’s weights from RAM. Qwen3 4B wrote at about 5 tokens per second, which is what you would expect when each token has to move several gigabytes through two channels of DDR4. More cores do not help much here; faster memory does.
The fix is not more hardware: it is a queue
A GPU would make all of this faster, but you don’t need one for a lot of useful work. What you need is to stop treating a local model like a chat window. If nobody is waiting on the answer, a two-minute prefill doesn’t matter.
The pattern I use:
- Requests go into a queue, not straight to the model.
- A worker feeds jobs to the local model one at a time, so a single machine never runs out of memory.
- A cheap check runs on every result: is the JSON valid, are the required fields there, is the length sensible. Failed jobs are retried or flagged.
- The frontier model only sees what it has to. When a job needs real reasoning or will be read by a customer, Claude gets the cleaned-up, already structured input.
Load the context once, then stream the jobs through
Most background jobs share a lot of their input: the same instructions, the same reference table, the same style guide. Only a small part changes per job. llama.cpp, which LocalAI uses underneath, can keep the KV cache of a previous request and reuse it when the next request starts with the same text. The first job pays for reading the shared context; the following jobs only read their own part.
To see whether that actually happens, I sent Qwen3 30B-A3B a shared context of about 5,700 tokens (instructions plus a 170-row stock table), followed by a different short question each time:
| Request | Wait before the answer starts |
|---|---|
| 1st request with the shared context (5,672 tokens) | 67.8 s |
| Requests 2 to 6, same context, new question | 0.6 s each |
| Control: each request starts with a unique line | 68 to 75 s every time |
| Same context after an unrelated request in between | 0.8 s |
| 10 questions in one request after the context | 3.7 s to start, 36 s in total |
The first request paid 68 seconds to read the context. Every request after it started answering in under a second, about 110x faster, because only the new question had to be processed. The control proves it is the cache: change one line at the top and every request pays the full minute again.
This worked out of the box with LocalAI 4.11 and its llama.cpp backend; I did not change any setting. Two rules make it work for you:
- Put the shared part first (instructions, reference data) and the per-job part last. Anything that changes at the top, like a timestamp or a job id, breaks the cache.
- Run jobs that share a context back to back. A short unrelated request in between did not hurt here, but a queue sorted by context keeps the cache warm.
Jobs that work well this way
These are the jobs I actually run on local models:
- Polishing blog drafts. Grammar, clarity and tone on a few paragraphs at a time. Short context, so it is fast and accurate.
- Getting data into shape for the frontier model. Cleaning, de-duplicating and structuring data behind the scenes, so when Claude is called it receives exactly the shape it needs and spends its tokens on the actual task.
- Daily reports on request. For the small team I helped, users request reports built from a set of data sources, and the promise is a reply within 48 hours. That deadline is the whole trick: local models have hours, not seconds.
Other jobs with the same shape: titles and summaries for posts, image alt text, tagging and routing items, removing personal data before anything is sent to a cloud API, and embeddings for search (small embedding models run very well on CPU).
Local vs Claude Haiku: the benchmark
In our own report jobs, the local model’s output felt about 80 to 90% as good as Claude Haiku’s, and prompt work closed part of the gap. To check that claim properly, I ran two tasks that match what I actually use local models for, on two models, with identical prompts:
- Claude Haiku 5.5 through the API, at low effort
- Qwen3 30B-A3B Instruct (4-bit, 18.6 GB), local on the CPU
Every request ran one at a time. For the local models I read the CPU’s own energy counter (Intel RAPL) before and after each run, so the energy is measured, not estimated, and priced at $0.10 per kWh (about ₹8.5). Claude’s cost comes from the token counts at Haiku 5.5’s $0.10 / $0.50 per million input / output tokens. Everything is downloadable at the end of this section.
Task A: turn messy messages into JSON
50 customer messages, each with an order buried in noise: different date formats, three currencies, decoy order numbers, unrelated ticket numbers and amounts. The models had to return nine fields as JSON. The messages were generated from known answers, so the scoring is exact.
A sample input:
hello
Tracking has not updated for a week.!! order no. ORD-84226, i bought 5 desk lamp paid EUR 1,249.75 on Jun 11, 2026. No rush at all. - Divya Bhatt
The expected answer:
{"customer_name": "Divya Bhatt", "order_id": "ORD-84226", "product": "desk lamp", "quantity": 5,
"amount": 1249.75, "currency": "EUR", "date": "2026-06-11", "category": "shipping", "urgency": "low"}
| Claude Haiku 5.5 | Qwen3 30B-A3B | |
|---|---|---|
| Valid JSON | 100.0% | 100.0% |
| Fields correct | 99.3% | 98.0% |
| All 9 fields right | 94.0% | 82.0% |
| Time per message (avg) | 1.07 s | 10.9 s |
| Time for all 50 | 0.9 min | 9.1 min |
| Tokens in / out | 17,520 / 5,054 | 12,800 / 4,664 |
| Cost for all 50 | $0.0043 (API) | $0.0020 (73 kJ) |
Field by field:
| Field | Claude Haiku 5.5 | Qwen3 30B-A3B |
|---|---|---|
customer_name |
100% | 100% |
order_id |
100% | 100% |
product |
100% | 100% |
quantity |
100% | 100% |
amount |
100% | 100% |
currency |
100% | 100% |
date |
100% | 100% |
category |
100% | 100% |
urgency |
94% | 82% |
A message where the models disagreed (a08):
From: Sneha Iyer
Re: IN-75733
Thanks in advance. My card was billed but the payment shows failed. Item: laptop stand, qty 10, total USD 2,499.50, ordered 1st February 2026. Old ticket #7494 is unrelated.
Correct answer:
{"customer_name": "Sneha Iyer", "order_id": "IN-75733", "product": "laptop stand", "quantity": 10, "amount": 2499.5, "currency": "USD", "date": "2026-02-01", "category": "billing", "urgency": "normal"}
Claude Haiku 5.5 (all fields right):
{"customer_name": "Sneha Iyer", "order_id": "IN-75733", "product": "laptop stand", "quantity": 10, "amount": 2499.50, "currency": "USD", "date": "2026-02-01", "category": "billing", "urgency": "normal"}
Qwen3 30B-A3B (at least one field wrong):
{
"customer_name": "Sneha Iyer",
"order_id": "IN-75733",
"product": "laptop stand",
"quantity": 10,
"amount": 2499.5,
"currency": "USD",
"date": "2026-02-01",
"category": "billing",
"urgency": "high"
}
Task C: polish rough blog drafts
10 rough paragraphs in the style I actually write first drafts in: missing articles, wrong tenses, run-on sentences. Each one contains facts that must survive untouched: numbers, units, commands and identifiers like n_dead_tup, -Xmx768m or db.r6g.4xlarge.
Two scores:
- Facts kept, strictly: every protected fact must appear exactly as written. “3x” turned into “three times” counts as changed, because the instruction said to keep numbers as written.
- Blind judge: Claude Opus 5.5 saw the original draft and the polished versions, labelled with letters in random order, and scored each from 1 to 10 for grammar, meaning and keeping facts. It never knew which model wrote which. One judging round covered all six models in this post, including the smaller ones below.
| Claude Haiku 5.5 | Qwen3 30B-A3B | |
|---|---|---|
| Judge score (avg of 10, out of 10) | 8.0 | 8.3 |
| Head to head: scored higher | 5 of 10 | 5 of 10 |
| Head to head: tied | 0 of 10 | 0 of 10 |
| Facts kept exactly | 92.9% | 90.0% |
| Time per paragraph (avg) | 1.38 s | 10.44 s |
| Tokens in / out | 2,203 / 1,280 | 1,537 / 899 |
| Cost for all 10 | $0.0009 (API) | $0.0004 (14 kJ) |
- Claude Haiku 5.5 changed:
3x,2 days,2 years,3 years,1400 - Qwen3 30B-A3B changed:
3x,2 days,2 years,EXPIRE,30 days,3 years,1400
The rough draft:
ClickHouse query was taking 9 seconds and reading 10 million rows even when we filter by user_id. reason is simple, user_id was not in the ORDER BY key, key was (site_id, event_time). we added a bloom_filter skip index with GRANULARITY 4 and now query read only 400 thousand rows and finish in 0.3 sec.
Claude Haiku 5.5 (judge: 8/10):
A ClickHouse query was taking 9 seconds and scanning 10 million rows even when filtering by user_id. The reason was simple: user_id was not in the ORDER BY key, which was (site_id, event_time). We added a bloom_filter skip index with GRANULARITY 4, and now the query reads only 400 thousand rows and finishes in 0.3 seconds.
Qwen3 30B-A3B (judge: 9/10):
The ClickHouse query was taking 9 seconds and reading 10 million rows, even when filtering by user_id. The reason was simple: user_id wasn’t part of the ORDER BY key, which was (site_id, event_time). We added a bloom_filter skip index with GRANULARITY 4, and now the query reads only 400 thousand rows and completes in 0.3 seconds.
Smaller local models
Can a smaller model do the same job faster? I ran the same 50 messages and 10 drafts through four smaller models from LocalAI’s model gallery, with the same prompts (Qwen3 1.7B is a “thinking” model, so it got Qwen’s documented /no_think switch):
| Model | Size | Fields right | All 9 right | Polishing (judge /10) | Facts kept | Time per message | Energy, 50 messages |
|---|---|---|---|---|---|---|---|
| Claude Haiku 5.5 (reference) | API | 99.3% | 94.0% | 8.0 | 92.9% | 1.07 s | – |
| Qwen3 30B-A3B | 18.6 GB, 4-bit, MoE | 98.0% | 82.0% | 8.3 | 90.0% | 10.9 s | 73 kJ |
| Qwen3 4B Instruct | 4.3 GB, 8-bit | 93.8% | 54.0% | 7.1 | 85.7% | 18.04 s | n/a |
| Qwen3 1.7B | 1.3 GB, 4-bit | 81.8% | 6.0% | 6.6 | 92.9% | 5.73 s | 37 kJ |
| Gemma 3 1B | 0.8 GB, 4-bit | 84.9% | 18.0% | 5.0 | 87.1% | 5.01 s | 35 kJ |
| Llama 3.2 1B | 1.3 GB, 8-bit* | 0% as returned, 82.4% repaired | 0%, 16.0% repaired | 3.5 | 84.3% | 5.19 s | 33 kJ |
- Speed gains are small. The 1B to 2B models take about 5 seconds a message, only twice as fast as Qwen3 30B-A3B. A mixture-of-experts model that reads ~3B parameters per token is hard to beat on a CPU.
- Accuracy drops fast. Qwen3 1.7B truncated amounts (
1249instead of1249.75) and leftRsas the currency instead ofINR. Gemma 3 1B guessed most categories wrong. Only 6 to 18% of their messages had every field right. - Llama 3.2 1B returned no valid JSON at all: every answer was missing its closing
}. Add one character and it gets 82% of fields right, but a real pipeline would have needed a repair step to notice. *A caveat on this one: LocalAI’s gallery entry namedllama-3.2-1b-instruct:q4_k_mactually loads the 8-bit file and wraps prompts in its own chat template, so part of this result is packaging, not the model. - Qwen3 4B sits in between on accuracy and was the slowest here, because this copy is 8-bit (4.3 GB). A 4-bit file would roughly halve its time per message. (Its energy for the extraction run is missing: the CPU’s energy counter wrapped around during the run.)
What the numbers say
-
Extraction: Qwen3 got 98.0% of fields right against Haiku’s 99.3%. Counting only messages with all nine fields right, it reached 87% of Haiku (82% vs 94%). Every one of its misses was
urgency, the one field that needs judgement rather than copying. -
Polishing: a tie. In blind judging Qwen3 averaged 8.3 and Haiku 8.0 out of 10, and each scored higher on 5 of the 10 paragraphs. Both sometimes rewrote “3x” as “three times” despite being told not to.
-
Speed: Haiku was about 10 times faster per item. For a 48-hour report that doesn’t matter; for a live chat it decides everything.
-
Cost: at this scale, cents either way. The local run cost about as much in electricity as Haiku cost in tokens. Local wins on predictability (no bill that grows with usage), not on price.
-
Smaller models are not the shortcut: the 1B to 2B models above are only about twice as fast as Qwen3 30B-A3B, but get most messages partly wrong.
So the 80 to 90% from our own report jobs holds up: close to Haiku on extraction, level with it on polishing.
Downloads
All inputs, prompts and raw outputs, so you can check or repeat this:
- Task A inputs and correct answers (50 messages)
- Task C drafts and protected facts (10 paragraphs)
- Raw outputs: A · Claude Haiku 5.5, A · Qwen3 30B-A3B, A · Qwen3 4B Instruct, A · Qwen3 1.7B, A · Gemma 3 1B, A · Llama 3.2 1B, C · Claude Haiku 5.5, C · Qwen3 30B-A3B, C · Qwen3 4B Instruct, C · Qwen3 1.7B, C · Gemma 3 1B, C · Llama 3.2 1B
- Scores, judge verdicts
- The runner script with the exact prompts
A local model you can try here: this site’s search
Press / anywhere on this site and type a question. Everything that follows runs in your browser: the question is never sent to a server. It is a good example of the pattern above, because it splits the work between two small local models, each doing the one thing it is good at.
1. Finding the paragraphs: an embedding model, not a chat model. When the site is built, every published post is split into paragraphs of up to 140 words, and each one is turned into 384 numbers by all-MiniLM-L6-v2, a 23 MB model (8-bit). Your browser downloads that model once, a few seconds after the page loads, and runs it with Transformers.js on WebAssembly. When you type a question, the same model turns it into 384 numbers and the closest paragraphs win, with a small bonus when your important words appear in a paragraph.
Measured in headless Chrome on the current index (4 posts, 58 paragraphs, a 70 KB index file):
| What | Measured |
|---|---|
| First load (model + runtime, once, then cached) | about 30 MB, 1.8 s on a fast connection |
| Each question after that | 9 to 49 ms |
| Server calls per question | none |
Real results for three questions (similarity score in brackets; 1.0 would be identical meaning):
| Question | Top paragraph found |
|---|---|
| how does clickhouse decide which rows to read? | Why does my query read more rows than it returns? (0.69), then Granules: the unit ClickHouse reads (0.65) |
| how do I move data between shards without downtime? | The problem: ClickHouse scales, but it doesn’t rebalance (0.66) |
| what jobs are local models good for? | nothing close: best score 0.14, because this post was not published yet when I measured |
The last row matters as much as the first two: a low score is an honest “I don’t have this”. A chat model asked the same question without the paragraphs would happily make something up. So the search drops anything below 0.30: off-topic questions (“where is tajmahal?”) scored 0.05 to 0.23, while questions the posts answer scored 0.39 to 0.89. Below the cut-off you get “nothing matches”, and no AI is asked at all.
2. Writing the summary: Chrome’s built-in model. Recent desktop Chrome ships Gemini Nano, a small LLM that runs on your device through the Prompt API. If your Chrome has it, the search box shows an AI assisted summary above the paragraphs: press Enter, or stop typing for two seconds, and it streams in word by word. Type again and it stops. The model gets only the matched paragraphs and is told to answer in 1 to 4 sentences, using nothing else; when they don’t answer the question directly, it summarises what they say that comes closest. If it starts repeating itself, the page cuts it off.
3. Asking one article: the whole article as context. On any post, press / (or use the “✦ Ask this article” link under the title): the toggle in the search box starts on This article, and Site switches back to searching every post. Now there is no retrieval step: Gemini Nano gets the entire article, headings, tables and figure captions included, and answers from that alone. Follow-up questions work too, because the previous question and answer go along with the new one.
Reading a whole article is the slow part for a small model, so the page uses the same trick as the shared-context cache above. The article is handed to the model the moment you open the search box, so it reads while you type. When you press Enter or pause, your question runs on a copy of that session, so the article is never read twice, however many questions you ask. Most posts here are a few thousand tokens (this one is roughly 6,000), which fits in the model’s context window. If an article is longer than the window Chrome reports, the page sends only the sections that best match your question and says so under the answer.
Requirements are the catch, and they are the same lesson as the rest of this post. Chrome only installs Gemini Nano with about 22 GB of free disk and either a GPU with more than 4 GB of memory or 16 GB of RAM and 4+ CPU cores. On a machine with only a few GB of disk free, chrome://on-device-internals shows “Enough disk space to install: false”, and the summary box explains how to turn it on instead. The paragraph search works in every modern browser either way.
Want to go deeper? Gemini Nano in Chrome: a practical guide to in-browser AI covers Chrome’s built-in AI in detail: every API and its status, what a visitor’s machine needs, how the model gets downloaded and installed, the Prompt API features (streaming, clone(), structured output), and the lessons we learned shipping it on this site.
Why this split works:
- The embedding model does retrieval, a task small models are excellent at: 23 MB, milliseconds per question, no hallucination possible because it only ranks real paragraphs.
- The LLM only rephrases what was found, a short-context task. That is exactly where the measurements above show small local models doing well, and it avoids the long-context wall entirely.
- When the LLM does need a long context (a whole article), it reads it once, ahead of time, and every question reuses that work. Same lesson as the background jobs: pay for the long input once, not on every request.
When not to use a local model
- Anything a user is waiting for
- Long documents that must be understood as a whole, not in chunks
- Tasks where a wrong answer is expensive and hard to check automatically
- When you would need a GPU you don’t have to make it fast enough
FAQ
Can a local LLM run without a GPU?
Yes. With 4-bit or 8-bit quantized models, a modern desktop CPU runs small and medium models at usable speed for short inputs. Long inputs are where CPUs struggle.
Why are local LLMs so slow with long context?
The model must process the whole input before answering, the work per token grows with context length, and the KV cache grows with every token. On a CPU all three hurt at once.
Can an AI model run inside the browser?
Yes. Small models run in the browser with WebAssembly or WebGPU (for example through Transformers.js), and desktop Chrome includes Gemini Nano through its Prompt API. This site’s search uses both: an embedding model to find paragraphs and, when available, Gemini Nano to summarise them, with nothing sent to a server. For the full picture of in-browser AI, see Gemini Nano in Chrome: a practical guide to in-browser AI.
What are local models good for?
Background and queue-based jobs: polishing text, extracting and structuring data, tagging, summarizing in chunks, and scheduled reports with a deadline of hours instead of seconds.