Skip to content

fix(llm): restore the official Qwen2.5-Coder chat template - #5894

Merged
qinxuye merged 1 commit into
xorbitsai:mainfrom
David-Wu1119:fix/qwen25-coder-chat-template
Oct 28, 2026
Merged

qinxuye merged 1 commit into
xorbitsai:mainfrom
David-Wu1119:fix/qwen25-coder-chat-template

Conversation

@David-Wu1119

Copy link
Copy Markdown
Contributor

Description

qwen2.5-coder-instruct and XiYanSQL-QwenCoder-2504 both advertise the tools ability. Their chat_template is the first upload of Qwen/Qwen2.5-Coder-7B-Instruct (6ab006b, 2024-09-17). In that version the tool-call example sits inside a Jinja string literal, so the tools prompt shows the model a literal double-braced example rather than the JSON object it is expected to emit:

  • catalog: <tool_call>\n{{"name": <function-name>, "arguments": <args-json-object>}}\n</tool_call>
  • official: <tool_call>\n{"name": <function-name>, "arguments": <args-json-object>}\n</tool_call>

Qwen fixed this upstream on 2024-09-19 (0b044f5). This PR replaces only the chat_template of both entries with the current official template. That template is the same in every Qwen2.5-Coder-*-Instruct size and in XGenerationLab/XiYanSQL-QwenCoder-{7B,32B}-2504:

Behavior change to note: the official template also changed the default system prompt, the day before (8d20e2b). When the request has no system message, the prompt now starts with You are Qwen, created by Alibaba Cloud. You are a helpful assistant. instead of You are a helpful assistant. This is what transformers' apply_chat_template produces for these models.

Test

The new xinference/model/llm/tests/test_qwen25_coder_chat_template.py renders a tools prompt for both models and checks that the call example is single-braced. It fails on main and passes with this change. pre-commit run on the changed files passes, including the catalog schema check.

🤖 Generated with Claude Code

qwen2.5-coder-instruct and XiYanSQL-QwenCoder-2504 both advertise the
tools ability, but their chat_template is the first upload of
Qwen/Qwen2.5-Coder-7B-Instruct (6ab006b, 2024-09-17). In that version the
tool-call example sits inside a Jinja string literal as
{{"name": ..., "arguments": ...}}, so the tools prompt showed the model
a literal double-braced example instead of the JSON object it was
trained to emit. Qwen fixed this on 2024-09-19 (0b044f5); the day before
(8d20e2b) the default system prompt also became "You are Qwen, created
by Alibaba Cloud. You are a helpful assistant."

Restore both entries to the current official template. It is the same
in every Qwen2.5-Coder-*-Instruct size and in
XGenerationLab/XiYanSQL-QwenCoder-{7B,32B}-2504:
https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct/blob/c03e6d358207e414f1eca0bb1891e29f1db0e242/tokenizer_config.json
https://huggingface.co/XGenerationLab/XiYanSQL-QwenCoder-7B-2504/blob/afe320fcaf18bee342174b4e35e5a481ae93719f/tokenizer_config.json

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 08:00
@XprobeBot XprobeBot added the bug Something isn't working label Oct 27, 2026
@XprobeBot XprobeBot added this to the v4.x milestone Oct 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T08:01:42.077583Z
We couldn’t complete this review. Comment @codex review to try again.
4b81286 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qinxuye qinxuye left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Both catalog templates match the official Qwen2.5-Coder and XiYanSQL templates. The tool-call example now uses single braces, and the default system prompt matches upstream; explicit system messages remain unchanged. Other catalog fields are unchanged.

Validation: 255 related tests, 40 rendering checks, 24 adapter prompt-preparation checks, and pre-commit passed. Both new regression cases fail with the base templates. Regenerating documentation leaves the affected model pages unchanged. Model inference was not run locally.

The remaining Windows Python 3.14 CI failure is in test_abort_rpc_failure_restores_admission_and_allows_new_handoff, reporting HandoffPending: Cannot confirm preparation rollback. It is unrelated to these template changes. No unresolved review threads.

@qinxuye
qinxuye merged commit e82e85a into xorbitsai:main Oct 28, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants