r/LocalLLM • u/esaule • 3d ago
Question opencode+qwen3 keeps looping; what am I doing wrong?
I have been trying these local LLM for coding tasks. I am running a local Qwen3-32B quantized in LMStudio. I am trying to use it with opencode. But after 3 prompts or questions, the agent session turn into some infinite loop of reasoning or some tool calling infinite loop of some kind. Sometimes it tells me how to do things instead of doing them.
I can't be the first one to run into this. What's going on? What am I doing wrong? Is there a basic "how to" somewhere I didn't find that explains how to set this up so that it is useful?
0
Upvotes
2
u/AutomaticLanguage334 3d ago
the thing you're doing wrong is that you're running a rather dated model. Qwen didn't start optimizing for agent workflows until Qwen3.5 I believe. consider switching to a more modern model if you want proper tool calling. (specifically, Qwen3.8-27B is the one you want at the moment, though Inkling-2 is the current hotness at the moment)
it could also be a low quant biting you. Q1 / Q2 quants on smaller models can be pretty inconsistent with their output quality.
2
u/asdonne 3d ago
I had a similar problem with Claude-code + ollama caused by inconsistent context settings between the two. I believe the context was being truncated which was causing problems. Explicitly setting the context length in both programs fixed the issue but ultimately a quantisised 32b model is going to have limited performance.
1
u/Pitiful_Dot2876 2d ago
Hi, not sure if this will help you in any way, but I built a tool to observe what our coding agents are doing. Maybe with it you'll be able to check what's going on and why it's looping.
https://github.com/radekwojpl2/session-observer
1
u/Future_AGI 2d ago
65k is fine for the 27B as long as opencode knows that number too. If you added LM Studio as a custom OpenAI-compatible provider, opencode has no context number for that model and assumes 200k, so its automatic compaction waits until about 170k tokens, far past the 65k you set. Either switch to the built-in lmstudio provider (it reads the context from LM Studio) or set limit.context for the 27B to 65k in your opencode config.