ollama - 💡(How to fix) Fix Qwen 3.5 does not respect the TEMPLATE field [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#14722Fetched 2026-04-08 00:32:33
View on GitHub
Comments
3
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
commented ×3closed ×1labeled ×1
RAW_BUFFERClick to expand / collapse

What is the issue?

When creating a Modelfile from Qwen 3.5 (I tested 27b and 122b), I put the TEMPLATE field as

TEMPLATE """ {{ .System }} """

and then set a SYSTEM field as

SYSTEM """Testy Test."""

to make the model only see the System message and not any user messages.

Next, I started a chat with the model with a simple Hi. The model was able to see the Hi.

Relevant log output

OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.17.7

extent analysis

Fix Plan

The fix involves modifying the TEMPLATE field to correctly filter out user messages.

  • Update the TEMPLATE field to use a conditional statement that only displays the System message:
TEMPLATE """
{{ if eq .System "Testy Test." }}
{{ .System }}
{{ end }}
"""
  • Alternatively, you can use a regex to match the System message:
TEMPLATE """
{{ if regexMatch "Testy Test\\." .System }}
{{ .System }}
{{ end }}
"""
  • Ensure that the SYSTEM field is set correctly:
SYSTEM: "Testy Test."

Verification

To verify that the fix worked, start a new chat with the model and check if it only responds with the System message.

Extra Tips

  • Make sure to update the TEMPLATE field in the correct location, such as the model configuration file.
  • If you're using a different templating engine, the syntax may vary. Consult the documentation for your specific engine.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING