

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 准备用于蒸馏的训练数据集
<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)中列出的模型仅支持文本转文本模态。

## 优化合成数据生成的输入提示
<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\")]"
               }
            ]
        }
    ]
}
```

------