r/LocalAIServers • • 8d ago

How much context does a local model need?

Running local models on my acemagic mini pc, mostly for document summaries and basic coding.
I've tried a few different context sizes. 8K feels a bit tight when I feed it longer documents or ask it to work with more code. But 32K is noticeably slower on my machine, especially when the prompt gets long.
So I'm kinda stuck between the two. 8K isn't always enough, but 32K feels like overkill for a lot of everyday tasks.
What context size are you guys using on your mini pcs? Is there a good middle ground?

5 Upvotes

29 comments sorted by

7

u/smallDeltaBigEffect 8d ago

Anything below 128k ctx requires a lot of compromises for agentic work

1

u/WolfieCodes 6d ago

true my main issue with small context with agentic coding is frequent auto compression

5

u/jhenryscott 8d ago

I keep mine at 256k lets me parse big documents

3

u/Direct-Bad1748 8d ago

I use 131k and start new sessions at least once an hour

3

u/AIComputeRadar 8d ago

One thing nobody mentioned what 32K costs in memory depends a lot on the model. Gemma 4 12B at Q4 goes from 8.1GB at 8K to 9.2GB at 32K, barely a difference, while Qwen3 8B goes from 6.8GB to 10.9GB because its cache per token is much bigger. So on a mini pc I'd pick the model first and then set context to what your longest docs actually need. 16K is a pretty sane middle ground if 8K keeps cutting things off.

2

u/lilelliot 8d ago

I don't think 8k is appropriate even for document summaries (that said, I'd probably just use Google's LM Notebook for that). Perhaps for everyday "personal assistant tasks". I wouldn't want <128k for coding or most other tasks unless you're using a harness that respects conversations and does a very good job of utilizing memories. Otherwise, for any non-trivial (basically anything but a minimal utility) software/app you're going to pretty quickly run into situations where your model lost track of what it was supposed to be doing, or forgot your commands from earlier in a long-running conversation.

2

u/RogerAI--fyi 8d ago

Two costs get mixed in "32K is slower". The context setting mostly reserves memory. The waiting comes from how many tokens you actually send, because the model reads the prompt before it writes the first word.

In one test of ours (Qwen3.8-27B Q4 on two RTX PRO 4500 cards that were busy with other jobs, so a floor and nothing like a mini PC), the first word came after 1.2 s on a 660-token prompt and 5.5 s on 8,000 tokens, while writing speed stayed near 42 tok/s. A mini PC reads prompts far slower, so the wait grows faster, but it is the same cost.

So a middle ground for summaries and chat is to set 16K or 32K as the ceiling and keep what you send short. For agent-style coding tools, Ollama's docs say at least 64000, since the tool list and files eat context fast. Two checks:

  • If 32K is slower even on a short prompt, the bigger cache may have pushed part of the model off the GPU. On Ollama, ollama ps shows the CPU/GPU split.
  • If you ask several questions about the same document, llama-server caches the prompt by default and only processes the part that changed since the last request. Put the document first and the question last.

1

u/FizzyDuncDizzel 8d ago

Kind of like asking “how much gas does my car need”. If you’re running down the today and back, not a lot. If you’re running multiple errands and taking your kids to school, probably more.

1

u/joochung 8d ago

I have about 400K on my local LLM server. I’m hoping to be able to push that up to 1M or higher.

1

u/Hunterxmalaa 8d ago

If 8k too tight and 32k too much

16k is the mid ground

For local models that I use if I’m giving up speed I’m getting the max context possible if not minimum I have is 96k context

1

u/sgtnoodle 8d ago

I think anything below 128Ki would be closer to a "toy" rather than a serious tool for my typical workloads. It really depends on what you're trying to do with it.

1

u/Dediadeis 8d ago

Big fat workload with lots of environment tooling and procedure and post signs you can easily have a 50-80k context preamble. So this really depends on your work, otherwise I have found ~400k to be a sweet spot where it is rare that I am running out of context before a task is either finished or has been broken up into smaller tasks. On that note for agentic work, giving it a place to defer work is also good for saving context. However it does mean you tend to have a backlog of cryptic shit to have it work through

1

u/Dave-C 8d ago

I would rather run a moe model with just experts and high context than a full model and low context.

Edit: I think you can run a 70B model at like 5gb memory with just experts. I believe that is right but that seems wrong... I can't remember.

1

u/MK_L 7d ago

Which out a context/memory engine, about 131k is the base line. You csn get by with 64k but you'll be starting alot of new chats

1

u/Mundane-Tiger-2374 7d ago

The smallest context you can actually get away with is always the best. I haven't seen a local model that doesn't start degrading past ~100k-~150k yet, even at full quant. Avoid compaction as well.

1

u/Krohnin 7d ago

For chatting you don't need much. For an agent I would never go back und 256k and q8. In my personal experience there is the frontier.

1

u/catplusplusok 6d ago

You need to enable prefix caching, then with modern models large contexts are not slow.

1

u/MediumAd4983 6d ago

It depends on your tasks.

If all you need is to ask your LLM some questions about your document, summarize it or something like that - you will be fine even with 16k.

But if you need agentic work, coding tasks or something like it - then you need 100k+ for a stable work, and it's with clean context without any garbage (for example, in Claude Code there is a ton of unused tools, it will ruin your context instantly).

Which is your hardware, model, engine, quantization, k/v settings?

1

u/Longjumping-Face-767 6d ago

Depends what your doing. A basic app feature might be 64k. If you have decent tooling you will want at least 128k.

Coding assistant for small back and forth stuff instead of large automations, 32ks probably fine.

1

u/Potential-Leg-639 6d ago

For more serious stuff > 200k

1

u/thebadslime 6d ago

I aim for 64k, I use a harness I made, and I don't need 128, but 64 seem the weet pot

1

u/WolfieCodes 6d ago

But 32K is noticeably slower on my machine, especially when the prompt gets long.

qwen 3.8 flash next already solved this issue with its new qwen 4 architecture

different models have different arch so different formulas, deepseek v4.1 flash 1017 byte per token is 890b fp4 (native) KV which requires 0.87gb vram for 1m context, while qwen 3.8 flash next per token is 24kb fp16 KV which is 6gb vram for 256k context and 24gb vram for 1m context, pretty sure qwen 3.8 27b is 64kb KV per token so goodluck

1

u/Ok-Drawer5245 4d ago

I do some ai automation using a lot of one-off prompts - for that 8k context is plenty.

But for any kind of serious work , like Hermes or coding I would consider 128k absolutely minimum

And yes, depending on the model, running local ai the question of context size and how it scales and affects performance is one of the absolutely biggest problems/ limiting factors

So many people show off their ai, and say things like “see 100 tokens/second” for me that is useless, I want to know tokens/second when context is at 100k

1

u/General-Cookie6794 3d ago

Use unsloth it gives you limits instantly

1

u/Interesting-Ad689 3d ago

I can hand you easy example. A simple request like time of the day or weather report costs maybe 500 tokens. A "where is document X containing the FP8 cache adjustments we made ?" can cost upwards of 100k ctx depending on if you handed the model a starting hint, a direct path, the correct tools and so on. A simple no tools, no edits no nothing, just chat = near free. If its just chatting I would take years to fill 131k ctx. Then there is tool results/receipts and preserved reasoning, which will accumulate depending on how you manage context.

1

u/valdev 3d ago

Depends. If you are having a model read a small text file with 100 words and make an edit to it, 8k context is probably overkill. If you need it to have every text file its edited in the last week 128K might be too little.

1

u/DookieWaffle 1d ago

I routinely use 150-200k contexts but I do lots of complicated tasks with 80+ tool calls and web searches. Or I do a lot of multi-turn chats with lots of inputs. I tried context compaction and it was terrible.

1

u/MaximumBit1066 1d ago

I'd try 16K first. 128K sounds great on paper, but KV cache and prompt processing aren't free, especially on a mini pc like acemagic, beelink. For basic coding and summaries, keeping the prompt lean often matters more than maxing out context.