[GH-ISSUE #2678] Understanding Modelfile template with respect to conversational history #79272

Closed
opened 2026-05-09 04:39:38 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @nikhil0360 on GitHub (Feb 22, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2678

[proposed Label] question

Hello, I want to understand how does the conversational history is feed back into the template from the model file.

for example, for llama2:chat

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

{{ .Prompt }} [/INST]
"""

I am able to do conversational question answering on the terminal, but I am not sure how does the template take care of the history.

On the contrary, how do I disable such behaviour? I want to run a fine-tune model which just answer to user based on the current question. I don't want it to get influenced by history/previous question. I tried using /set nohistory but it doesn't seem to work (for llama2)

Please help.

I tried looking in docs, online forms, github issues. Was unable to find any solutions.

Originally created by @nikhil0360 on GitHub (Feb 22, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2678 [proposed Label] question Hello, I want to understand how does the conversational history is feed back into the template from the model file. for example, for llama2:chat ``` TEMPLATE """[INST] <<SYS>>{{ .System }}<</SYS>> {{ .Prompt }} [/INST] """ ``` I am able to do conversational question answering on the terminal, but I am not sure how does the template take care of the history. On the contrary, how do I disable such behaviour? I want to run a fine-tune model which just answer to user based on the current question. I don't want it to get influenced by history/previous question. I tried using `/set nohistory` but it doesn't seem to work (for llama2) Please help. I tried looking in docs, online forms, github issues. Was unable to find any solutions.
GiteaMirror added the question label 2026-05-09 04:39:38 -05:00
Author
Owner

@pdevine commented on GitHub (Mar 12, 2024):

Hey @nikhil0360 There's no way to disable this in the repl, although if you want to clear out the current context you can just use /load <model>. If you load the same model again it will remain in memory (i.e. it won't be "re-loaded") and it will make the model forget anything from before.

<!-- gh-comment-id:1992713720 --> @pdevine commented on GitHub (Mar 12, 2024): Hey @nikhil0360 There's no way to disable this in the repl, although if you want to clear out the current context you can just use `/load <model>`. If you load the same model again it will remain in memory (i.e. it won't be "re-loaded") and it will make the model forget anything from before.
Author
Owner

@nikhil0360 commented on GitHub (Mar 17, 2024):

@pdevine Thanks for the answer.

Just for more details for anyone who comes across here, I want to share that this behaviour (influenced by history/previous question.) is not followed in the API call, which is what I finally used for my work.

<!-- gh-comment-id:2002555196 --> @nikhil0360 commented on GitHub (Mar 17, 2024): @pdevine Thanks for the answer. Just for more details for anyone who comes across here, I want to share that this behaviour (influenced by history/previous question.) is not followed in the API call, which is what I finally used for my work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#79272