gguf-template-check
Is the GGUF model you downloaded still using its official chat template? This checks it in one command.
Every GGUF file carries its own copy of the model's chat template, frozen on the day the file was made. Model authors keep fixing their templates after release, and the copies on Hugging Face don't update. I looked at 1,788 GGUF uploads of six popular models, and for four of them most downloads get a template that differs from the official one today. Sometimes that's harmless. Sometimes it crashes your app the first time the model calls a tool, or quietly drops the tools from the prompt.
The full write-up is on Medium: Your AI Model Isn't Broken. The File You Downloaded Is Out of Date.
Check your model
You need uv. Nothing else to install.
git clone https://github.com/vanshaj1999/gguf-template-check
cd gguf-template-check
# a repo on Hugging Face (the base model is found automatically)
uv run check_template.py bartowski/Qwen_Qwen3-8B-GGUF
# or a file you already have
uv run check_template.py ~/models/Qwen3-8B-Q4_K_M.gguf --base Qwen/Qwen3-8B
You can also skip the clone and run it from PyPI:
uvx gguf-template-check bartowski/Qwen_Qwen3-8B-GGUF
This is what it says about Qwen's own Qwen3-8B GGUF, the most downloaded one:
Checking Qwen/Qwen3-8B-GGUF
Base Qwen/Qwen3-8B
Official 2 template version(s), the current one from 2025-05-19
Result OUT OF DATE. It matches the official template from 2025-04-28.
Qwen/Qwen3-8B has changed it since then (latest change 2025-05-19).
Test conversation This file vs current official
plain question same
system prompt same
...
tool call with null content FAILS: TypeError: argument of type 'NoneType' is not iterable
...
It pulls every version of the template from the base model's history and renders each one, plus the one in your file, over 12 test conversations: plain chat, system prompts, tools, tool results, a tool call with null content (what OpenAI-style clients send back), parallel calls and a few reasoning cases. Then it tells you if your file is up to date, out of date (and since when), or edited by the uploader.
If it's out of date, --save chat_template.jinja writes the current official template, and you can hand that to llama.cpp:
llama-server -m model.gguf --jinja --chat-template-file chat_template.jinja
--json prints the whole result as JSON, for scripts and agents. --list-local lists the GGUF files in your LM Studio, llama.cpp and Hugging Face cache folders, or in a folder you name (--list-local ~/models).
Use it from your AI agent
The whole checker is also an MCP server. In Claude Code:
claude mcp add gguf-template-check -- uvx --from gguf-template-check gguf-template-check-mcp
For any other MCP client, add this to its config:
{
"mcpServers": {
"gguf-template-check": {
"command": "uvx",
"args": ["--from", "gguf-template-check", "gguf-template-check-mcp"]
}
}
}
It exposes five tools: check_gguf_template, check_llama_server, find_local_gguf_models, get_official_template and show_prompt_diff.
Or grab just the skill (it tells the agent when to run the check and how to fix what it finds):
npx skills add vanshaj1999/gguf-template-check
Or install the Claude Code plugin, which bundles the MCP server and the skill:
claude plugin marketplace add vanshaj1999/gguf-template-check
claude plugin install gguf-template-check@vanshaj1999
Check a running llama-server
If you already run llama-server, point the checker at it:
uv run check_template.py --server http://127.0.0.1:8080
# needs the base model only when it can't be detected:
uv run check_template.py --server http://127.0.0.1:8080 --base Qwen/Qwen3-0.6B
It reads the server's template from /props, checks that text the same way as above, then POSTs all 12 test conversations to /apply-template and compares the prompts the server really builds.
Two rows usually come back different on purpose: llama.cpp rewrites tool calls whose arguments arrive as a string (what OpenAI-style clients send) and handles the reasoning_content field itself. Those print as different (llama.cpp rewrites this input, expected) and are not a problem. When every row matches, the server needs no fix, even if the template inside the file is old (the checker still tells you, because Python apps reading that file would break). If the tools rows say TOOLS DROPPED, or the tool chats fail, start the server with --jinja.
A few things to know:
- It renders templates with Python Jinja, the same way
transformersandllama-cpp-pythondo. llama.cpp has its own template engine and papers over some gaps, so a template that fails here can still work there. Its/apply-templateendpoint shows you the exact prompt it builds, and--serverdoes that comparison for you. - I still haven't tested how LM Studio applies templates at runtime.
--list-localfinds its files and the check works on them, and if one is out of date you can paste the official template into that model's Prompt Template setting. Ollama isn't covered at all: it stores its own template and ignores the one inside the GGUF. - Gated base models (Llama, Gemma) need a Hugging Face token in
HF_TOKEN. - It exits with 1 when the template isn't up to date, so you can drop it into a script. Exit 2 means the check itself failed (bad repo id, missing file, unreachable server).
What I found
Share of the last 30 days' downloads (23 Nov 2026, clean repacks only) whose template doesn't build the official prompt, either because the prompt is different or because the template fails:
| Model | Python (transformers) | llama.cpp | What goes wrong |
|---|---|---|---|
| Mistral-7B-Instruct v0.3 | 97% | 97% | Python rejects system prompts. llama.cpp drops tool definitions without a warning and returns HTTP 400 on tool results. |
| Qwen3-8B | 84% | 0% | Python crashes on a tool call with null content. llama.cpp patches it. |
| Qwen2.5-7B-Instruct | 70% | 70% | Doubled braces in the tool-call example. No measurable effect. |
| gpt-oss-20b | 62% | 62% | Small formatting differences. No measurable effect. |
| Phi-4-mini-instruct | 0% | 0% | |
| Qwen3.8-27B | 0% | 0% |
Then I ran the files on an RTX 5090 to see what the differences actually do:
- Same file, different template. With the template inside it, lmstudio-community's Mistral 7B file didn't make a single tool call in 60 function-calling tasks, and over its 100 tasks it scored 12%. With the current official template swapped in, the same file called a tool in all 60, got 55 right, and scored 87%. The Qwen2.5 and gpt-oss template differences changed the wording of the replies but not a single right or wrong answer.
- Same label, different uploaders. Eight Qwen3-8B Q4_K_M files from different uploaders scored between 91.0% and 92.3% over 300 tasks, against 92.7% for Qwen's Q8_0. None of those gaps is statistically significant. Who made the file barely matters. Which template it carries can matter a lot.
The short version: a difference in formatting (whitespace, braces, quoting) didn't change anything I measured. A difference in capability (a template that predates tool calling) switched the feature off completely.
Reproduce it
Everything I ran is in harness/. In the code, the scan is Test A, the uploader comparison is Test B and the template swap is Test C.
# the scan: every GGUF upload of the six models, about 1,800 Hub requests at roughly one a second
uv run harness/scan.py
python3 harness/analyse_scan.py
# the same templates rendered by llama.cpp (I used build b12359)
# needs llama-server on your PATH and models/Qwen3-0.6B-Q8_0.gguf
uv run harness/engine_render.py
python3 harness/analyse_engine.py --diffs
# check the Hub API against real file headers (20 uploads, range requests only)
uv run harness/gguf_header.py
# the Qwen3-8B crash in the real libraries, and the ten file fingerprints
uv run harness/check_libraries.py
uv run harness/file_hashes.py
# the benchmarks: start llama-server --jinja on a GPU machine first
uv run harness/build_tasks.py
python3 harness/bench.py --run qwen3-8b__unsloth__embedded --base http://127.0.0.1:8090
uv run harness/grade.py --ref qwen3-8b__official-q8__embedded
# charts
uv run harness/figs_scan.py
uv run harness/figs_bench.py
Benchmark settings: greedy decoding, fixed seed, thinking off, at most 2,048 tokens per reply, one file at a time. The 300 tasks are 100 GSM8K, 100 IFEval (graded with Google's checker), 60 BFCL simple function calls, 20 multi-turn rule checks and 20 tool-result checks. results/ has every raw reply, so you can regrade without a GPU.
What's in here
| Path | What it is |
|---|---|
check_template.py |
The one-command checker (a small uv script that runs the package) |
gguf_template_check/ |
The installable package: CLI, core checks, local model discovery, llama-server check, MCP server |
pyproject.toml |
pip install-able package: gguf-template-check and gguf-template-check-mcp entry points |
skills/gguf-template-check/ |
Agent skill: when to run the check and the fixes that work |
.claude-plugin/ |
Claude Code plugin and marketplace files |
server.json |
MCP Registry metadata |
gguf_template_check/hub.py |
Small Hub client with a polite gap between requests (0.2 s for a check, 0.8 s in the study scripts); the study scripts point its disk cache at results/cache/ |
gguf_template_check/render.py |
The 12 test conversations and the transformers-style renderer |
harness/scan.py |
The scan, plus how "out of date" is decided |
harness/engine_render.py |
The llama.cpp side, through llama-server /apply-template |
harness/build_tasks.py, bench.py, grade.py |
Benchmark tasks, runner and grader (Wilson intervals, exact McNemar tests) |
harness/check_libraries.py |
The null-content crash, reproduced in transformers and llama-cpp-python |
harness/file_hashes.py |
SHA-256 of the ten most downloaded Qwen3-8B Q4_K_M files, from Hub metadata |
tests/ |
Offline tests for the package: uv run --group dev pytest -q (add --network for the live Hub ones) |
results/ |
Scan results, every template I found, rendered prompts and all benchmark replies |
img/ |
Charts |
How I sorted the uploads:
- Clean repack: the repo name is the base model's name plus quantisation words and nothing else. Fine-tunes, merges and uncensored variants are left out. It's a name rule, so it isn't perfect.
- Up to date: builds the same prompt as the current official template for all 12 conversations.
- Out of date: builds the same prompts as an older official version from the base repo's history.
- Edited: matches no official version.
Licence
My code is MIT. harness/instruction_following_eval/ is Google's IFEval checker (Apache 2.0, licence in that folder), with one change marked in instructions_util.py. The task data comes from GSM8K (MIT), IFEval (Apache 2.0) and BFCL (Apache 2.0). The chat templates in results/ belong to their model authors.
Metadata
Release files for gguf-template-check 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gguf_template_check-0.2.0.tar.gz | 21.3 kB | With provenance | Details for gguf_template_check-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gguf_template_check-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for gguf_template_check-0.2.0-py3-none-any.whl |
Total release size: 48.1 kB
Release files / gguf_template_check-0.2.0.tar.gz
| Download URL | gguf_template_check-0.2.0.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a0e00a74778456738d1db2d85b7c29f46003d0859353eb09335935167ceb87b
|
|
BLAKE2b-256 checksum How to use checksums |
7d9498e2d5270b64eb35cf4dfa753690c21509cf6d343f925bf608afe6ad9375
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logRelease files / gguf_template_check-0.2.0-py3-none-any.whl
| Download URL | gguf_template_check-0.2.0-py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84989a44c09fa2b46d6c823b904c5a6566fcc5fd14563ebc16cfa7fbd4ac3a6e
|
|
BLAKE2b-256 checksum How to use checksums |
70788c97633322e68ef69dd86ca26beff9e4ea55dc916f49b60648e5b6a10991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logSecurity for gguf-template-check 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gguf_template_check-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.