Why does my model ramble or answer itself?
Usually because the chat template is wrong. A chat model was trained on conversations wrapped in special markers, and it only behaves when it sees the same markers again. Use a runtimeRuntimeThe software that loads a model file and runs it.Read more that reads the template from the model file and most of these problems disappear.
Models expect a wrapper
A model does not see a chat. It sees one long string of text. The chat template turns your messages into that string, with markers that say who is speaking and where each turn ends.
Here is one short exchange in the ChatML format, which several model families use.
<|im_start|>system
You are a concise assistant.<|im_end|>
<|im_start|>user
What is a token?<|im_end|>
<|im_start|>assistantThe string ends with the start of an assistant turn. The model fills it in, then writes <|im_end|> when it is done. The runtime watches for that marker and stops.
Other families use different markers for the same job. Llama, Gemma, Mistral and gpt-oss each have their own. The markers are special What is a token?, learned in training, so a model only understands its own.
Let the runtime use the template stored in the model file. Only set one by hand when the output shows the symptoms below.
Symptoms of a wrong template
A wrong template rarely causes an error. The model still runs and writes text. It just behaves strangely, and the cause is easy to miss.
| Symptom | What is going on |
|---|---|
| Rambling that never stops | The runtime does not know the stop marker, so it never ends the turn |
| The model writes your next message, then answers it | It does not see a turn boundary and carries on the conversation alone |
Stray tags in the output, such as <|im_end|> or [INST] | Markers from the wrong format are being printed as text |
| Ignores the system prompt | The system message is wrapped in a way the model was not trained on |
| Fine for one message, odd after several | The template handles history differently from what the model expects |
Why is the output nonsense? covers other causes of bad output, such as a corrupted download or the wrong Should I touch temperature and the other sliders? settings. Check the template first, because it is the most common one with new models.
How to fix it
GGUFGGUFThe single-file model format used by llama.cpp and the apps built on it.Read more files carry their template inside them. Ollama, LM Studio and llama.cpp read it automatically in current versions. For llama.cpp's server, the --jinja flag tells it to use that embedded template in full.
llama-server -m model.gguf --jinjaIf the template inside the file is wrong, download the model from a different uploader. Upload quality varies, and a broken template is one of the common faults. Where do I download models? covers how to pick one.
A new model can arrive before runtimes fully support its template. Tool callsTool callingA model asking the app to run a function, such as a search or a shell command.Read more and thinking tags are the usual weak spots in the first weeks. If a brand-new model misbehaves, update the runtime before you blame the model.
System prompts
The system prompt is the first message in the conversation. It sets standing instructions: the role, the tone, the format, the rules. The model gives it more weight than a normal message because it was trained that way.
Use it for things that hold for the whole conversation. "Answer in British English." "Reply in under 100 words unless asked." "You are reviewing Python code for a team that uses type hints." Put the task itself in the user message.
How long is too long
Every tokenTokenA chunk of text, usually part of a word. Models read and write in tokens.Read more of the system prompt is read on every request and takes space in the How much can the model keep in mind?. A few hundred tokens costs almost nothing. A few thousand starts to matter on a small context, and agents often ship system prompts that size.
Length also hurts accuracy on small models. A 4B model given 40 rules will follow some and forget others. Keep it short and specific, and test each rule actually changes the output.
See the template your model uses in Ollama.
ollama show qwen3:8b --templateThe output is the template with placeholders for the system prompt and messages. Compare its markers with any stray tags you see in answers.
Go deeperThat's enough
Templates are code
Most templates are written in Jinja, a small templating language. They loop over the messages, insert markers, and handle special cases such as tool calls, images and thinking. A template can be dozens of lines long, which is why a small mismatch between runtimes causes problems.
The base model trap
Some uploads are base models, trained only to continue text and never taught to chat. They have no template at all.
Give one a question and it might write three more questions in the same style. If the name lacks words like Instruct, Chat or IT, check the model card. How do I read a model name? explains the labels.
Tool calls and thinking go through the template too
When an app offers the model tools, the template formats the tool list and the model's calls. When a reasoning model thinks, the template decides where the thinking goes and whether earlier thinking is kept in the history. A template that handles plain chat correctly can still break both.