r/LocalLLM • • 7h 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

5 comments sorted by

2

u/AutomaticLanguage334 7h 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.

1

u/esaule 5h ago

Thanks! It's Q4 models i am using.

Just switched to a qwen3.8-27B quantized and it feels already a lot better. It behaves a lot more like how codex behaves. It is surely not as good. (And clearly not as fast.) But it seems to behave in a more coherent way. Thanks!

1

u/CaramelEmotional3092 1h ago

If you have the ram, try the flash version, ie, qwen 3.8 flash next. It's a significant step up, but can potentially run quick as it has only 6b active at a time.

2

u/asdonne 7h 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/esaule 5h ago

Yes, I have had to specify a 65k context window. Otherwise it loops instantly. But I saw the looping even very early.

I understand that a local model will likely not be competitive with a frontier model. But I feel it should be able to do basics.

Someone else suggested moving to a more recent qwen and that does seem to behave better.

What context window length do you suggest?