

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 蒸留用トレーニングデータセットを準備する
<a name="distillation-prepare-datasets"></a>

モデルカスタムジョブを開始する前に、最低限のトレーニングデータセットを必要があります。カスタムモデルの入力データセットを準備するには、各行がレコードに対応する JSON オブジェクトである `.jsonl` ファイルを作成します。作成するファイルは、選択したモデルの蒸留とモデルの形式に準拠する必要があります。また、ファイル内のレコードがサイズ要件を満たしている必要があります。

入力データをプロンプトとして指定します。Amazon Bedrock は入力データを使用して教師モデルからのレスポンスを生成し、生成されたレスポンスを使用して生徒モデルをファインチューニングします。Amazon Bedrock が使用する入力の詳細と、ユースケースに最適なオプションの選択については、「[Amazon Bedrock Model Distillation の仕組み](model-distillation.md#how-md-works)」を参照してください。入力データセットを準備するには、いくつかのオプションがあります。

**注記**  
Amazon Nova モデルには、蒸留に関するさまざまな要件があります。詳細については、「[Amazon Nova モデルの蒸留](https://docs.aws.amazon.com/nova/latest/userguide/customize-distill.html)」を参照してください。

## 蒸留でサポートされているモダリティ
<a name="distillation-supported-modalities"></a>

「[Amazon Bedrock Model Distillation でサポートされているモデルとリージョン](prequisites-model-distillation.md#model-distillation-supported)」にリストされているモデルがサポートするのは、text-to-text モダリティのみです。

## 合成データ生成の入力プロンプトを最適化する
<a name="distillation-data-prep-prompt-optimization"></a>

モデルの蒸留中に、Amazon Bedrock は合成データセットを生成します。このデータセットは、特定のユースケースに合わせて生徒モデルをファインチューニングするために使用されます。詳細については、「[Amazon Bedrock Model Distillation の仕組み](model-distillation.md#how-md-works)」を参照してください。

入力プロンプトを必要なユースケースに合わせて整形することで、合成データ生成プロセスを最適化できます。例えば、蒸留モデルのユースケースが検索拡張生成 (RAG) の場合、プロントで使用する形式は、エージェントユースケースに重点を置くモデルの場合とは異なります。

以下は、RAG またはエージェントのユースケースに合わせて入力プロンプトをフォーマットする方法の例です。

------
#### [ RAG prompt example ]

```
{
  "schemaVersion": "bedrock-conversation-2024",
  "system": [
    {
      "text": "You are a financial analyst charged with answering questions about 10K and 10Q SEC filings. Given the context below, answer the following question."
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "text": "<context>\nDocument 1: Multiple legal actions have been filed against us as a result of the October 29, 2018 accident of Lion Air Flight 610 and the March 10, 2019 accident of Ethiopian Airlines Flight 302.\n</context>\n\n<question>Has Boeing reported any materially important ongoing legal battles from FY2022?</question>"
        }
      ]
    }
  ]
}
```

------
#### [ Agent prompt example ]

```
{
    "schemaVersion": "bedrock-conversation-2024",
    "system": [
        {
            "text": 'You are an expert in composing functions. You are given a question and a set of possible functions. Based on the question, you will need to make one or more function/tool calls to achieve the purpose.
                    Here is a list of functions in JSON format that you can invoke.
                    [
                        {
                            "name": "lookup_weather",
                            "description: "Lookup weather to a specific location",
                            "parameters": {
                                "type": "dict",
                                "required": [
                                    "city"
                                ],
                                "properties": {
                                    "location": {
                                        "type": "string",
                                    },
                                    "date": {
                                        "type": "string",
                                    }
                                }
                            }
                        }
                    ]'
        }
    ],
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "text": "What's the weather tomorrow?"
                }
            ]
        },
        {
            "role": "assistant",
            "content": [
               {
                   "text": "[lookup_weather(location=\"san francisco\", date=\"tomorrow\")]"
               }
            ]
        }
    ]
}
```

------