ローカルLLM の対話で使われてるプロンプト書式まとめ
「ローカルLLM」の対話で使われているプロンプト書式をまとめました。
1. FastChat
「ローカルLLM」の対話で使われているプロンプト書式をまとめました。
「FastChat」のコード内のテンプレートを参考にしています。
2. テンプレートのパラメータ
テンプレートで定義されているパラメータは、次のとおりです。
セパレータ種別の書式は、次のとおりです。
表記では、読みやすさ重視で改行してますが、実際に改行されるのは<\n>のみになります。
・ADD_COLON_SINGLE
<system><sep>
<role>: <message><sep>
<role>: <message><sep>
<role>: <message><sep>
<role>:
・ADD_COLON_TWO
<system><sep>
<role>: <message><sep>
<role>: <message><sep2>
<role>: <message><sep>
<role>:
・NO_COLON_SINGLE
<system>
<role><message><sep>
<role><message><sep>
<role><message><sep>
<role>
・BAIZE
<system><\n>
<role><message><\n>
<role><message><\n>
<role><message><\n>
<role>
・DOLLY
<system>
<role>:<\n><message><sep>
<role>:<\n><message><sep2><\n><\n>
<role>:<\n><message><sep>
<role>:<\n>
・RWKV
<system>
<role>: <message><\n><\n>
<role>: <message><\n><\n>
<role>: <message><\n><\n>
<role>:
3. テンプレート
3-1. Vicuna v1.1 テンプレート
# Vicuna v1.1 template
conv_vicuna_v1_1 = Conversation(
system="A chat between a curious user and an artificial intelligence assistant. "
"The assistant gives helpful, detailed, and polite answers to the user's questions.",
roles=("USER", "ASSISTANT"),
messages=(),
offset=0,
sep_style=SeparatorStyle.ADD_COLON_TWO,
sep=" ",
sep2="</s>",
)
・system (翻訳)
・roles
・sep, sep2
3-2. Koala デフォルトテンプレート
conv_koala_v1 = Conversation(
system="BEGINNING OF CONVERSATION:",
roles=("USER", "GPT"),
messages=(),
offset=0,
sep_style=SeparatorStyle.ADD_COLON_TWO,
sep=" ",
sep2="</s>",
)
・system (翻訳)
・roles
・sep, sep2
3-3. Dolly V2 デフォルトテンプレート
# Dolly V2 default template
conv_dolly = Conversation(
system="Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n",
roles=("### Instruction", "### Response"),
messages=(),
offset=0,
sep_style=SeparatorStyle.DOLLY,
sep="\n\n",
sep2="### End",
)
・system (翻訳)
・roles
・sep, sep2
3-4. OpenAssistant Pythia デフォルトテンプレート
conv_oasst = Conversation(
system="",
roles=("<|prompter|>", "<|assistant|>"),
messages=(),
offset=0,
sep_style=SeparatorStyle.NO_COLON_SINGLE,
sep="<|endoftext|>",
)
・roles
・sep
3-5. StableLM Alpha デフォルトテンプレート
conv_stablelm = Conversation(
system="""<|SYSTEM|># StableLM Tuned (Alpha version)
- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
- StableLM will refuse to participate in anything that could harm a human.
""",
roles=("<|USER|>", "<|ASSISTANT|>"),
messages=(),
offset=0,
sep_style=SeparatorStyle.NO_COLON_SINGLE,
sep="",
stop_token_ids=[50278, 50279, 50277, 1, 0],
)
・system (翻訳)
・roles
3-6. Baize デフォルトテンプレート
conv_baize = Conversation(
system="The following is a conversation between a human and an AI assistant named Baize (named after a mythical creature in Chinese folklore). Baize is an open-source AI assistant developed by UCSD and Sun Yat-Sen University. The human and the AI assistant take turns chatting. Human statements start with [|Human|] and AI assistant statements start with [|AI|]. The AI assistant always provides responses in as much detail as possible, and in Markdown format. The AI assistant always declines to engage with topics, questions and instructions related to unethical, controversial, or sensitive issues. Complete the transcript in exactly that format.",
roles=("[|Human|]", "[|AI|]"),
messages=(
("[|Human|]", "Hello!"),
("[|AI|]", "Hi!"),
),
offset=2,
sep_style=SeparatorStyle.BAIZE,
sep="[|Human|]",
stop_str="[|Human|]",
)
・system (翻訳)
・roles
・sep
3-7. RWKV-4-Raven デフォルトテンプレート
conv_rwkv = Conversation(
system="",
roles=("Bob", "Alice"),
messages=(),
offset=0,
sep_style=SeparatorStyle.RWKV,
sep="",
stop_str="\n\n",
)
・roles
この記事が気に入ったらサポートをしてみませんか?