lmstudio-ai / lmstudio-ai/lmstudio-python

[Bug] Qwen3 Q4 DWQ Models Fail with Errors (qwen3-4b/8b/14b-dwq-053125 All Fail)

Open
#108 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
875
Forks
166
PR merge metrics
No merged PRs in 30d

Description

The code functions properly with standard Qwen3 Q4 MLX models. Nevertheless, when I switch to the Q4 DWQ models, errors occur. I've tested several models such as qwen3-4b-dwq-053125, qwen3-8b-dwq-053125, and qwen3-14b-dwq-053125, but all of them result in errors.:

```text
Traceback (most recent call last):
File "/Users/Larkin/workspace/gitee/ai/lmstudio-json.py", line 17, in
result = model.respond("/no_think\nTell me about The Hobbit", response_format=BookSchema)
lmstudio.LMStudioServerError: Chat response error: Error rendering prompt with jinja template: "Parser Error: Expected closing statement token. OpenSquareBracket !== CloseStatement.".

This is usually an issue with the model's prompt template. If you are using a popular model, you can try to search the model under lmstudio-community, which will have fixed prompt templates. If you cannot find one, you are welcome to post this issue to our discord or issue tracker on GitHub. Alternatively, if you know how to write jinja templates, you can override the prompt template in My Models > model settings > Prompt Template.
```

The script:

```python
"""Example script demonstrating an interactive LLM chatbot."""

import json

import lmstudio as lms

class BookSchema(lms.BaseModel):
"""Structured information about a published book."""
title: str
author: str
year: int

# model = lms.llm("qwen3-8b-mlx") # runs well
model = lms.llm("qwen3-8b-dwq-053125") # runs with error

# # add /no_think to the prompt to disable qwen3 thinking
result = model.respond("/no_think\nTell me about The Hobbit", response_format=BookSchema)
book = result.parsed

print(json.dumps(book, indent=2))
```

env:m4 16g ram

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided lmstudio-json.py example, especially the model selection and model.respond call, and reproduce the failure with qwen3-8b-dwq-053125 while comparing it with qwen3-8b-mlx. Trace the structured-response request through the SDK and verify whether the DWQ model's prompt template is handled correctly; done means the reported models no longer produce the parser error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.