Downloads · 30 days
0
Anothers1993/Qwen3.8-Scoped-Terse-Chat-Template
Qwen3.8-Scoped-Terse-Chat-Template is a machine learning model from Anothers1993. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Downloads · 30 days
0
Access
Public
Updated Aug 20, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other14.3 KB · 35%
From the Hugging Face model README
An operational chat template for Qwen3.8-27B agent workloads. It keeps the official Qwen message, vision, and tool-call formats while changing two defaults that matter in long-running local agents:
low reasoning effort is tuned for concise completion instead of full-history
reconstruction.This repository contains no model weights.
Status:
v0.1.0-beta. Validated on SGLang with Qwen3.8-27B NVFP4, DFlash2 speculative decoding, OpenCode, and 2× DGX Spark TP2. Treat the results below as an operational regression test, not a model-quality benchmark.
The official Qwen3.8 template preserves reasoning from all historical assistant
messages by default. That can improve continuity and KV-cache reuse, but very long
agent sessions may also reactivate completed tasks. Separately, reasoning_effort
is a soft instruction rather than a hard token budget: an ambiguous follow-up can
spend the entire output allowance on reasoning and return no final text.
This template provides a middle ground:
preserve_thinking=true still restores full-history behavior;minimal → low, high/max → xhigh aliases improve harness compatibility;low focuses on the latest request, asks a concise clarifying question when the
request is ambiguous, targets a short reasoning pass, and requests non-empty
final text unless a tool call is required;Download chat_template.jinja, then launch SGLang with:
python -m sglang.launch_server \
--model-path Qwen/Qwen3.8-27B \
--chat-template ./chat_template.jinja \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder \
--enable-multimodal \
--host 0.0.0.0 \
--port 30000
The template is also suitable for separately quantized Qwen3.8-27B checkpoints when their tokenizer and chat protocol remain compatible with the official model.
from openai import OpenAI
client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="qwen3.8-27b",
messages=[{"role": "user", "content": "Explain the failure briefly."}],
reasoning_effort="low",
max_tokens=16384,
extra_body={
"chat_template_kwargs": {
"preserve_thinking": False,
"enable_thinking": True,
}
},
)
preserve_thinking=False is already the template default. Passing it explicitly
is useful when a gateway may inject its own defaults.
To restore the official full-history behavior for a request:
{"chat_template_kwargs": {"preserve_thinking": true}}
See examples/opencode.json. The important fields are:
{
"reasoning": true,
"interleaved": {"field": "reasoning_content"},
"options": {"reasoningEffort": "low"},
"limit": {"context": 262144, "output": 16384}
}
reasoning_content must be declared as interleaved reasoning so it survives
assistant/tool round trips without being merged into visible text.
| Client value | Template policy |
|---|---|
minimal | alias of low |
low | scoped-terse policy |
medium | neutral; no extra steering sentence |
high | alias of xhigh |
xhigh | careful-analysis policy |
max | alias of xhigh |
Unknown values fail closed with a template error.
A real-world replay used a long OpenCode agent session and the same ambiguous follow-up. The context sizes differ slightly because the second run was a later fork of the session; this is a regression replay, not a controlled quality eval.
| Result | Previous low policy | Scoped-terse v3 |
|---|---|---|
| Prompt context | ~143.7K tokens | ~148.2K tokens |
| Output tokens | 8,192 | 475 |
| Finish reason | length | stop |
| Final text | No | Yes, concise clarification |
Additional live checks covered structured tool calls, a tool-result round trip,
image input, preserve_thinking on/off, and all reasoning-level aliases. See
benchmarks/dgx-spark-regression.json.
python -m pip install jinja2
python tests/test_chat_template.py chat_template.jinja
The test suite checks:
low is instruction-level steering, not a hard runtime
budget. Configure a reasonable total output limit and handle finish_reason=length.Derived from the official Qwen3.8-27B chat template under Apache-2.0. Operational ideas were informed by the Qwen and SGLang documentation and community work on long-running Qwen agents, including the Qwen Sharp Chat Templates project. The scoped-terse wording and compatibility tests in this repository are maintained independently.
Apache License 2.0. See LICENSE.