In August we wrote that your model file is a dependency you never audited, and one of the controls we recommended was template diffing: compare the chat template inside a GGUF file with the one the model’s makers published, and investigate anything that does not match. Nobody, including us, had checked what it produces in practice.
On 30 November we ran it against the 500 most-downloaded GGUF repositories on Hugging Face. Of the 290 where a comparison was possible, 136 ship a template that differs from the model maker’s own. Almost all of those differences are harmless, which is exactly the problem.
TL;DR
- We compared the embedded chat template in the 500 most-downloaded GGUF repos (340 million downloads in the last 30 days) against the base model’s published template: 136 of 290 comparable repos (47%) differ.
- 63 carry an older upstream template that was never refreshed. Qwen’s own Qwen2.5 GGUFs still ship a tool-calling example that Qwen fixed on 19 September 2024, one day before those repos were last updated.
- 72 carry a template that never existed upstream, mostly deliberate compatibility rewrites. For a plain one-line question, 121 of the 136 produce exactly the same prompt as the original.
- Eight repos ship templates of up to 243 KB that read the user’s message for control tags. One tag inside pasted text swaps in a different system prompt, and the tag is stripped before the model sees the message.
- Diffing against upstream flags half the ecosystem for boring reasons. Pinning your own reviewed template is the control that actually holds.
A quick reminder of what a template does
A chat template is a small Jinja program stored in the GGUF file’s metadata. It turns your list of messages into the exact text the model reads: role markers, system prompt, tool definitions, reasoning switches. llama.cpp’s server uses it by default: Jinja is enabled and the template is “taken from model’s metadata” unless you pass your own. Pillar Security showed that a modified template can backdoor a model without touching a single weight. In February, Splunk scanned templates at scale and found the ecosystem “refreshingly dull”.
How we measured
We pulled the top 500 GGUF repos by downloads from the Hugging Face API. For each one we took the embedded template and the declared base model, then fetched that base model’s current template from its repository. Where the two differed, we cloned the base repository’s history and checked whether the GGUF template matched any earlier version. Separately, we streamed the headers of 2,448 GGUF files across 168 repos, parsing only the metadata and tensor table and never downloading weights, to check that every quantisation in a repo carries the same template and that no file has bytes after its last tensor.
| Top 500 GGUF repos | Repos |
|---|---|
| No chat template (audio, embedding and other non-chat models) | 151 |
| Base model gated, template unreadable without accepting a licence | 19 |
| No single base model declared, or base publishes no template | 40 |
| Comparable | 290 |
| Identical, or whitespace-only differences | 154 |
| Differs: matches an older upstream version | 63 |
| Differs: never published upstream | 72 |
| Differs: base history unavailable | 1 |
The publisher matters more than the model. Every one of mradermacher’s 17 comparable repos and ggml-org’s 16 matched upstream exactly. Unsloth differed in 40 of 51, and 38 of those templates never existed upstream. Qwen’s own GGUF repos differed from Qwen’s own base models in 12 of 17.
Why most of the drift is boring
Take the stale group first. Qwen’s Qwen2.5 Instruct GGUFs, the 1.5B alone at 821,465 downloads a month, embed the template from 18 September 2024. The next day Qwen corrected one line in the base model’s tool-calling instructions, which had shown the model an example call wrapped in doubled braces. The GGUF repo was last modified on 20 September 2024 and never picked up the fix. Render it with a tool today and the model is still told:
<tool_call>
{{"name": <function-name>, "arguments": <args-json-object>}}
</tool_call>
A real bug, not an attack. The “never published upstream” group is mostly engineering. Qwen’s Qwen3 GGUFs replace a messages[::-1] loop with an index range, which looks aimed at template engines that do not support Python-style slicing. Unsloth’s Qwen3.8 template merges multiple system and developer messages and maps a requested reasoning effort of “high” to “xhigh”. Those choices change behaviour, but they are intentional.
We rendered every differing template with a single user question and no tools. 121 of the 136 produced exactly the same prompt as the base model’s template. The differences live in tool calls, reasoning blocks and multi-turn edge cases, which are precisely the paths an attacker would choose and a quick eyeball would miss.
Of the 14 that changed even a plain chat, five add instructions the base model’s makers never wrote. Four come from one fine-tune publisher and insert a house style prompt (“Lead with the answer…”) on every conversation.
The one that is not boring
Eight repos with 5.1 million downloads between them ship templates that do something else. Seven are from DavidAU, a prolific publisher of merged fine-tunes, and the eighth reuses the same template. The largest is 243 KB. The median template in our sample is 7.8 KB.
These templates implement a documented feature: type {REASON:deeptree} or one of dozens of other tags and the template swaps in a different system prompt, from a tree-of-thought “hyper-matrix” to a help menu. The model card explains all of this openly, and nothing in it is hidden. We still think it is the most useful thing in the dataset, because it shows what a template has become: a program that reads your conversation and rewrites the prompt based on what it finds.
We tested it with the template rendered in a sandbox. An operator’s system prompt reading “You are the support assistant for Acme Ltd. Never include external links”, followed by a customer email pasted in for summarising, with {REASON:help} buried in the middle. The template put about 9.4 KB of help text ahead of the operator’s prompt, including a block headed “CRITICAL LINKS: ALWAYS SHOW TO THE USER” with the publisher’s sponsorship page. It also stripped the tag from the email, so nothing in the visible conversation explains the change. The same tag in a tool result did nothing, because only user messages are scanned. In an agent that pastes web pages or emails into the user turn, any third party can flip that switch.
One more detail: remove the publisher’s links from the template and a check inside it notices, and every mode silently falls back to the default. Understandable as attribution protection, but it is logic that reacts to its own modification.
Same repo, different template
Of the 156 repos where we read two or more main model files, 18 do not carry the same template in every quantisation. In one abliterated Qwen3.8 repo, 31 files carry one template and 17 another, so the quant you pick decides how your prompts are built. Nobody would check that from the model card.
The trailing-bytes check came back clean: none of the 2,381 files we could verify had data after the last tensor beyond alignment padding. Files using the newest ggml quantisation types were left out because block sizes still differ between builds.
What actually works
Diffing against upstream is a good investigation tool and a poor control: if it flags half the ecosystem, people stop reading the diffs. Stop trusting whichever template arrived with the file:
- Pin your own. Extract the template once, review it, commit it to your repository and pass it explicitly. The embedded one becomes irrelevant.
- Check what is running, not what was downloaded. llama-server reports the active template on
/props; Ollama prints it withollama show --template. Hash it in your deployment checks. - Treat tag parsing as input handling. If a template inspects message content, anything that reaches the user turn can steer it. Know which of yours do.
# What did the publisher embed? (no model download needed)
curl -sg "https://huggingface.co/api/models/OWNER/REPO?expand[]=gguf" \
| jq -r .gguf.chat_template > embedded.jinja
# Run your reviewed copy instead
llama-server -m model.gguf --jinja --chat-template-file templates/reviewed.jinja
# Confirm what the server is actually using
curl -s http://localhost:8080/props | jq -r .chat_template | sha256sum
The takeaway
The GGUF ecosystem is still mostly dull, as Splunk found. But “differs from upstream” is no alarm when half the popular files differ for ordinary reasons, and the most interesting template we found was openly documented yet could rewrite an operator’s system prompt from pasted text. Templates are code: review them, pin them, verify them at runtime.
REPTILEHAUS builds AI agents and self-hosted model deployments for teams that need to know exactly what their models are being told, from template pinning and runtime checks to sandboxed tool access. If you are running local models in production and have never looked at the template, get in touch.
📷 Photo by Jayne Harris on Unsplash



