[GH-ISSUE #804] Is there a maximum in Modelfile?? #26147

Closed
opened 2026-04-22 02:11:50 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @LiuYang328 on GitHub (Oct 16, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/804

how many prompt I can provide in Modelfile

Originally created by @LiuYang328 on GitHub (Oct 16, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/804 how many prompt I can provide in Modelfile
Author
Owner

@danglingptr0x0 commented on GitHub (Oct 17, 2023):

how many prompt I can provide in Modelfile

You should only define a system prompt in Modelfile. There's only one system prompt at a time.

<!-- gh-comment-id:1766233884 --> @danglingptr0x0 commented on GitHub (Oct 17, 2023): > how many prompt I can provide in Modelfile You should only define a system prompt in `Modelfile`. There's only one system prompt at a time.
Author
Owner

@mxyng commented on GitHub (Oct 25, 2023):

Modelfile docs are available here: https://github.com/jmorganca/ollama/blob/main/docs/modelfile.md

If by prompt, you mean the system prompt, @simonSlamka is correct; you can only define one. However its contents can be long, e.g. thousands of bytes.

If by prompt, you mean the general prompt template, you can modify that to whatever you want. The size limit is the same as the system prompt.

e.g. here's an example of a sentiment analysis using llama2 by seeding it with a preceding conversation

FROM llama2

TEMPLATE """[INST] <<SYS>>{{ .System }}<</SYS>>

Tweet: 'I hate it when my phone battery dies.' [/INST] Sentiment: Negative </s><s>[INST] Tweet: 'My day has been 👍' [/INST] Sentiment: Positive </s><s> [INST] Tweet: 'This is the link to the article' [/INST] Sentiment: Neutral </s><s> [INST] Tweet: '{{ .Prompt }}' [/INST] Sentiment: """

Keep in mind the LLM's context size becomes an issue at some point with large inputs.

<!-- gh-comment-id:1779932801 --> @mxyng commented on GitHub (Oct 25, 2023): Modelfile docs are available here: https://github.com/jmorganca/ollama/blob/main/docs/modelfile.md If by prompt, you mean the system prompt, @simonSlamka is correct; you can only define one. However its contents can be long, e.g. thousands of bytes. If by prompt, you mean the general prompt template, you can modify that to whatever you want. The size limit is the same as the system prompt. e.g. here's an example of a sentiment analysis using llama2 by seeding it with a preceding conversation ``` FROM llama2 TEMPLATE """[INST] <<SYS>>{{ .System }}<</SYS>> Tweet: 'I hate it when my phone battery dies.' [/INST] Sentiment: Negative </s><s>[INST] Tweet: 'My day has been 👍' [/INST] Sentiment: Positive </s><s> [INST] Tweet: 'This is the link to the article' [/INST] Sentiment: Neutral </s><s> [INST] Tweet: '{{ .Prompt }}' [/INST] Sentiment: """ ``` Keep in mind the LLM's context size becomes an issue at some point with large inputs.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#26147