r/LocalLLM • • 3d ago

Question Using local LLM to code with big contexts

For a while I have been trying to set up a coding solution that I would be using to code mostly python and java + kotlin. Man, have I been unsuccessful. I tried using aider with ollama and qwen 3.5 coder and even with 64k context setup I run into issues where qwen will start to spiral out of control.

For context (pun intended) my machine has 64gb ram and a 5080 16gb.

How do you guys deal with similar use cases?

Edit: I have installed Strata and pi with memory awareness add-on

3 Upvotes

26 comments sorted by

4

u/Slight-Living-8098 3d ago edited 3d ago

Well, first I would ditch Qwen 3.5 coder and go with an ISTA-DASLab's GSQ-RCO quant of either Qwen3.8 24b, Inkling-2-Mini 26b, or Qwen Flash Next. Ditch Ollama and use something like Llama.cpp, Strata, Ninfer, or Basalt for your inferencing host so you can better control how the models are loaded into your VRAM and system RAM.

Then you want to take your PRD, turn it into your spec documents, then break those spec documents into milestones, then create tickets for those milestones. After you have that, you simply work through the tickets one at a time, all the while practicing Test Driven Development and good CI/CD. You can save your GitHub credits on the CI/CD part if you use something like ACT locally, and turn off GitHub actions on your repo on GitHub.

That sounds like a lot, but there are agent skills out there that will help you do all of it. Matt Pocock's skills are a great starting point to work with until you get the way you like to work down and build your own workflows and skills.

https://huggingface.co/ISTA-DASLab

https://github.com/mattpocock/skills/

https://github.com/nektos/act

2

u/Colorless_Opal 2d ago

Thanks a lot this helped me quite a bit

2

u/Slight-Living-8098 2d ago

No problem. Have fun, and get that work done! 😁

2

u/Slight-Living-8098 3d ago

If you search through some of my comments here, you'll find the settings I use for Qwen3.8 27b and Inkling-2-Mini with max default context for Llama.cpp. You can use them as a starting point. I'm not going to repost them because some people in here just like to downvote shared settings instead of offering their own for comparison

8

u/aeqri 3d ago

How come your setup is so outdated? 3.5 coder is a model that's 9 months old, ollama is questionable, and I haven't seen anyone use Aider in a long time.

I'd suggest you look into running Qwen 3.8 Flash Next on something like strata (or a fork of it), with the Pi coding agent.

6

u/EvolvingDior 3d ago

I am more and more convinced that these are rage-bait posts designed to farm engagement. Otherwise the population on this planet is far more stupid than I imagined.

1

u/aeqri 3d ago

Maybe I'm a bit more charitable, but I think the vast majority have no clue where to start, so the obvious course of action is to ask AI. Those things know a lot of stuff, so surely they'd be knowledgeable here too, right?

And because things are moving pretty fast in this space, most of that information they get is outdated, or in some cases (looking at you, Claude) even misleading, in an attempt to sabotage those wanting to work with, or working with local models.

2

u/EvolvingDior 3d ago

OP knew enough to come here to ask a question but not enough to read a few days worth of conversations? C'mon...

It takes next to no effort to get up to speed on a reddit community before posting drivel like this.

3

u/lungben81 3d ago

Plus, 64k context is nothing. Local models support 262k now, even on modest hardware.

-1

u/IndependentCheap5064 2d ago

pushing 64k context on 16gb vram means heavy kv cache quantization or cpu offloading, both of which make the model loop regardless of how new the weights are

6

u/imshookboi 3d ago

You should use Strata or RustingStrata (https://github.com/RustingStudio/RustingStrata) and one of those supported models like flash next. qwen 3.5 coder is hella old.

1

u/my_name_isnt_clever 3d ago

Let me guess, you asked a cloud AI how to do local? I guess they're finally pushing the vintage Qwen 3.5 Coder instead of the ancient Qwen 2.5 it used to recommend. But this is still months out of date.

2

u/Colorless_Opal 3d ago edited 3d ago

Regrettably this is one of the things I did after trial and error, and searching here without finding much (that I could understand as a newbie)

2

u/my_name_isnt_clever 3d ago

That's totally fair honestly; it's hard to break into.

1

u/randomgenericbot 3d ago

I am sucessfully running Qwen3.8 27b gsq-rco IQ3_S from ISTA DASLab with Raymonds kv-streaming for of llama.cpp on a 5060 Ti 16GB, with 131k context in pi as harness.

Uses 12gb for the model, another 2gb for the kv-streaming window leaving 2gb for whatever you need (if you run your desktop on it).

My t/s are between 40 and 15 (depending on mtp hit rate, and how much context is used).

I tried aider and goose before, but as soon as I tried pi. I fell in love - but you need to sandbox your agent, and anything below the qwen3.8 family is too dumb to properly use it (bad and sometimes risky tool calls).

With pi as harness, I use my own compaction-extension (you may as well, available on github and I regularly tweak it: https://github.com/LePrau/pi-self-aware-memory ) which has proven quite powerful.
I run a pi session in tmux on my NAS, and connect every now and then, give it a proper task, give it access to local git clones of the repos it might need for research. Agent runs in a qemu based sandbox (gondolin) so it can not accidentally delete anything other than the project dir, it has the ability to commit (but not to push).

Most of the work done on the compaction extension is done with one large session that by now spans more than 20M input and 8M output tokens (all with the 131k context window, mind you). I do not care or watch how full my context is anymore.

The key usually is how the harness deals with context and compaction. 64k is the lower bound for proper work, I suggest getting 131k (achievable with the mentioned kvstream llama). You absolutely must ditch the default compaction methods that only write a summary text when context is filled - those take a lot of time and lose most of the needed detail, while keeping stuff that is irrelevant.

Any extension that collects summaries and facts mid-work are superior to that approach (like pi-observational-memory, pi-smart-compact or my own pi-self-aware-memory). they all target different use cases, mine was single-session with preventing eviction of kv-cache, and only running one single slot of a model.

hope that helps and grants some insights

1

u/Colorless_Opal 2d ago

Amazing, I do not use a Nas, but did install pi with the memory awareness extension and am experimenting with it

3

u/Ill_Locksmith_673 3d ago

Since you have a 5080 you can try basalt with something like qwen 3.8 27B or qwen flash next

3

u/RogerAI--fyi 3d ago

Before changing models, run ollama ps while aider is mid-session. Ollama's context-length doc says to read two columns. PROCESSOR is the GPU/CPU split. CONTEXT is what it actually allocated.

If CONTEXT says 4096 and not 64000, your setting never reached the server. If PROCESSOR shows a CPU share, 64k of context on a 16 GB card pushed part of the model into system RAM, and everything slows down. The same doc says coding tools want at least 64000, so the number is right, it just has to land.

Paste the ollama ps line and the model tag if you want more eyes on it.

1

u/dasmau89 3d ago

I hat the most success with a MoE model + strata. Speed is still an issue though, by default it will keep the full KV cache in VRAM and therefore only a couple of experts can stay in VRAM

1

u/ScuffedBalata 3d ago

Qwen 3.5 coder is old. Aider is ancient. 64kb context is tiny. What is this?

1

u/Totaloverdose29k 3d ago

Try "SiliconSpecies : Swift 1.5 Qwen3.8 27B Splash" on LM studio and set it up with VS code's Claude Code extension. This build is good for token efficiency and has built in mtp; if you don't want mtp then get the regular swift 1.5.

This has worked for me on M4 pro macbook pro 48gb ram. Works with full 256k context window at really good speeds. Whenever I run into big problems I use Gemini NEON (high) to figure it out.

1

u/Mobile_Living_3331 3d ago

Cant manage too much of it, currently using OpenCode with 64k context in Qwen 3.8 27B. i Use this model only for high reasoning. I think you first create a plan to use models as per the requirement of tasks. I also have Qwen 3.5 4B with Q8 which normal suggestion and task. Using Llama.cpp by the way.

1

u/Mecca__ 2d ago

Strata with qwen3.8 flash next gyro s, I run with 256k context

1

u/XHToken 1d ago

When it starts going in circles, what does /tokens show in Aider? I’d try the same small edit in a fresh chat with just the failing test and the file it exercises. You can use /drop to remove unrelated files. Does it still loop on that smaller example?

0

u/[deleted] 3d ago

[deleted] — view deleted comment

1

u/robertomorales_3935 2d ago

A context cap is a ceiling, not a quality target; if it spirals at 64K, more room may just preserve more irrelevant history.