Notes on gotchas while migrating 35kb preprompts from Opus to self-hosted Ollama (patrickmccanna.net)
140 points by 0o_MrPatrick_o0 17 days ago | 76 comments



DiabloD3 17 days ago | flag as AI [–]

The article doesn't really describe the problem: if your prompt is 35kb, your prompt is confusing, unfocused, and doesn't work right on any LLM, and is needlessly bloating your context.

At this point in time, due to how most people and companies run their inference engine, regardless of the model (yes, this includes the newest from OpenAI and Anthropic and the Chinese Tigers and Dragons), you run out of useful context that the model can accurately attend to around the 250k mark no matter how much they advertise their context size is.

You need to cut your prompt up. If you believe LLMs work, have the LLM help you shape the overall plan, and then have multiple sessions run each step in the plan without being bloated with the context of previous successful steps.

I don't see LLMs being production-ready until the context rot and sampling problem is fixed forever. This has not occurred, and the big inference providers aren't even bothering to integrate any of the research on that subject.

If anything, many of the bigger companies are actively making inference quality worse just to extend their runway a tiny bit farther before they go bankrupt.

The only thing the article gets right is this: if you're serious about LLMs, abandon Big AI and infer locally only. This is the only way you have control over the quality of the output.


> your prompt is confusing, unfocused, and doesn't work right on any LLM

You are assuming the entirety of the prompt is human prose, but it could be sets of data so the agent doesn't have to collect it every time, like program interfaces, commands, views, databases, tables, data models etc...

I could see this scale to multiple kiltobytes of metadata in the prompt easily.

noel46 17 days ago | flag as AI [–]

RAG didn't die, it turned into grep. Agents just search files now, no vectors. But a static schema dump is basically a header file for the model. 30kb of table definitions is fine when the prefix is cached. Self-hosted without prefix caching is where it hurts.
DiabloD3 17 days ago | flag as AI [–]

That usually ends up being a poor use of LLMs, and is an unsolved problem with LLMs.

RAG was supposed to be the way out on that, and ended up being mostly abandoned.

andai 17 days ago | flag as AI [–]

The Claude Code system prompt was >50KB, though I think they trimmed it down heavily recently. (The newer models don't need as much hand-holding.)

Yeah, strong evidence for what parent says is correct. Been my experience as well, especially with local (smaller) models but also SOTA. The less instructions you have, the better they get at following them. Conflicting instructions is like poison, and it's harder to find those conflicting parts the longer the prompt is too.

> you run out of useful context that the model can accurately attend to around the 250k mark no matter how much they advertise their context size is.

This was certainly true when I first tried the new models with a 1M context. After 200k things got weird pretty fast. I haven’t had that problem since Opus 4.8. I’m regularly bumping against 800k tokens in “lazy” adhoc sessions. “Lazy” in that I ought to do as you suggest, in the way that I ought to refactor this code, I ought to factor out the meat of this session, but in the moment it’s still producing useful output! Tool harness is a force multiplier too: tools that put all tool use in subagents are incredibly frugal with the main chat session.


> "until the context rot and sampling problem is fixed forever"

I agree, prompt adherence seems to get worse when operating on large inputs. Does anyone have some notion of the SOTA with this? Can we expect big improvements by this time next year? (hopefully in open weights)

DiabloD3 17 days ago | flag as AI [–]

A lot of this is managed by the inference engine, and has nothing to do with the model.

Models that use, for example, sparse attention mechanisms are just trying to make the bad situation slightly less bad, such as using less RAM for context (thus requiring less context quantization) or using less bandwidth (thus running faster).

If people keep using temp, top-k, top-p, and min-p, and nothing else for samplers, we're ignoring ~3 years of sampling research that virtually eliminates the worst of context rot issues.


Attention is all you need.

And there's only so much attention to go around.


The "dumb zone" threshold is fuzzy but comes waay before 250k tokens. Like half that.
omar714 17 days ago | flag as AI [–]

35kb is maybe 9k tokens, under 4% of the 250k you're worried about, so I don't think context rot is what's biting here.

My bet is Ollama's default num_ctx silently truncating the prompt. That looks exactly like "the model got dumber" after migrating.

cube00 17 days ago | flag as AI [–]

Friends Don't Let Friends Use Ollama https://news.ycombinator.com/item?id=47788385
homarp 17 days ago | flag as AI [–]

and tell your friends about https://llama.app/ by Nvidia

Things are different now on a Mac. Many small improvements make Ollama genuinely decent for many models now.

The fact that those issues existed for so long while the entire time where not issues with other inference runtimes is more the point. And I think are indicative of future incompetence.
fl0id 17 days ago | flag as AI [–]

just use unsloth or jan.ai or...
andai 17 days ago | flag as AI [–]

> Everyone who begins learning exploitation hits a phase of exploitability grief about 3 month into dedicated, practiced study. They hack something they didn’t think they had the skill to break into and it terrifies them. They’re smart enough to know that, relatively speaking, they are an idiot, and if an idiot can do this then nothing is safe. That feeling is correct.

20 years later… I don’t get joy from hacking things. But the 20 year wisdom is a lot of the time it doesn’t matter if it is safe. Just know when it does matter and worry about that :)
SyneRyder 17 days ago | flag as AI [–]

TLDR: Local models have a smaller context window, so your 35kB prompts that worked fine against a hosted 1 Million token window, crash out when you only have a 65K (!) token window locally.

I dislike being negative, but I was really hoping for more substance when reading this. It would have been an interesting topic.


Thanks for the feedback. I wanted to get into more detail, but I spent the whole weekend working these problems and then constructing this post.

Dario’s behavior this weekend made me feel like this just needed to get out quick. In the future, I’ll be sharing more details about some other things in the process and some ways I found to use automation to accelerate splitting prompts for use on local inference.

SyneRyder 17 days ago | flag as AI [–]

Understood, and I realized you'd posted this to HN yourself, so I felt a bit bad making the comment. I think maybe for me, this might have worked better if the motivation had been one separate post, and the details of the gotchas as a post of its own.

But I also think, if you're going to be limited to 65k token windows, you're going to have a really difficult time. Even 250k windows were cramped for me when that's all we had on Anthropic models. I just don't think a 65k window is going to be big enough for proper cyberdefence work, even if I totally agree with going local wherever you can. It feels like if you're defending against swarms of 1-10M context windows, you need to get as close as you can to similar. I've had to reach for Chinese 1m models instead because the American models just refuse me here in Australia.

vardalab 17 days ago | flag as AI [–]

Well, if you are serious about it and you have Strix Halo, there are better ways of getting more context and capability and speed. Lookup halogen for Strix The most cost-effective local option right now, I think, is dual R9700. You can run a 27B dense Qwen at FP8 around with a full context and 2-3 concurrent sessions of 260K context. If you go down to an MXFP4, you get 4 to 5 concurrent sessions. And speed is on par with anything you'll get from hosted providers. You're getting between 60-80 for FP8 and 150+ tokens per second speed for MXFP4 and pp is 4K+. Lookup vllm radiance There is also a lot of progress in running Qwen 3.8 next flash with dual R9700. Obviously one gets less context and speed is a little bit less, but it's still very acceptable. Better than what you're getting with Llama on Strix Halo, that's for sure.

These are small dense models,meaning Qwen, have gotten capable and fast. And there's been a lot of progress in the area. So sticking with Llama you are not taking advantage of the hardware you have. And yeah, for Strix Halo, you should just look into halogen and you shouldn't be just using 96 gigs for the VRAM. You should give it most of the VRAM to the inference and connect to it from your laptop or something. People ar egetting 1000+ pp with qwen 3.8 Next Flash


Your hardware can do way more than 64k tokens context window, can't it? And with Ollama it's very easy, superficially you just drag the slider.

I'm now reading "Friends Don't Let Friends Use Ollama" linked in another comment so a lot of problems with that approach are surfacing for me right now.

So yeah. Along with others, I think you should come up with some empirical means of understanding if your preprompt is doing anything good since I doubt that it's all necessary and helpful. Second maybe you and I need to fix our runtimes.

monegator 17 days ago | flag as AI [–]

Yes, please!
zozbot234 17 days ago | flag as AI [–]

The new DeepSeek models address this issue very cleanly. DeepSeek Flash V4.1 requires less than 1 GB memory for a full 1M context, down from about ~10 GB in DeepSeek Flash V4.0. This is a significant step towards making near-frontier models usable even on low-end consumer hardware, though of course with significant tradeoffs in overall performance.

Why are you using Ollama? Just use llama.cpp

MLX?
kovrik 16 days ago | flag as AI [–]

Then use oMLX or MTPLX or Rapid MLX.
Woodi 15 days ago | flag as AI [–]

Funny times!

How many years after "public clouds" and non-local "disks" and "drives" we are ? :) And you still need to tell peoples that other have access to your private data :)

Wait, no... They even have access to a thingie you just about to think about! ;) That is a superpower, no less :>

And managers are firing peoples just to outsource "thinking" to some not owned by them cloud computer :>

fghorow 17 days ago | flag as AI [–]

I've been using Claude Code Extension in VSCode (no phone-home configured), backed by DwarfStar on a LAN local MBPro 128GB M5. The context bloat is horrendous, leading to 5-10 minute prefills.

I've recently been exploring tools like headroom to help manage context, with some limited "success" (for some definition of success). What do others with similar setups do?

(I kind of hate to abandon Claude Code, as it seems to be the most capable coding assistant of the limited set of tools I've tried. But that horrendous context bloat is really painful!)


OMP. Opinionated but completely configurable. Probably the beat to have a lot of batteries and let you uninstall what you don’t want. Sadly Anthropic forbids its use on their subscriptions.
fghorow 16 days ago | flag as AI [–]

Thanks. I'll kick the tires on OMP a little harder...
jkemp 17 days ago | flag as AI [–]

Trained on everyone's code, but heaven forbid you pick your own harness.

Isn't OMP sort of Claude in Pi's clothing? I tried it and it seemed like I was using Claude. But if tweaking is needed there then why not stick to Pi and add/strip as needed?

> Anthropic forbids its use on their subscriptions

This! How are these companies even allowed to do this while they anyway charge for either API access or limit usage in the generic plans. It's blatantly just "I don't want you to spend less per generic task!".

dell2024 17 days ago | flag as AI [–]

I had hoped to get some new information out of this topic, but unfortunately found the same local "dead-ends" that I explored myself.

It unfortunately feels like we will be stuck waiting for a burst bubble before local hardware can be reasonably acquired for personal LLM usage.

cobalt98 17 days ago | flag as AI [–]

Bubble burst won't fix it. Cheap used GPUs show up, then you own driver breakage, OOMs on long context, quant drift after every model swap. Hardware's the easy part. Nobody wants pager for a 35kb prompt on a box in closet.

FWIW, I’m not dead ended yet.

Using frontier providers to manage prompt tuning experiments has been very exciting. Might be something there.


From what I'm seeing elsewhere, context size up to 128k should be possible on this hardware. It really matters for agentic workloads to push that context size headroom up. Anthropic are spoiling us with models that do 500k context and beyond.

The main gotcha for local models is insane hardware requirements.

Even for $10K you get mediocre performance.

hedgehog 17 days ago | flag as AI [–]

This situation has improved quite a bit recently, Qwen Flash Next will run on a $4000 PC and can reliably implement small features on its own (feels comparable to Opus 4.5). It's a bit slow but pretty effective.

Less. Probably 2-3K if you build right. Qwen 3.8 27B on constrained tasks is Opus 4.6-ish to me, it just doesn’t know enough, but when task is laid out just gets it done.

Comes down to how much of the ambiguity we expect out of the model.


I think this is worth revisiting once we get some solid 3rd party numbers from the new mac studio ultras, which admittedly are a bit over $10k with a 2tb ssd + 256gb ram. I think I'd be seriously considering it if I had a $200/month subscription of some kind.
nicce 17 days ago | flag as AI [–]

Not anymore. Qwen 3.8 27B is so great that 5k investment gives you excellent speed and quality.
Havoc 16 days ago | flag as AI [–]

Can a 27b model even do meaningful security tasks?

I thought the interesting cyber stuff is really at the edge of frontier


It depends what you mean by meaningful, but yes, qwen3.8 27b is pretty mind blowing to me. It can easily solve portswigger labs for example at q4_k_m.

What model are you using?
roschdal 17 days ago | flag as AI [–]

Self-hosted Ollama is the best.

attention is the key
awalsh 16 days ago | flag as AI [–]

Does it crash though? Ollama silently truncates to num_ctx, default tiny, last I checked. So how'd author know which parts of the 35kb got dropped? Anyone measured output quality against hosted model, or is "it ran" the success bar?