Your AI Model Isn't Broken. The File You Downloaded Is Out of Date.
DEV Community

Your AI Model Isn't Broken. The File You Downloaded Is Out of Date.

How the chat layout works

In engineering terms: the ticket layout is the chat template, and the model file is a GGUF file, the format most local AI apps use. Here is how the two fit together.

Your app sends a list of messages: a system prompt, a user turn, maybe a tool call and its result. The model never sees that list. It sees one long string, laid out in exactly the format it was trained on, with special tokens like <|im_start|> or [INST] in the right places.

The chat template is the small Jinja program that builds that string. The model's authors ship it in the base repo, in tokenizer_config.json or chat_template.jinja. When someone converts the model to GGUF, the template gets copied into the file as tokenizer.chat_template. From then on, the GGUF carries its own copy, frozen at the moment of conversion.

Base repos don't stand still. Authors fix templates after release: a crash on some message shape, a tool-calling format, a whitespace bug. The base repo gets the fix. The GGUF copies don't, unless someone re-uploads them.

So the question is simple: how many GGUF downloads carry a template that builds a different prompt from the one the authors ship today?

I checked 1,788 copies of six popular models on Hugging Face. Many carry an old chat layout that can crash some apps or hide the AI's tools. Here's how to check yours.

A note on how I made this: AI tools helped me run these tests and draft this article. The ideas are my own.

If you run AI models on your own computer, you've probably downloaded one from Hugging Face. Search for a popular model like Qwen3-8B and you'll find hundreds of copies, uploaded by different people. Same name, same size. It's natural to assume they're the same thing. They aren't.

Each download is a single file that holds two things: the model itself, and a small piece of code that decides how your conversation gets written out for the model to read.

Picture a restaurant. The model is the chef. Your app (Ollama, LM Studio, or your own code) is the waiter. The waiter writes every order on a ticket, and the chef can only read tickets in one exact layout. That ticket layout comes printed inside the model file. Engineers call it the chat template.

Model makers sometimes improve the ticket layout after release, for example by adding a box for special requests. Copies uploaded before the change keep the old layout forever.

Here's what that looks like in practice. Ask Mistral 7B "What's the weather in Adelaide?" and give it a weather tool.

With the current layout, the model reads this (simplified):

[AVAILABLE_TOOLS] get_weather(city) [/AVAILABLE_TOOLS]
[INST] What is the weather in Adelaide right now? [/INST]

With the old layout, which is in the most downloaded copies, it reads this:

[INST] What is the weather in Adelaide right now? [/INST]

The tool is simply gone. No error, no warning. The chef never hears about the special request.

I wanted to know how many people are downloading old layouts, and whether it actually changes what the AI does. I tested two common ways to run these files: llama.cpp, and Python code (Hugging Face's transformers library and llama-cpp-python). Ollama and LM Studio have their own template handling, and I didn't test them directly.

In short I checked 1,788 uploaded copies of six popular models and kept the 643 clean copies of the original models (the rest are fine-tunes and remixes). For four of the six models, most downloads get a chat layout that differs from the official one today.

Even Qwen's own official download of Qwen3-8B has an outdated layout. In Python apps it crashes the moment the AI uses a tool. In llama.cpp it works fine.

For Mistral 7B, the outdated layout hides the AI's tools completely. The same file made 0 correct tool calls out of 60. With the current layout, it made 55.

The model files themselves, from eight different uploaders, scored almost exactly the same. The layout is what makes the difference. The fix is simple, but it depends on how you run the model. I show it at the end, with a one-command check for your own downloads.

How I tested it

The Hub API can return the GGUF metadata for every repo in one listing call, template included. For six popular open model families, I pulled every upload tagged as a quantisation of the base model:

  • Family GGUF uploads Pure repacks Qwen3.8-27B 813 188 Qwen2.5-7B-Instruct 280 90 Qwen3-8B 270 103 Mistral-7B-Instruct-v0.3 195 134 Phi-4-mini-instruct 126 88 gpt-oss-20b 104 40 Total 1,788 643

The tag is set by uploaders, and plenty of fine-tunes, merges and uncensored variants use it too. Those are different models, so I kept only pure repacks, the clean copies: repos whose name is the base model's name plus quantisation words and nothing else. Every headline number below uses those 643 uploads, weighted by their downloads over the last 30 days.

Then, for each family, I walked the base repo's commit history and pulled every version of the official template. That matters: an upload that matches an older official template is stale, not edited, and those are very different stories.

Text comparison turned out to be useless on its own. Unsloth's Qwen3-8B template is 737 characters longer than the current base template, but it builds the same prompt. So I rendered every template against 12 test conversations:

  • a plain question
  • a system prompt
  • multi-turn chat
  • tool definitions
  • a tool call and its result
  • parallel calls
  • thinking switched off
  • earlier reasoning in the history
  • a tool call with null content (which is what the OpenAI API returns, and what most agent loops send straight back)

I rendered each template twice, in two engines:

  • Python Jinja, set up the way transformers does it. llama-cpp-python uses the same approach, and it reads the template straight from the GGUF.
  • llama.cpp itself (build b12359), through llama-server's /apply-template endpoint.

To make sure the API wasn't lying to me, I also read the real file header of 20 uploads with HTTP range requests. All 20 matched the API's template exactly.

Here's the overall result before the details. Each bar is one model, and the colours show how many of its downloads build the official prompt in each engine.

Qwen3-8B: even the official download is out of date

Here's the line that breaks. This is from the template Qwen shipped with Qwen3-8B on 28 April 2025:

{% - if '</think>' in message.content %}

When message.content is null, which it is for an assistant turn that only calls a tool, Python can't run in on it.

On 19 May 2025, Qwen fixed the base repo:

{% - if message.content is string %}
{% - set content = message.content %}
{% - else %}
{% - set content = '' %}
{% - endif %}

The fix never reached Qwen/Qwen3-8B-GGUF, Qwen's own GGUF repo. It still carries the April template, and it's by far the most downloaded Qwen3-8B GGUF: 848,856 downloads in the last 30 days.

I checked this with the real libraries, not just my own renderer. With the current base template, transformers 5.24.0 renders the conversation fine. With the template inside Qwen's GGUF, it fails:

UndefinedError: 'dict object' has no attribute 'content'

llama-cpp-python 0.3.38, which takes its template from the GGUF by default, fails too:

TypeError: argument of type 'NoneType' is not iterable

The two errors look different because transformers removes the empty content field before it renders, so the template finds no content at all, while llama-cpp-python passes it on as None. It's the same bug: the old template expects every assistant turn to have text.

Across all Qwen3-8B pure repacks, 84% of downloads carry the stale template. In a Python Jinja stack (transformers, llama-cpp-python, or anything built on them), every one of them breaks the first time your agent sends back a tool call with null content, which is exactly what OpenAI-style clients do.

Then I ran the same templates through llama.cpp, and every one of them worked. llama.cpp's own Jinja engine detects what a template can and can't handle and fills the gaps itself, so the stale template builds exactly the same prompt as the fixed one. If you run Qwen3-8B in llama-server, or anything else that uses llama.cpp's own template engine, this bug never touches you.

That's the pattern for the whole study: whether a stale template hurts you depends on the engine you run it in.

The old template isn't going away, either. 17 Qwen3-8B uploads created after the fix still carry it. Since January 2026 a new one has appeared every month or so, the newest on 6 November 2026. The two grey dots before the fix are Unsloth and ggml-org. ggml-org later updated its file to Qwen's fixed template, and Unsloth's file has its own edits that build the same prompt as the fix.

Mistral 7B: your tools disappear

Mistral's case is worse, because llama.cpp can't save it. Mistral updated the v0.3 template five times between May and August 2024. The two most downloaded GGUF uploads (MaziyarPanahi with 60,608 downloads, lmstudio-community with 11,100) still carry the very first version from 22 May 2024.

Across all pure repacks, 97% of downloads use a stale Mistral template. Only about 3% get the current one.

In Python Jinja, the old template rejects any system prompt:

TemplateError: Conversation roles must alternate user/assistant/user/assistant/...

llama.cpp handles that one by folding the system prompt into the first user turn. But the old template predates Mistral's tool format, and that's where it goes quiet. Send a request with tools and llama.cpp builds a prompt with no tools in it at all. No [AVAILABLE_TOOLS] block, no warning, no error. The model never learns the tools exist.

Send a conversation that contains a tool result and you get this instead:

HTTP 400: Unable to generate parser for this template.

So with the most popular Mistral uploads, tool calling doesn't fail loudly. It just never happens.

Qwen2.5-7B: out of date by one day

Qwen's own Qwen2.5-7B-Instruct-GGUF (786,204 downloads) carries a template from 18 September 2024. The base repo replaced it the next day. The version in the GGUF shows the model a tool-call example with doubled braces:

{{"name": <function-name>, "arguments": <args-json-object>}}

instead of:

{"name": <function-name>, "arguments": <args-json-object>}

Both engines build the prompt with the doubled braces, so this one reaches everyone: 70% of Qwen2.5-7B GGUF downloads. Whether it changes how well the model calls tools is a question for the next section.

gpt-oss-20b: three versions in circulation

OpenAI's template for gpt-oss went through four versions in its first week. The GGUF uploads froze at different points: ggml-org/gpt-oss-20b-GGUF (453,209 downloads) matches the current template. unsloth/gpt-oss-20b-GGUF (598,365) has its own edits. lmstudio-community (122,051) and bartowski (14,319) carry the 5 August 2025 version.

The differences are small but real. The current official template puts a blank line after the system message and passes a tool's result as an escaped JSON string. Unsloth's passes the raw JSON. lmstudio's and bartowski's add a blank line at the start of the tools block. One upload drops the Reasoning: medium line completely.

62% of gpt-oss-20b downloads build a different prompt from the current official template, in both engines.

The models without the problem

Not every family has this problem. Qwen3.8-27B is the most downloaded model in the study, with 13.8 million downloads of its clean copies in 30 days. Every one of those copies that carries a template builds exactly the official prompt: 183 of 188, and the other 5 have no template at all. So do all 88 Phi-4-mini uploads.

Phi-4-mini's template never changed. Qwen3.8-27B's was fixed on release day itself, before the wave of uploads, and its one later edit didn't change any prompt I tested.

That's the real lesson. The risk isn't GGUF, and it isn't any one uploader. It's a template that changed after the first wave of uploads. Uploads made in the first week after a release end up with most of the downloads: 99% for Qwen3-8B, Qwen2.5-7B and gpt-oss-20b, 92% for Mistral and 90% for Qwen3.8-27B. That first week is exactly when authors are still fixing their templates.

Does it matter who uploaded the file?

Here's a small sign of how different these "identical" downloads are. I took the ten most downloaded Qwen3-8B files of the same type (Q4_K_M, a common 4-bit compression level) and computed their digital fingerprints (SHA-256 hashes). Ten files, ten different fingerprints.

A file's fingerprint covers everything in it, so part of that is metadata: the template text, the model name, notes from the uploader. Different fingerprints don't prove different weights. But each uploader can also compress the model in a different way, and llama.cpp builds exactly the same prompt from every clean Qwen3-8B copy, so any difference in the answers comes from the weights.

Does it change the answers?

I ran Qwen's larger Q8_0 file as a reference, plus eight Q4_K_M files from different uploaders, on an RTX 5090 desktop. Same llama.cpp build, same settings with randomness switched off, Qwen's thinking mode off, and the same 300 tasks:

  • 100 GSM8K maths problems
  • 100 IFEval instruction-following prompts, graded with Google's checker code
  • 60 BFCL function-calling tasks
  • 20 multi-turn conversations with a system rule that has to hold for three turns
  • 20 conversations where the model has to report a value from a tool's result

File Size Score (300 tasks) Tokens/s Qwen Q8_0 (reference) 8.71 GB 92.7% 165 Qwen (official) 5.03 GB 92.0% 241 unsloth 5.03 GB 92.0% 243 MaziyarPanahi 5.03 GB 92.0% 243 bartowski 5.03 GB 91.0% 243 lmstudio-community 5.03 GB 92.0% 243 Aldaris 5.03 GB 92.0% 243 mradermacher 5.03 GB 92.3% 243 eaddario 4.48 GB 91.0% 262

Every Q4_K_M file scored between 91.0% and 92.3%, and the Q8_0 reference scored 92.7%. None of those gaps is statistically significant with 300 tasks: the smallest p-value against the reference is 0.18, and the usual bar is 0.05. The files don't write word-for-wo

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.