赞
踩
https://github.dev/langgptai/awesome-llama-prompts
提示词的结构很重要,需要和训练时所使用的提示词结构匹配。如果使用了与训练时不同的提示词结构,那么 Llama 模型可能会产生奇怪的结果。
llama-2 聊天模式下,系统提示词和用户提示词的结构为:
<s>[INST] <<SYS>>
{{ system_prompt }}
<</SYS>>
{{ user_message }} [/INST]
让我们来分析一下上面提示词结构的各个部分:
<s>
:整个序列的开头。<<SYS>>
:系统提示词的开头。<</SYS>>
:系统提示词的结尾,注意有 ‘/’。[INST]
:用户提示词的开始。[/INST]
:用户提示词的结束,注意有 ‘/’。{{ system_prompt }}
:开发者提供的系统提示词,以便为模型输出结果提供整体上下文。{{ user_message }}
:用户输入的提示词放在此处,向模型提供生成输出的提示词。一个完整的提示词如下:
<s>[INST] <<SYS>>
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
<</SYS>>
There's a llama in my garden 声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/484897
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。