[Feature] Add Qwen3.5-4B chat template support #4
Labels
No labels
blocked:lint-failed
blocked:needs-decision
blocked:no-changes
blocked:no-procedure
blocked:preflight
blocked:verify-failed
bug
feature-request
in-progress
lint-cleanup
ops-task
quickfix
security/high
security/medium
test-coverage
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/vllm_mm#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Qwen3.5-4B (unsloth/Qwen3.5-4B-GGUF) uses a chat template that differs from the generic "llama" template currently applied to all models. The model supports:
<|im_start|>system\n...<|im_end|>\n<|im_start|>user\n...<|im_end|>\n<|im_start|>assistant\n...<|im_end|>\n<|im_start|>assistant\n<|thinking|>...<|/thinking|>\n<|im_end|>\nCurrently, vllm_mm applies a generic "llama" template to all models, which produces incorrect prompt formatting for Qwen3.5-4B and likely degrades output quality.
Evidence
The model's GGUF metadata (extracted via
stringson the Q4_K_M file) shows:Proposed Solution
Add a new
chat_templatefield to the model configuration that allows per-model template selection:chat_templatecolumn tomodelstable (SQLite schema already supports this)llama(default, current behavior)qwen3(for Qwen3.5-4B and similar)gemma4(for Gemma 4 models — see related work)chat_templatein/api/modelsand/api/models/{id}responses--chat-templateargument or Jinja2 stringAcceptance Criteria
--chat-templateargument on model load/v1/chat/completionsuse the correct templateRelated