[GH-ISSUE #2811] Mistral Instruct models prompt does not use <s> or </s> #1703

Closed
opened 2026-04-12 11:40:44 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @louisabraham on GitHub (Feb 28, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2811

Originally assigned to: @BruceMacD on GitHub.

from https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format

<s> [INST] Instruction [/INST] Model answer</s> [INST] Follow-up instruction [/INST]

I didn't see <s> as part of the prompt when using OLLAMA_DEBUG=1 ollama start. Is that expected?

Originally created by @louisabraham on GitHub (Feb 28, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2811 Originally assigned to: @BruceMacD on GitHub. from https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format > \<s> [INST] Instruction [/INST] Model answer\</s> [INST] Follow-up instruction [/INST] I didn't see `<s>` as part of the prompt when using `OLLAMA_DEBUG=1 ollama start`. Is that expected?
Author
Owner

@jukofyork commented on GitHub (Feb 28, 2024):

from https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format

[INST] Instruction [/INST] Model answer [INST] Follow-up instruction [/INST]

I didn't see <s> as part of the prompt when using OLLAMA_DEBUG=1 ollama start. Is that expected?

I think llama.cpp adds the opening <s>.

<!-- gh-comment-id:1969982131 --> @jukofyork commented on GitHub (Feb 28, 2024): > from https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format > > > <s> [INST] Instruction [/INST] Model answer</s> [INST] Follow-up instruction [/INST] > > I didn't see `<s>` as part of the prompt when using `OLLAMA_DEBUG=1 ollama start`. Is that expected? I think `llama.cpp` adds the opening `<s>`.
Author
Owner

@louisabraham commented on GitHub (Feb 28, 2024):

But then who adds the closing </s> ?

<!-- gh-comment-id:1969985183 --> @louisabraham commented on GitHub (Feb 28, 2024): But then who adds the closing `</s>` ?
Author
Owner

@BruceMacD commented on GitHub (Mar 5, 2024):

Hi @louisabraham thanks for your questions. The llama.cpp library will add a bos (<s>) token to the incoming prompt. As far as I'm aware [INST]-style prompt templates optionally have bos/eos tokens on each turn, but will still function with out them. If people find the models are harder to steer without this tokens please let me know, and it can be added to the default template.

reference: 652ca2bded/llama.cpp (L13418)

<!-- gh-comment-id:1979686047 --> @BruceMacD commented on GitHub (Mar 5, 2024): Hi @louisabraham thanks for your questions. The llama.cpp library will add a `bos` (`<s>`) token to the incoming prompt. As far as I'm aware `[INST]`-style prompt templates optionally have bos/eos tokens on each turn, but will still function with out them. If people find the models are harder to steer without this tokens please let me know, and it can be added to the default template. reference: https://github.com/ggerganov/llama.cpp/blob/652ca2bded3c818320d92c70d2b67f64bdbff5e5/llama.cpp#L13418
Author
Owner

@louisabraham commented on GitHub (Mar 7, 2024):

@BruceMacD thank you for your answer! Do you think the ollama calls llama.cpp with that function? It would be weird as we use much more complex templates than what this heuristic function supports.

<!-- gh-comment-id:1983920256 --> @louisabraham commented on GitHub (Mar 7, 2024): @BruceMacD thank you for your answer! Do you think the ollama calls llama.cpp with that function? It would be weird as we use much more complex templates than what this heuristic function supports.
Author
Owner

@pdevine commented on GitHub (Jul 18, 2024):

@louisabraham you can always use the /api/generate endpoint w/ raw mode set to true in order to specify the full prompt with your own template.

I'm going to go ahead and close the issue, but we can reopen it if the answer wasn't clear.

<!-- gh-comment-id:2237742370 --> @pdevine commented on GitHub (Jul 18, 2024): @louisabraham you can always use the `/api/generate` endpoint w/ `raw` mode set to true in order to specify the full prompt with your own template. I'm going to go ahead and close the issue, but we can reopen it if the answer wasn't clear.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1703