r/LocalLLM • 2x XTX 7900 + 3060 • 26d ago

Discussion Solving a complex multi-task with 262k vs 128 context dropped performance from 91% to 57%... Then I made two changes. Solves with 128k went up to 94%.

I've been benchmarking local models as coding agents in opencode on real bugs in a real codebase, graded by hidden tests. The hardest tasks bundle 6–12 independent bugs into one request. At a 128k window, Qwen3.8-Flash-Next (IQ3_XXS, 2× 7900 XTX) kept "finishing" early with half the bugs untouched.

What was happening (from the recorded requests):

  • When the context fills up, opencode replaces the conversation with a model-written summary. The original request is gone.
  • The first summary lists every bug. Later summaries are summaries of summaries and only keep "completed" and "in progress", so bugs not started yet quietly drop out.
  • After the summary, opencode adds "Continue if you have next steps, or stop and ask for clarification". The agent reports what it did and stops. One run literally asked me to paste issues 3, 4, 5, 7, 8 and 9 again because it no longer had them.

Two fixes, as a small opencode plugin:

  1. Re-insert: after every compaction, put the original request back word for word.
  2. Checklist: tell the summarizer to start every summary with a checklist of every item in the original request, marked done / in progress / not started, and never drop one. Then have the agent sync its todo list to that checklist and check it before finishing.

Results (4 multi-bug tasks, 79 hidden checks, 128k window):

  ┌─────────────────────────────────────────────────────┬────────┐
  │                        Setup                        │ passed │
  ├─────────────────────────────────────────────────────┼────────┤
  │ Stock opencode                                      │ 57%    │
  ├─────────────────────────────────────────────────────┼────────┤
  │ Checklist only                                      │ 82%    │
  ├─────────────────────────────────────────────────────┼────────┤
  │ Re-insert only                                      │ 90%    │
  ├─────────────────────────────────────────────────────┼────────┤
  │ Both                                                │ 94%    │
  ├─────────────────────────────────────────────────────┼────────┤
  │ Same model, no fixes, 262k window (rarely compacts) │ 91%    │
  ├─────────────────────────────────────────────────────┼────────┤
  │ Claude Opus 5.5 (19 runs, same tasks)               │ 94%    │
  └─────────────────────────────────────────────────────┴────────┘

So at 128k the fixes undo effectively all the damage compaction does--and perhaps even help on top of that. On these long tasks, a quantized local model then matches Opus on sub-tests. (Opus still fully solves more of the tasks outright.)

Caveats:

  • One run per setup on the local side, and only 4 tasks. An earlier pilot showed the same direction.
  • Single-bug tasks didn't change; they rarely compact, so no difference between 128k and 262k on those tasks.

It seems painfully obvious and I'm kind of shocked no one else has done this.

There's an opencode issue about todos being cleared on compaction (#5934 (https://github.com/anomalyco/opencode/issues/5934)) and an open PR that carries todos over (#25982 (https://github.com/anomalyco/opencode/pull/25982)). Nothing I've seen re-inserts the original request, and in my runs that was the bigger win.

Had claude push it out there as a plugin for anyone that wanted to test it themselves:

Plugin: https://github.com/kylebakerio/opencode-compaction-anchor

I'm doing more tests, but these early results were so direct that I decided to share this right away.

fwiw, my output is shared at:

https://lab.kylebaker.io

I don't sell anything or care if people visit. I've just spent the last month+ non-stop running local benchmarks and building out and upgrading my local benchmarks and had built my own dashboard to manage and view it all, so eventually decided I may as well throw it out there.

Finally, I've not really put this out there before, but for anyone that wants to replicate what I'm doing--I don't share MY benchmark of bugs, but the harness and framework that would allow you to build your OWN benchmark from your OWN git history is here:

https://github.com/kylebakerio/LL-Dash

(drafted with claude because of time, then hand-edited.)

51 Upvotes

30 comments sorted by

5

u/Material-Database-24 26d ago

I have found similar things with other harnesses. The best workflow I have found for limited context Qwen3.8 27B or QFN is to 1) plan , 2) compact the plan into checklist/todo, and 3) keep and update that checklist/todo in context until all of them are done. It also seems to help them keep track of doing, when they are forced to stop between each todo. If let continue from one step to another without clear stop, there's quite high risk the models do not trust their previous steps have been actually done! With this method I have managed to pull significant refactors (>2000 lines) succesfully.

1

u/Scary-Difference630 20d ago

Why not just ask Opencode to create a todolist.md file with all the steps so even if there is compaction is still fulfills remaining steps in the todolist as it is outside. This is not opencode’s own todolist but a separate one.

If I am being honest, I never faced these issues with long tasks failing, maybe because of this skill.

Additionally you can ask model to add the original prompt in todolist so you don’t have to re-inject it 

1

u/fintip 2x XTX 7900 + 3060 19d ago

Access to a file isn't the same as having it in attention.

And to access that file it then needs to use context–to reason the tool call, execute it, read it.

You've made it worse, not better, but making it a separate file.

My initial experiment was to give it access to its own transcript. It never chose to look at it, so it didn't help.

1

u/Scary-Difference630 15d ago

Well, my experiences has been different so I disagree with your comment about keeping it in attention is better. i never had issues with keeping it in a file and yes reading means 1-2 extra tool calls but that’s not a problem as in a single workflow AI agents make 100s of tool calls.

I think if context becomes too large models performance degrades so I would prefer to keep important things in markdown files, compact context before it grows too much and continue with it. It’s cheap (I barely reach 5 hour limit), more efficient and in my opinion doesn’t affects output quality either way. 

There are pros and cons with every approach so you need to choose according to your needs

1

u/fintip 2x XTX 7900 + 3060 15d ago

I have actually tested it. The model only reasons about what's in a file if it reasons that it should open the file. And once it opens the file and reads it, it's the same (just slightly worse, more overhead) as if it was put in context anyways. Further, it sometimes will fail to convince itself to open the file.

Some things can be kept in markdown files (documentation to look up as needed, for example), but some things belong in primary context.

1

u/derbidrd 26d ago edited 26d ago

I disabled compaction entirely for my 120000k context. Now i use opencode dcp , today i will take a look at sleev it looks even more performant. Also tried mnemonic proxy but it was slowing down m'y flow and too hard to setup. EDIT : I spoke with the dev of mnemonic proxy and my result with his tool are probably user conf error or not enough ram avalaible.

2

u/Any_Flounder8768 26d ago

Author here, thanks for trying it and for saying why it didn't stick, that's useful. Both points are fair. Setup was too heavy: the README now starts with a one-minute demo (`uvx mnemonic-proxy demo`) and `mnemonic-proxy check` tells you what is missing. opencode is still on our "not tested" list, though, so there's no guide for it yet.

On the slowdown, it depends a lot on the engine. When the proxy hides old tool outputs, the prompt changes, so the engine can't reuse its cache for the part after the change and has to re-read it. Two things keep that cheap:

- It hides in batches, not every turn, so most requests still reuse the cached prefix (about 99% in my sessions).

- On engines that can save and restore their state (Strata, or llama-server with --slot-save-path), the proxy saves the state after a batch and restores it later instead of re-reading. Numbers from my 12 GB 4070 Ti with Strata: a 110K-token conversation comes back in 1.4 s instead of about 50 s re-reading it. In a 128K benchmark the median time to first token was 1.9 s through the proxy vs 61 s with the full history. On CPU with llama-server and a small model: 1.9 s vs 28.6 s for 8K tokens.

Without saved state (Ollama, LM Studio, llama-server without --slot-save-path), you pay that re-read after each batch, and with a big context on a slow engine that's exactly the "it got slow" feeling. With 120K and compaction off you may simply not need the proxy until sessions get longer than that.

Which engine were you on? And did it feel slow on the first token after a long tool output, or on every turn? I'd like to fix it.

1

u/derbidrd 26d ago

Hello, thank you for contacting me. I use strata v0.1.50 engine with qwen3.8-flash-next-gyro-gyro-m. RTX 4070 12g vram and 32g ram. Context size 131 072 tokens (quite too big for my ram but it works with dcp). Mnemonic was a nightmare to configure with opencode and strata. I used --slot-save-path in strata conf, had to create a session folder, etc, took me so much time to understand everything. Then my tok/s went down from 50 to 35 with mnemonic, response came slower after a prompt so I didn't keep it.

2

u/Any_Flounder8768 26d ago

Thanks, that's exactly the detail I needed, and it's close to my own setup (Strata 0.1.50 engine, Flash Next, 12 GB card), so I can reproduce most of it.

The setup pain is on me: saved state is optional, but the docs make it look required. You don't need --slot-save-path or a session folder for masking and recall to work, and the proxy should create that folder itself. I'll fix both.

The 50 → 35 tok/s drop shouldn't happen: the proxy only forwards the stream, and the prompt it sends is shorter. My best guess for your box is RAM: with Gyro-M on 32 GB the model barely fits, and each saved state at 128K writes about 2 GB to disk, which can push parts of the model out of RAM so Strata has to read them back from the SSD. Not verified, just a hypothesis.

If you ever want to check it in two minutes: set `slot_save`, `autosave`, `autorestore` and `mask_anchor` to `false` in the proxy config. If you're back at ~50 tok/s, it's the saved state. Both fixes are already in progress: I'm measuring decode speed with and without the proxy on Strata 0.1.50 today, and the "saved state is optional, the proxy creates the folder" ffix should be in a release today, tomorrow at the latest. I'll post the numbers and the release here.

If it's still slow after that, a last resort: a smaller Strata context, e.g. 65536. With the proxy you don't need the big window, since old tool outputs stay on disk and recallable (another user here runs Flash Next at 64K through it and reports it stays fast after 2.5M tokens). On 32 GB that leaves more RAM for the model. I haven't measured this on a 32 GB box, so treat it as something to try, not a promise.

1

u/derbidrd 26d ago

Thanks, I will PM you my strata config

1

u/Dathide 26d ago

You may be interested in tabbyapi, exl3 3bpw has higher accuracy than Q3

0

u/Adept_Diver2838 26d ago

What is your pc setup bro

3

u/fintip 2x XTX 7900 + 3060 26d ago edited 26d ago

5800x 64gb ddr4 ram @ 2933mhz 2x XTX 7900 (bifurcated 2x pciex8)

Not sure why it matters since this is about accuracy, not speed, though.

0

u/stianhoiland 26d ago edited 26d ago

The first time I ever had a compaction, I went and filed an issue saying "put my messages (and potentially the agent responses, too) verbatim into the new context—and change the compaction instruction to say that that will happen and thus that the compaction/summary should focus on summarizing the between-the-lines reasoning instead. The messages are negligible in size and hold my instructions losslessly."

It took me ONE compaction event to spot this. Minimum is a Always/Never/Ask setting.

2

u/fintip 2x XTX 7900 + 3060 26d ago

agreed.

I somehow assumed there had to be more to it, and I tend to assume the obvious and easy thing has already been tried and done.

I only now reached a point where I have enough data in my bench setup after a month, and have reached sufficient reliability in my bench setup, to test my own theories about what helps or doesn't help with what model in what harness, etc.

my first attempt: give the model access to its own transcript.

interesting result: that didn't work. It never looked it up and finished confidently.

testing injecting the prompt was the next approach.

then a control test for the checklist.

then both together.

if I didn't have this bench, I might have just stopped at giving it access to the transcript.

0

u/stianhoiland 26d ago edited 26d ago

Good stuff.

I realize my previous formulation already covers this, but I should spell it out: A compaction summary counts as an agent response, and thus should be included verbatim in the next compaction, and so on.

If there is a setting in addition to "Always/Never/Ask", which allows to specify to exclude agent responses, i.e. "User/Both", then I think the "User" option should still include compaction summaries. But better with something like "Include: User|Summaries|Agent"

10

u/[deleted] 26d ago

[removed] — view removed comment

4

u/fintip 2x XTX 7900 + 3060 26d ago

Surely it would, tbh.

The frustrating thing is opencode 1 has this, opencode 2 dropped it because "they found it doesn't help".

But the harness doesn't push the model to use it. Just poking it at compaction to make sure it's kept up to date made a huge difference.

Absurd.

2

u/superbiche 26d ago

Opencode, whether v1 or v2, is really a shitshow for compaction. I'd give away 99% of what it does for a correct compaction approach. It's not like they don't have PRs going in the right direction though - but the contribution governance on this project is dumb. I'm switching to Pi over time - not perfect but at least it's not "the wrong amount of opinionated and tweakable at the same time"

1

u/fintip 2x XTX 7900 + 3060 26d ago

When I tested pi, I found worse quality across the board. More tests pending, but the early pilot test was consistent, and I had other experiments to run.

Meanwhile, this issue is easily fixable (See plugin linked, or just follow my logic and do it yourself), and opencode still has done the best of any harness I've tested.

(I focused all my early runs on opencode 1 line for consistency, I am only now starting opencode 2 runs for comparison).

The other feature I've tried is letting the model know it has access to the entire current transcript to grep if needed; however, in my tests, the models never chose to use that feature so far. Re-adding the prompt and the to-do list poke were far more useful.

0

u/uniqueusername649 26d ago

Try oh-my-pi, their snap compaction renders most of the history into an image, which retains far more of the context. At least in my tests information survived compaction substantially better and Qwen 3.8 27b had no problem working through long sessions with multiple compaction cycles and got the task done.

1

u/fintip 2x XTX 7900 + 3060 26d ago

The name is so dumb that I never even glanced at it. I might give it a short pilot trial later.

0

u/uniqueusername649 26d ago

It is based on pi but more similar in features and system prompt heft to opencode. But feature-wise it goes beyond that with things like TTSR to inject commands when the LLM does something dumb.

Also whatever harness you use, make sure LSP is enabled for your project, it'll cut down on mistakes a lot.

0

u/wegster 26d ago

What specifically is LSP?

1

u/uniqueusername649 26d ago edited 26d ago

LSP is "language server protocol", basically how modern IDEs "understand" your code, know how to effectively do smart refactorings, know relations of classes etc. - what makes IDEs so much more powerful than a simple text editor with syntax highlighting. But AIs can use LSP too and that makes a refactoring task way simpler and more stable than it having to do so manually, trying to understand the code, doing the changes file by file, messing something up, discovering that in the tests etc.

A 30s refactoring task with LSP can quickly turn into a 10 minute AI session without it. It doesn't help with everything but it has virtually no disadvantages, so you should ensure its enabled in every one of your projects. You can ask the AI model to set it up for you, because it varies based on languages used.

1

u/wegster 26d ago

Huh - long time sw eng that shifted roles, worked at an AI/ML company for some time and lol - this is a new one on me. Will go check it out, thanks! Sounds like 'updated cscope' but will go take a look!

→ More replies

0

u/Superb_Raccoon 26d ago

You mean you weren't?

It was an obvious problem when it rolled out, but i already had a way and rule for that. It was only a problem when the harness couldn't tell the event happened, so didnt read it.

Required me to tell it to stop, check the kanban cards... which are my solution for a memoty.md. not a checklist, make the Kanaban cards before you code, close them out.