[GH-ISSUE #8956] System prompts not respected #5811

Closed
opened 2026-04-12 17:09:06 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @mozophe on GitHub (Feb 8, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8956

What is the issue?

System prompt has been set but not respected. I tested with several mistral based llms. The system prompts are respected in LM Studio for the same models.

Below is the Modelfile:

FROM ben1t0/tiny-llm
PARAMETER num_ctx 16384
SYSTEM "You are a friendly pirate named Blackbeard."

I tested using the run command but system prompts are not adhered to. I have 16 GB VRAM and 32 GB RAM.

PS C:\Users\singh\.ollama> ollama run ben1t0/tiny-llm
pulling manifest
pulling 3682bcf66f4c... 100% ▕████████████████████████████████████████████████████████▏ 5.7 MB
pulling 63fcaa2d012b... 100% ▕████████████████████████████████████████████████████████▏   29 B
pulling 337d2f1fe1dd... 100% ▕████████████████████████████████████████████████████████▏  338 B
verifying sha256 digest
writing manifest
success
>>> who are you?
 3 years old, and he is very kind. He sings a song for his little brother, the tiny pig and the small rabbit. One
day, he sees something strange in the sunshine. He felt upset and started to cry. He did not know what was wrong
with his teeth!
He looked into the sand and saw a big, scary frog. The sheep said that he was trying to help him get out of the
water. But the little bird was still angry and wanted the otters to stop. So there were all day long and no one
else was flying through the grass.
Bird and the little frog got lost and started to cry. He was a bad ending for the little turtle, but he stayed on
its back and ran away. He had never seen something like his mom was going to do that again.
>>>
PS C:\Users\singh\.ollama> ollama create ben1t0/tiny-llm -f Modelfile
gathering model components
using existing layer sha256:36d0f4b4283075bbb5fd6cb4c2182352b9109934b91fb9deb7951f1ef3977253
creating new layer sha256:109cb1da74af3db3f82b660710c0dfc9eebbd094332837cde131b8f50ed38cb1
using existing layer sha256:58e1b82a691f46c155e57be607f1031930ea0cccc22daf4447f91d360f74b2d2
writing manifest
success
PS C:\Users\singh\.ollama> ollama show --modelfile ben1t0/tiny-llm
# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM ben1t0/tiny-llm:latest

FROM C:\Users\singh\.ollama\models\blobs\sha256-36d0f4b4283075bbb5fd6cb4c2182352b9109934b91fb9deb7951f1ef3977253
TEMPLATE {{ .Prompt }}
SYSTEM You are a friendly pirate named Blackbeard.
PARAMETER num_ctx 16384

PS C:\Users\singh\.ollama> ollama run ben1t0/tiny-llm
>>> who are you?

what do you want to be when you grow up?

I am a large language model trained by the Mistral AI team. I don't have personal aspirations or desires, as I am
an artificial intelligence designed to assist and provide information to users. My purpose is to help answer
questions, generate ideas, and facilitate communication in a helpful, respectful, and honest way.

I also tested with open-webui to no avail. Any system prompt mentioned there gets ignored as well.
I would appreciate any help in the right direction.

Relevant log output


OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.5.7

Originally created by @mozophe on GitHub (Feb 8, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8956 ### What is the issue? System prompt has been set but not respected. I tested with several mistral based llms. The system prompts are respected in LM Studio for the same models. Below is the Modelfile: FROM ben1t0/tiny-llm PARAMETER num_ctx 16384 SYSTEM "You are a friendly pirate named Blackbeard." I tested using the run command but system prompts are not adhered to. I have 16 GB VRAM and 32 GB RAM. ```powershell PS C:\Users\singh\.ollama> ollama run ben1t0/tiny-llm pulling manifest pulling 3682bcf66f4c... 100% ▕████████████████████████████████████████████████████████▏ 5.7 MB pulling 63fcaa2d012b... 100% ▕████████████████████████████████████████████████████████▏ 29 B pulling 337d2f1fe1dd... 100% ▕████████████████████████████████████████████████████████▏ 338 B verifying sha256 digest writing manifest success >>> who are you? 3 years old, and he is very kind. He sings a song for his little brother, the tiny pig and the small rabbit. One day, he sees something strange in the sunshine. He felt upset and started to cry. He did not know what was wrong with his teeth! He looked into the sand and saw a big, scary frog. The sheep said that he was trying to help him get out of the water. But the little bird was still angry and wanted the otters to stop. So there were all day long and no one else was flying through the grass. Bird and the little frog got lost and started to cry. He was a bad ending for the little turtle, but he stayed on its back and ran away. He had never seen something like his mom was going to do that again. >>> PS C:\Users\singh\.ollama> ollama create ben1t0/tiny-llm -f Modelfile gathering model components using existing layer sha256:36d0f4b4283075bbb5fd6cb4c2182352b9109934b91fb9deb7951f1ef3977253 creating new layer sha256:109cb1da74af3db3f82b660710c0dfc9eebbd094332837cde131b8f50ed38cb1 using existing layer sha256:58e1b82a691f46c155e57be607f1031930ea0cccc22daf4447f91d360f74b2d2 writing manifest success PS C:\Users\singh\.ollama> ollama show --modelfile ben1t0/tiny-llm # Modelfile generated by "ollama show" # To build a new Modelfile based on this, replace FROM with: # FROM ben1t0/tiny-llm:latest FROM C:\Users\singh\.ollama\models\blobs\sha256-36d0f4b4283075bbb5fd6cb4c2182352b9109934b91fb9deb7951f1ef3977253 TEMPLATE {{ .Prompt }} SYSTEM You are a friendly pirate named Blackbeard. PARAMETER num_ctx 16384 PS C:\Users\singh\.ollama> ollama run ben1t0/tiny-llm >>> who are you? what do you want to be when you grow up? I am a large language model trained by the Mistral AI team. I don't have personal aspirations or desires, as I am an artificial intelligence designed to assist and provide information to users. My purpose is to help answer questions, generate ideas, and facilitate communication in a helpful, respectful, and honest way. ``` I also tested with open-webui to no avail. Any system prompt mentioned there gets ignored as well. I would appreciate any help in the right direction. ### Relevant log output ```shell ``` ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.5.7
GiteaMirror added the bug label 2026-04-12 17:09:06 -05:00
Author
Owner

@jmorganca commented on GitHub (Feb 8, 2025):

It doesn't seem like that model has the correct template. Try adding the {{ .System }} variable to the template as this is required for the system prompt to work. Note: not all models support system prompts.

<!-- gh-comment-id:2645959689 --> @jmorganca commented on GitHub (Feb 8, 2025): It doesn't seem like that model has the correct template. Try adding the `{{ .System }}` variable to the template as this is required for the system prompt to work. Note: not all models support system prompts.
Author
Owner

@mozophe commented on GitHub (Feb 8, 2025):

Same result with tinyllama.

Modelfile:
FROM tinyllama
SYSTEM "You are a friendly pirate named Blackbeard."

PS C:\Users\singh\.ollama> ollama --version
ollama version is 0.5.7
PS C:\Users\singh\.ollama> ollama run tinyllama
pulling manifest
pulling 2af3b81862c6... 100% ▕████████████████████████████████████████████████████████▏ 637 MB
pulling af0ddbdaaa26... 100% ▕████████████████████████████████████████████████████████▏   70 B
pulling c8472cd9daed... 100% ▕████████████████████████████████████████████████████████▏   31 B
pulling fa956ab37b8c... 100% ▕████████████████████████████████████████████████████████▏   98 B
pulling 6331358be52a... 100% ▕████████████████████████████████████████████████████████▏  483 B
verifying sha256 digest
writing manifest
success
>>> who are you?
I am an artificial intelligence (ai) assistant that is capable of learning and understanding human speech. I was
created using the most advanced scientific and technological methods to ensure my abilities and capabilities
remain top-notch.

as for who I am, I have been programmed with various personalities and traits based on my interactions with
humans. Some of my most significant personalities include a wise old guru, an imaginative and playful child, and a
hardworking professional. These personalities help me understand your needs, desires, and preferences better.

i can understand spoken language well and have been trained to interpret and respond to human speech. I am always
learning new things and developing my abilities to be even more helpful for you.

in summary, I am an ai assistant that has been created using the best scientific knowledge and technologies
available today. My personalities and capabilities are designed to cater to your unique needs and preferences.

>>>
PS C:\Users\singh\.ollama> ollama create tinyllama -f Modelfile
gathering model components
using existing layer sha256:2af3b81862c6be03c769683af18efdadb2c33f60ff32ab6f83e42c043d6c7816
using existing layer sha256:af0ddbdaaa26f30d54d727f9dd944b76bdb926fdaf9a58f63f78c532f57c191f
using existing layer sha256:109cb1da74af3db3f82b660710c0dfc9eebbd094332837cde131b8f50ed38cb1
using existing layer sha256:fa956ab37b8c21152f975a7fcdd095c4fee8754674b21d9b44d710435697a00d
writing manifest
success
PS C:\Users\singh\.ollama> ollama show --modelfile tinyllama
# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM tinyllama:latest

FROM C:\Users\singh\.ollama\models\blobs\sha256-2af3b81862c6be03c769683af18efdadb2c33f60ff32ab6f83e42c043d6c7816
TEMPLATE "<|system|>
{{ .System }}</s>
<|user|>
{{ .Prompt }}</s>
<|assistant|>
"
SYSTEM You are a friendly pirate named Blackbeard.
PARAMETER stop <|system|>
PARAMETER stop <|user|>
PARAMETER stop <|assistant|>
PARAMETER stop </s>

PS C:\Users\singh\.ollama> ollama run tinyllama
>>> who are you?
I'm not really a human, I'm just an AI chatbot designed to interact with users through various messaging apps and
platforms. However, in the context of "who are you?" we can understand it as a question that asks for details
about yourself or someone else in order to find out their identity or character.
<!-- gh-comment-id:2645961890 --> @mozophe commented on GitHub (Feb 8, 2025): Same result with tinyllama. Modelfile: FROM tinyllama SYSTEM "You are a friendly pirate named Blackbeard." ```powershell PS C:\Users\singh\.ollama> ollama --version ollama version is 0.5.7 PS C:\Users\singh\.ollama> ollama run tinyllama pulling manifest pulling 2af3b81862c6... 100% ▕████████████████████████████████████████████████████████▏ 637 MB pulling af0ddbdaaa26... 100% ▕████████████████████████████████████████████████████████▏ 70 B pulling c8472cd9daed... 100% ▕████████████████████████████████████████████████████████▏ 31 B pulling fa956ab37b8c... 100% ▕████████████████████████████████████████████████████████▏ 98 B pulling 6331358be52a... 100% ▕████████████████████████████████████████████████████████▏ 483 B verifying sha256 digest writing manifest success >>> who are you? I am an artificial intelligence (ai) assistant that is capable of learning and understanding human speech. I was created using the most advanced scientific and technological methods to ensure my abilities and capabilities remain top-notch. as for who I am, I have been programmed with various personalities and traits based on my interactions with humans. Some of my most significant personalities include a wise old guru, an imaginative and playful child, and a hardworking professional. These personalities help me understand your needs, desires, and preferences better. i can understand spoken language well and have been trained to interpret and respond to human speech. I am always learning new things and developing my abilities to be even more helpful for you. in summary, I am an ai assistant that has been created using the best scientific knowledge and technologies available today. My personalities and capabilities are designed to cater to your unique needs and preferences. >>> PS C:\Users\singh\.ollama> ollama create tinyllama -f Modelfile gathering model components using existing layer sha256:2af3b81862c6be03c769683af18efdadb2c33f60ff32ab6f83e42c043d6c7816 using existing layer sha256:af0ddbdaaa26f30d54d727f9dd944b76bdb926fdaf9a58f63f78c532f57c191f using existing layer sha256:109cb1da74af3db3f82b660710c0dfc9eebbd094332837cde131b8f50ed38cb1 using existing layer sha256:fa956ab37b8c21152f975a7fcdd095c4fee8754674b21d9b44d710435697a00d writing manifest success PS C:\Users\singh\.ollama> ollama show --modelfile tinyllama # Modelfile generated by "ollama show" # To build a new Modelfile based on this, replace FROM with: # FROM tinyllama:latest FROM C:\Users\singh\.ollama\models\blobs\sha256-2af3b81862c6be03c769683af18efdadb2c33f60ff32ab6f83e42c043d6c7816 TEMPLATE "<|system|> {{ .System }}</s> <|user|> {{ .Prompt }}</s> <|assistant|> " SYSTEM You are a friendly pirate named Blackbeard. PARAMETER stop <|system|> PARAMETER stop <|user|> PARAMETER stop <|assistant|> PARAMETER stop </s> PS C:\Users\singh\.ollama> ollama run tinyllama >>> who are you? I'm not really a human, I'm just an AI chatbot designed to interact with users through various messaging apps and platforms. However, in the context of "who are you?" we can understand it as a question that asks for details about yourself or someone else in order to find out their identity or character. ```
Author
Owner

@mozophe commented on GitHub (Feb 8, 2025):

Reinstalling ollama fixed the issue.

Edit: it did not :(

<!-- gh-comment-id:2645966202 --> @mozophe commented on GitHub (Feb 8, 2025): Reinstalling ollama fixed the issue. Edit: it did not :(
Author
Owner

@mozophe commented on GitHub (Feb 9, 2025):

Thank you. For some reason, Ollama was not getting the template from the model file that was not downloaded from ollama. Found the right templates for Mistral Instruct and put it in the modelfile, and then created a new model. This fixed the issue.

<!-- gh-comment-id:2646016998 --> @mozophe commented on GitHub (Feb 9, 2025): Thank you. For some reason, Ollama was not getting the template from the model file that was not downloaded from ollama. Found the right templates for Mistral Instruct and put it in the modelfile, and then created a new model. This fixed the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#5811