I’ve been doing a pretty thorough deep dive into the Qwen 3.5 templating logic to properly fix the lingering tool calling bugs. People here have done some really brilliant groundwork, templates from folks like @pneuny and @ellary were absolute lifesavers early on. But I realised that a lot of them rely on forced prompt injections, or accidentally hallucinate the xml formatting (qwen is actually trained on pure <think> tags natively, not the /* syntax some older templates fallback to).
So after many hours of resarching and testing all the known problems with the official qwen template, I carefully wrote the best possible template. It perfectly respects the native xml schema, dynamically maps the newer 'developer' role strings from modern api clients, and safely caches empty tool parameters.
Just as a side note for anyone specifically using LM Studio: the backend throws an error over python |items dict iterators, and the regex parser completely borks if the model just ponders about a tool call inside its thoughts. I’ve integrated targeted fixes for this into the jinja too. If you write <|think_off|> anywhere inside your prompt (both system or user), the template invisibly scrubs the tag and hard-disables thinking for that turn, completely bypassing the infinite loop tool bug.
Im hoping the architecture here is solid enough that it should still be valid for the soon to be released Qwen 3.6 models. Let me know if you run into any weird behaviour.
You can get the template from here:
[link] [comments]




