Skip to content

Improve Mistral/Mixtral instruct prompt#5214

Merged
oobabooga merged 22 commits into
oobabooga:devfrom
BadisG:mistral_template
Jan 10, 2024
Merged

Improve Mistral/Mixtral instruct prompt#5214
oobabooga merged 22 commits into
oobabooga:devfrom
BadisG:mistral_template

Conversation

@BadisG
Copy link
Copy Markdown
Contributor

@BadisG BadisG commented Jan 9, 2024

Hello.

The mistral instruct prompt is supposed to be this one

<s> [INST] Instruction [/INST] Model answer

Source: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1

The original instruct template wasn't accurate enough:
image

Here's the final result with my change:
image

The thing is that this modification isn't really the final version, normally there should be a pair of "INST" for every new instruction

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

It should look like this at the end (If I understood that correctly):
image

I don't know how to do that one, so if you could help me on that part it would be appreciated.

oobabooga and others added 22 commits December 14, 2023 22:39
@oobabooga
Copy link
Copy Markdown
Owner

That seems correct, thanks. Multiturn is already handled correctly with the template:

 [INST] This is the first message [/INST] This is the first reply</s> [INST] This is the second message [/INST] This is the second reply

print

@oobabooga oobabooga changed the base branch from main to dev January 10, 2024 00:12
@oobabooga oobabooga merged commit c44836c into oobabooga:dev Jan 10, 2024
@Wehzie
Copy link
Copy Markdown

Wehzie commented Jan 10, 2024

Related to this, why isn't the start of sequence token <s> part of the template?

The Mistral template doesn't use it at all. The LLama-v2 template adds it after the first instruction turn is over with </s>.

PoetOnTheRun pushed a commit to PoetOnTheRun/text-generation-webui that referenced this pull request Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants