

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 準備訓練資料集以進行蒸餾
<a name="distillation-prepare-datasets"></a>

在開始模型自訂任務之前，您需要至少準備訓練資料集。若要為自訂模型準備輸入資料集，您可以建立 `.jsonl` 檔案，其中每一行都是與記錄對應的 JSON 物件。您建立的檔案必須符合模型蒸餾和您選擇的模型格式。其中的記錄也必須符合大小要求。

提供輸入資料作為提示。Amazon Bedrock 會使用輸入資料從教師模型產生回應，並使用這些產生的回應來微調學生模型。如需詳細資訊，以便了解 Amazon Bedrock 使用的輸入，以及選擇最適合使用案例的選項，請參閱[Amazon Bedrock 模型蒸餾功能如何運作](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 模型蒸餾功能支援的模型和區域](prequisites-model-distillation.md#model-distillation-supported) 中列出的模型僅支援 text-to-text 模式。

## 最佳化輸入提示以產生合成資料
<a name="distillation-data-prep-prompt-optimization"></a>

在模型蒸餾期間，Amazon Bedrock 會產生合成資料集，用於針對特定使用案例微調學生模型。如需詳細資訊，請參閱[Amazon Bedrock 模型蒸餾功能如何運作](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\")]"
               }
            ]
        }
    ]
}
```

------