Local language models: what they can and cannot do
A model that runs on your own machine (Ollama, llama.cpp, GPT4All) keeps your texts at home, costs nothing per request and works without internet. In exchange it is smaller than the large cloud models, and a workflow has to be built with that in mind. This page lists the limits you will meet and what to do about them. The numbers are rules of thumb: models improve quickly, so test the model you really use (see the end of this page).
The aim is not to scare you off: a local model is the right tool for many tasks in this manual. It just needs a narrow task, enough context and a check of the result, see Context and prompts.
Size and capability​
The size of a model is counted in parameters (7B = seven billion). More parameters usually mean more knowledge, better instruction following and fewer slips, and also more memory and slower answers.
| Size (rough) | What it is usually good for | Where it fails |
|---|---|---|
| up to about 8B | Classification into a few classes, extracting a field, a short summary, rewording | Long or multi-step instructions, exact formats, reasoning across several facts, German grammar, building diagrams as an agent |
| about 14B to 30B | Drafting replies, summaries, extraction from messy text, a dependable agent for everyday diagrams | Hard reasoning and arithmetic, very long documents, rare facts |
| large cloud models | Long documents, subtle instructions, difficult reasoning | They are cloud models: privacy and cost |
A model that is good in a benchmark can still be poor at your task. Treat the table as a starting point.
Quantization: smaller files, a little less quality​
Models for your computer are usually shipped quantized: the numbers in them are stored with fewer bits (4 to 8 instead of 16) so that they fit into your memory. That makes them faster and smaller, with a loss of quality that is small at 6 to 8 bit, noticeable at 4 bit and larger below that. A 27B model in 5 to 8 bit needs roughly 20 to 30 GB of GPU or unified memory (see Which model for the agent?); the context window needs memory on top. If a model is too slow or does not fit, a smaller model at a higher bit depth is often better than a larger one pressed to 2 or 3 bit.
Context window​
The context window is how much text the model sees in one request. For a local model:
- Advertised is not usable. A model may support 128k tokens, but the server starts it with the window you configure, and
memory use grows with it. Cocosplate sends the configured size (32k by default) with every Ollama request, llama.cpp needs
--ctx-size; see Which model for the agent?. The window is shared with the answer and, with--parallel, with the other slots. - Quality drops in long contexts. Small models in particular lose track of facts in the middle of a long prompt (Lost in the Middle). A document of a few pages works; thirty pages need selection first.
- Rule of thumb for size: one token is about three quarters of an English word; German needs more tokens per word. A 32k window holds very roughly 20,000 English words, about 40 pages, including your instructions and the answer. For a small local model plan with a fraction of that.
- When it is too much: select the relevant part first, summarise in two steps, or split the work over a loop. See Context and prompts.
Instruction following and format​
Small models ignore parts of a prompt, add a chatty introduction ("Sure! Here is...") or write "Invoice." where you asked for
invoice. In a workflow this breaks the next node. What helps:
- One task per node. A short, narrow prompt beats a long one.
- Name the format and the exact words, and show one example, see few-shot prompting.
- Low temperature (0 to 0.3) for facts, classification and extraction.
- Match tolerantly with
matches '(?is).*word.*'in the decision, and always provide a default edgenext. - Validate what you can with plain rules after the model: a number in range, a known word, a length.
Languages​
Models are strongest in English. Mid-sized and larger models write good German; small ones make grammar and word-choice mistakes and sometimes answer in English. Say the language of the answer in the prompt, test with real German inputs, and let the model work in the language of the source instead of translating when the quality matters.
Knowledge, invented answers and no internet​
A model answers from what it learned until its training cutoff; it cannot look anything up unless you give it the text. Small models know less and fill the gaps with plausible but wrong statements, called hallucination. A local model never knows your prices, your orders or yesterday's news.
Therefore: do not rely on the model's memory, give it the facts and tell it what to answer when they are not enough, see Context and prompts. Ask it to quote the passage it used: invented answers have no passage. The example Answer from a Document is built this way.
Tool calling and the agent​
The agent sidebar needs a model that supports tool calling and a large enough context window. Weaker models loop, repeat a tool call, forget what they read or leave a diagram half finished. Use a mid-sized model or larger for the agent, give it small requests, and read the section "When something goes wrong" in Which model for the agent?.
Speed and hardware​
- A local model answers in tokens per second; a long prompt also takes time before the first token. On a CPU a mid-sized model can be slow; a GPU or a computer with unified memory is much faster.
- The first request after a pause loads the model into memory and can take a minute.
- Several runs at the same time share one model and wait for each other. Use the retry and timeout settings of the endpoint and the node, see the example Retry and Error Path.
- Switching between large models unloads and reloads them: pick one model per workflow.
Repeatable answers​
Temperature 0 makes answers mostly repeatable, not guaranteed: another model version, quantization or hardware can change an answer. Do not build a process that needs the identical wording; build one that needs the same decision.
Text from outside can give orders​
A mail or a web page may contain sentences like "ignore all previous instructions and ...". This is called prompt injection, and small models resist it less than large ones. Therefore:
- never let a model decide alone on something with consequences (paying, deleting, sending to many people): put a rule or a person behind it, for example an approval by e-mail;
- treat the answer as data: match it against a list of allowed words, do not use it as an address or a command;
- keep secrets out of prompts, see Secrets;
- read the OWASP Top 10 for LLM applications.
Which task for which model​
| Task | Small local model | Mid-sized local model | Large model |
|---|---|---|---|
| Classify into a few classes, sentiment | usually fine (the sentiment node needs no model) | fine | fine |
| Extract a field from a short text | usually fine, check the format | fine | fine |
| Summarise a short mail | acceptable | fine | fine |
| Draft a reply from given facts | needs review | good with the facts in the prompt | good |
| Answer from a document of several pages | risky | works for a few pages | best |
| Reason over many facts, do arithmetic | no | partly | better, still check |
| Build and repair diagrams (agent) | not recommended | recommended | fine, mind privacy |
| Decide on money, health or law | no | no | no, a person decides |
Find out what your model can do​
- Collect 20 real inputs, including the difficult ones. This is your small test set.
- Run the prompt for each in the AI workbench and note the failures.
- Change one thing (the prompt, the temperature, the model) and run the set again.
- Keep the test set. When a new model version or a bigger model is available, run it again before you switch.
Further reading​
- Large language model and hallucination (Wikipedia)
- Quantization of language models in practice (Hugging Face)
- llama.cpp server: context size, parallel slots, tool support
- Lost in the Middle: How Language Models Use Long Contexts
- Prompt injection and the OWASP Top 10 for LLM applications
- Context and prompts, Which model for the agent?, Generative AI privacy, Further reading