背景
ファインチューニングモデルの性能 = 70% データ構造設計 + 20% データ品質 + 10% トレーニングパラメータ
この記事は「データ構造設計」にのみ焦点を当てます。
高品質SFTデータの5つのレベル
- Level 1 基本的なQ&A
- Level 2 システムプロンプト
- Level 3 思考の連鎖 (CoT)
- Level 4 多段対話
- Level 5 ツール / RAG
分析
Level 1 基本的なQ&A
基礎的な応答能力であり、誤答や推論の不足がある
{
"messages":[
{"role":"user","content":"What is XAI?"},
{"role":"assistant","content":"XAI is the process..."}
]
}
Level 2 システムプロンプト
systemが追加され、モデルに役割行動を学習させ人格を形成させる
{
"messages":[
{
"role":"system",
"content":"You are a professional biology teacher."
},
{
"role":"user",
"content":"Explain photosynthesis"
},
{
"role":"assistant",
"content":"Photosynthesis is..."
}
]
}
Level 3 思考の連鎖 (CoT)
推論能力の向上
{
"messages":[
{"role":"user","content":"If I have 20 apples and give away 7, how many remain?"},
{"role":"assistant","content":
"Let's think step by step.\n
1. Start with 20 apples\n
2. Give away 7 apples\n
3. 20 - 7 = 13\n
Therefore, 13 apples remain."
}
]
}
Level 4 多段対話
実際の会話は多段のやり取りであり、モデルはコンテキストの記憶と連続推論を学習する
{
"messages":[
{"role":"system","content":"You are a math tutor."},
{"role":"user","content":"What is 12 * 8?"},
{"role":"assistant","content":"12 × 8 = 96."},
{"role":"user","content":"What about 96 ÷ 3?"},
{"role":"assistant","content":"96 ÷ 3 = 32."}
]
}
Level 5 ツール / RAG
モデルはユーザーの質問に応じてツールの選択、API呼び出し、応答返却を学習する
{
"messages":[
{"role":"user","content":"What's the weather in Tokyo?"},
{
"role":"assistant",
"content":"I will check the weather API.",
"tool_call":{
"name":"get_weather",
"arguments":{"city":"Tokyo"}
}
},
{
"role":"tool",
"content":"Temperature: 20°C"
},
{
"role":"assistant",
"content":"The temperature in Tokyo is 20°C."
}
]
}
モデルはコンテキストを読み込む
{
"messages":[
{
"role":"system",
"content":"Use the provided context to answer."
},
{
"role":"user",
"content":"Context: Tokyo is the capital of Japan.\nQuestion: What is the capital of Japan?"
},
{
"role":"assistant",
"content":"The capital of Japan is Tokyo."
}
]
}
推奨される高品質SFTデータ構造例
{
"messages":[
{"role":"system","content":"You are a helpful AI."},
{"role":"user","content":"Calculate 25 * 14"},
{"role":"assistant","content":
"Let's solve step by step.\n
25 × 14 = (25 × 10) + (25 × 4)\n
= 250 + 100\n
= 350\n
Therefore the answer is 350."
}
]
}