r/opencode • u/megablue • 6d ago
After about two months of extensive usage of Deepseek 4.1 Flash I think i understand why it gets dumber for some people - it is the context window
from my anecdotal observations, deepseek 4.1 flash (and 4.1 flash 1017) performed best when the context-window is under 400K, as soon as you go beyond that you will realize it gets more and more confused as the context window grows.
I would say around 700K+ it becomes unusable bad. so, you either use a context-management plugin that have some kind of virtual limit to cap the context around 400K. or start a new session as soon as it reached about 400k-500k. and you usually want to be more careful with what you stuff into the context - if you have a lot of random, non-focused tasks in the same context, it will become even worse at > 400k.
I think this is partly because of DS 4.1 flash used a lot aggressive compression techniques, including sharing KV cache between multiple layers so anything that fall in between become very lossy.
41
u/CaffeinatedTech 6d ago
Yeah I've been telling it to start wrapping up and preparing a handoff when its context gets to around 300K. It does a fairly good job of it. Often I will run it as an orchestrator using subagents for all of the work, tests, adversarial reviews. The orchestrator just runs autonomously until it gets to around 300K then stops.
33
u/OptimalLengthiness42 6d ago
Damn you people really live like this? The moment I get over 100k tokens I start planning how I'm gonna handoff and compact. Rarely do I hit 200k and that's usually a sloppy mistake on my end, 125-150k is usually my hard cap.
What are you all doing at 400k?
2
u/bullraiii 6d ago
Personnellement je n'ai pas de context à plus 200k et plus de 100k très rarement. Une demande, un patch, une nouvelle feature =nouvelle conversation. Pour des grosse demande (création d'une app), je créer un plan long-terme et chaque étape est une conversation. Vous fait comment pour avoir des contexte à plus de 300k ? Sérieusement, je suis curieux.
5
u/PerfectReflection155 6d ago
That’s interesting OP. It wouldn’t surprise me as I’ve seen some say models can really keep on track properly after only 200k context.
Also the other thing is I don’t understand why people simultaneously complain about running out of credit fast and still use the default 1M context window. Do they not understand how much tokens it is using ?
I have mine at 150k in Pi primarily to save on token spend and rarely have any issues. In Pi I use smarter compact and opencode I use magic context. I actually have it at 200k context limit for opencode which is probably a better balance.
I don’t have any issues with it getting dumber ever. My only complaint about deepseek is it does seem to take a long time to complete some tasks where another model could probably do it twice as fast.
But I knew that going in it can be slower what matters more is accuracy and getting it done properly and deepseek is performing well on that.
5
u/beardedNoobz 6d ago
Yeah, that is a common issue with most Chinese models. I remember in 2025 where most context windows is 262K~ish, GLM 4 and Deepseek 3 series keeps going bad past 100K context. The fact that they can manage 300-400K~ish context without going dumb nowadays is a real progress.
1
u/Anh-DT 6d ago
What do you mean max context is 700k anyways. Input is 300k+ total 1m
2
u/amyoeba 6d ago
you can make a skill to compact itself at boundaries between units of work. i have it set to compact every time its PR merges before starting the next feature
2
u/Green-Recording6578 4d ago
After a full day of testing yesterday (200M+ tokens consumed), I noticed the same issue with the 1M context window: the model gradually loses track and becomes significantly slower.
I reduced it to 300K tokens, and performance improved noticeably. The model became faster, more consistent, and better at maintaining context.
I'm using an API key through VS Code's local harness, which automatically compacts the conversation when the context reaches its configured limit.
3
u/sayboom 6d ago
Based on my observations even 200k tokens its too much in average and deepseek starting to degradate
2
u/gugugaga_069 5d ago
even pro models like opus and sol goes dumb after 400k mark , its all about context management , if that is good even Qwen 27b model can code better
1
u/cdcyberdream 6d ago
same here
1
u/mWo12 6d ago
I use billion-context to help with keeping context under control.
1
u/mad_vik 6d ago
Comment connait on le poids du contexte ?
1
u/m2wm2wm2w 6d ago
Thanks for this, I had a long running session and was getting infuriated at how dumb it was getting. Should have made the connection that new sessions worked perfectly well, but a few were going off the rails.
1
u/Minimum-Drive-3571 6d ago
I wrap up around 150 to 200k. That way the usage drops very low.
1
u/ProgressionPeak 5d ago
i reset the context constantly so this isn't the answer for me
i suspect its inference providers using some shit version of it
1
u/fapmasterr69 5d ago
So how do I set it up to for session compaction without using auto compact limit? I'm hitting the full context window limit very often and had some minimal trouble yesterday with DS hallucinating, nothing that I couldn't fix but I'd like to be on the safe side in the future.
1
u/warpaint_james 5d ago
Yep. I compact before 50%. Anything after that is usually a big drop in quality
1
u/6T_K9 5d ago
Yeah this has been known for a while between the power users. I’ve been having the best experience by putting the cap at 350k so that it usually starts compacting around 300k. That’s the sweet spot imo.
1
u/Competitive-Yak-8255 5d ago
Nice
1
u/Jakkaru3om 3d ago
This is well known and should be a practice everyone follows. I always try to keep context under 150-200K 300max anything above that I do not trust. I use matt pococks skills and when it is time to do to-tickets I tell it to break them down in a way that would keep the implementer subagents around 150-200K tokens.
1
u/xenstar1 3d ago
I set an auto-compact rule at 272K.