Blog
how to make local llm smarterlocal llm optimizationollama context length

Tuning Your Local AI: Why Self-Hosted Models Feel Dumber Than They Are

Local LLMs feel dumb because of defaults, not weak models. Fix context length, quantization, chat templates, and sampling to close the gap with APIs.

Portrait of Luis Chavez-Mattos
Edited by Luis Chavez-Mattos, Director, Product··RSS

For Engineering and IT

Tiny figurines turn adjustment dials and tighten screws on a giant graphics card.

Why do self-hosted models feel dumber than they are?

A local LLM feels dumber than a hosted API almost always because of configuration, not capability. Out of the box, tools like Ollama can ship a small context window (Ollama's documentation lists a 4k default on machines with less than 24 GiB of VRAM), along with compressed quantization levels and generic sampling settings. Fix those three knobs and most 7B-70B open models close a meaningful chunk of the gap with rented APIs.

This matters right now because a lot of employees are quietly standing up local models to keep sensitive prompts off someone else's servers. About 38% of workers admit to pasting confidential data into AI tools without approval, according to a 2024 CybSafe and National Cybersecurity Alliance survey of 7,000 people. Running a model on your own box sidesteps that risk. But if the local model can't keep up, people quietly go back to the API anyway, and the privacy win evaporates.

TL;DR

  • Ollama's default 4k-token context window fills up quickly, so the model silently drops older instructions and seems to forget what you told it.
  • Aggressive Q4 quantization causes more than a 10% loss in instruction-following accuracy, while math reasoning stays largely intact.
  • A mismatched chat template quietly breaks instruction-following without throwing any runtime error.
  • Lowering temperature to 0.1-0.3 makes output more reliable for structured tasks like coding or data extraction.
  • Q5_K_M is a reasonable default when you need both speed and quality, and anything below Q5 is a real risk for strict instructions or non-English text.
  • None of these fixes need a bigger GPU or a different model, only a trip into settings most people never open.

Is your context window probably stuck at 2048 tokens?

This is the single most common cause of "the local model forgot what I just told it." According to Ollama's documentation, machines with less than 24 GiB of VRAM get a 4k default context length. A 2048-token window fills up after a few paragraphs of system prompt plus a couple of turns of conversation. Once it's full, the model silently drops the oldest tokens, so it starts contradicting itself or forgetting instructions you gave five messages ago. It isn't reasoning worse. It's reasoning over less information.

Ollama's own documentation now recommends at least 64,000 tokens for anything involving web search, agents, or coding tools. The fix is one environment variable or one CLI flag:

OLLAMA_CONTEXT_LENGTH=65536 ollama serve

Or set num_ctx per request if you're calling the API directly. The tradeoff is memory: according to Ollama's documentation, setting a larger context length increases the amount of memory required to run a model. If you're on a laptop GPU, you may need to pick between a longer context and a larger model. That's a real tradeoff, but it's a tradeoff you get to choose, instead of one baked into a default you never saw.

What is your quantization actually costing you?

Most people download whatever GGUF file appears first in a model card, often a Q4 variant, because it's smaller and faster. Quantization compresses model weights from 16-bit floats down to 4, 5, or 8 bits, and the accuracy cost is not uniform across tasks.

A benchmark study across Qwen2.5, DeepSeek, Mistral, and Llama 3.3 found that instruction-following and multilingual tasks degrade the fastest under aggressive quantization, with more than a 10% accuracy loss on IFEval at INT4 and GGUF Q4 levels, while math reasoning tasks like GSM8K stayed within about 84-87% of baseline accuracy even at Q4. In other words, a heavily quantized model might still add numbers correctly but start ignoring formatting instructions or losing track of multi-step directions, which is exactly the kind of "it feels dumber" complaint people report.

The same study found Q5_K_M and GPTQ-INT8 retained roughly 95-99% of full-precision accuracy across the board, making Q5_K_M a reasonable default when you need both speed and quality, and something below Q5 a real risk for anything involving strict instructions or non-English text.

Quantization quality retention by format (approximate, from benchmark study)

General rule from the data: as bit-width drops, degradation is not linear across task types. Instruction-following and multilingual reasoning drop off first; structured math and logic tasks hold up longer.

Figure 1
Approximate accuracy retention vs full precision (BF16), across benchmark tasks
Baseline accuracy retained (%)
98%GPTQ-INT896%Q5_K_M / Q8_080%Q4_K_M (avg)89%Q4_K_M on IFEval86%Q4_K_M on GSM8K
Quantization method and task
Approximate figures synthesized from a benchmark study of Qwen2.5, DeepSeek, Mistral, and Llama 3.3 across MMLU, GSM8K, BBH, C-Eval, and IFEval.
Illustrative figure. Constructed for explanation, not a measured source.

Is your chat template silently wrong?

Every instruction-tuned model was trained on a specific format for turning system prompts, user turns, and assistant turns into a single string of tokens. If the runtime you're using applies the wrong template, or an outdated one pulled from a registry, the model is technically reading a prompt that looks nothing like what it was trained on. Community reports on Hugging Face describe exactly this failure mode with Ollama's model registry serving mismatched templates for newer model families, where responses look plausible for simple one-turn chats but break down on anything more structured.

This is the quietest failure mode because it doesn't throw an error. The model just gets worse at following instructions, staying in character, or respecting a system prompt, and it's easy to blame the model's size instead of the plumbing. If you're running llama.cpp directly, use --chat-template explicitly rather than trusting auto-detection, and verify against the model card's official prompt format.

Why are sampling settings tuned for chat instead of work?

Default temperature and top-p settings in most local UIs are set around 0.7-0.8, values chosen to make casual conversation feel natural. For anything that needs a consistent, checkable answer, like extracting data from a document or writing code, a lower temperature (0.1-0.3) produces more deterministic output and fewer wandering tangents. This is the cheapest fix on this list. It costs nothing in memory or speed, and most people never touch it because the default just works well enough for chit-chat.

How do these fixes fit together?

None of these fixes require a bigger GPU or a different model. They require going into settings most people never open. If you're the person setting up local AI for your team, that's also the moment to think about ownership more broadly: a model that's tuned once and documented for everyone beats a dozen people each fumbling their own Ollama config. That's the same instinct behind Remy, treating the tools your team runs as something you configure and own rather than something you accept as-is.

Frequently Asked Questions

5 questions

Why does my local LLM forget context mid-conversation?

Your context window is almost certainly too small. Ollama's documentation lists a 4k default on machines with less than 24 GiB of VRAM, which fills up fast in a real back-and-forth.

Does a smaller quantized model always perform worse?

Not uniformly. Math and logic tasks hold up well even at Q4, but instruction-following and multilingual tasks can lose more than 10% accuracy at that level.

Is Q5 or Q8 worth the extra VRAM?

For most work use, yes. Q5_K_M and GPTQ-INT8 retain roughly 95-99% of full-precision accuracy in benchmark testing, a real gap over Q4 for anything beyond casual chat.

Why bother with a local model instead of an API at all?

Privacy and control. Close to 40% of employees admit to sharing confidential data with AI tools without company approval, and a local model keeps that data off third-party servers entirely.

What's the single fastest fix if I only do one thing?

Increase your context window. It's a one-line environment variable change and it fixes the most commonly reported symptom of a local model feeling dumb.

How we source, write, and correct our articles. Editorial standards

Related articles

Straight to your inbox.
New pieces as they publish. No noise.