本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
在 2.0 上Amazon Nova进行有监督的微调
概述
Amazon Nova2.0 SFT 数据使用与 Amazon Nova 1.0 相同的 Converse API 格式,但增加了可选的推理内容字段。有关完整的格式规范,请参阅ReasoningContentBlock和 Converse API 架构。
支持的功能
您不能在同一个数据集中或在不同的回合中混合图像和视频。
目前的局限性
工具用法-尽管输入格式支持使用工具,但 Amazon Nova 2.0 SFT 目前不支持使用工具。添加工具部分可能会导致您的任务失败。
多模态推理内容 — 尽管 Converse 格式支持基于图像的推理内容,但 2.0 SFT 不支持此内容。Amazon Nova
验证集-用户界面可能支持提供验证集,但在 SFT 训练期间不支持提供验证集。
图片 — PNG、JPEG、GIF
视频 — MOV、MKV、 MP4
数据格式示例
- Text-only
-
此示例显示了与 Amazon Nova 1.0 兼容的基本纯文本格式。
{
"schemaVersion": "bedrock-conversation-2024",
"system": [
{
"text": "You are a digital assistant with a friendly personality"
}
],
"messages": [
{
"role": "user",
"content": [
{
"text": "What country is right next to Australia?"
}
]
},
{
"role": "assistant",
"content": [
{
"text": "The closest country is New Zealand"
}
]
}
]
}
- Text with reasoning
-
此示例显示了带有 Amazon Nova 2.0 可选推理内容的文本。
{
"schemaVersion": "bedrock-conversation-2024",
"system": [
{
"text": "You are a digital assistant with a friendly personality"
}
],
"messages": [
{
"role": "user",
"content": [
{
"text": "What country is right next to Australia?"
}
]
},
{
"role": "assistant",
"content": [
{
"reasoningContent": {
"reasoningText": {
"text": "I need to use my world knowledge of geography to answer this question"
}
}
},
{
"text": "The closest country to Australia is New Zealand, located to the southeast across the Tasman Sea."
}
]
}
]
}
当前,内部reasoningText仅支持reasoningContent。多模态推理内容尚不可用。
- Image + text
-
此示例说明如何在文本中包含图像输入。
{
"schemaVersion": "bedrock-conversation-2024",
"system": [
{
"text": "You are a helpful assistant."
}
],
"messages": [
{
"role": "user",
"content": [
{
"image": {
"format": "jpeg",
"source": {
"s3Location": {
"uri": "s3://your-bucket/your-path/your-image.jpg",
"bucketOwner": "your-aws-account-id"
}
}
}
},
{
"text": "Which country is highlighted in the image?"
}
]
},
{
"role": "assistant",
"content": [
{
"reasoningContent": {
"reasoningText": {
"text": "I will determine the highlighted country by examining its location on the map and using my geographical knowledge"
}
}
},
{
"text": "The highlighted country is New Zealand"
}
]
}
]
}
- Video + text
-
此示例说明如何在文本中加入视频输入。
{
"schemaVersion": "bedrock-conversation-2024",
"system": [
{
"text": "You are a helpful assistant."
}
],
"messages": [
{
"role": "user",
"content": [
{
"video": {
"format": "mp4",
"source": {
"s3Location": {
"uri": "s3://your-bucket/your-path/your-video.mp4",
"bucketOwner": "your-aws-account-id"
}
}
}
},
{
"text": "What is shown in this video?"
}
]
},
{
"role": "assistant",
"content": [
{
"reasoningContent": {
"reasoningText": {
"text": "I will analyze the video content to identify key elements"
}
}
},
{
"text": "The video shows a map with New Zealand highlighted"
}
]
}
]
}
推理和非推理模式
理解推理内容:推理内容(也称为 chain-of-thought)在生成最终答案之前捕捉模型的中间思维步骤。assistant反过来,使用该reasoningContent字段来包含这些推理痕迹。
损失是如何计算的:
你可以在多回合对话中加入reasoningContent多个助手回合。
何时启用推理模式
如果您希望模型reasoning_enabled: true在生成最终输出之前生成思维标记,或者需要提高复杂推理任务的性能,请在训练配置中进行设置。
无论您的训练数据是否包含推理内容,您都可以启用推理模式。但是,建议在训练数据中加入推理轨迹,这样模型就可以从这些示例中吸取教训并提高推理质量。
reasoning_enabled: false当你在训练那些无法从明确的推理步骤中受益或想要优化速度并减少代币使用量的简单任务时进行设置。
生成推理数据
如果您的数据集缺少推理轨迹,则可以使用具有推理功能的模型来创建推理轨迹,例如。向模型提供您的输入输出对,并捕获其推理过程以构建推理增强数据集。
使用推理代币进行训练
在启用推理模式的情况下训练时,模型会学会将内部推理与最终答案分开。训练过程执行以下操作:
有效的推理内容
高质量的推理内容应包括以下内容:
中间思考和分析
逻辑推断和推理步骤
Step-by-step 解决问题的方法
步骤和结论之间的明确联系
这有助于模型培养在回答之前思考的能力。
数据集准备指南
下表提供了准备训练数据集的指南。
数据集准备指南
| 指南 |
说明 |
| 尺寸和质量 |
建议大小:2,000-10,000 个样本 最低样本数:200 优先考虑质量而不是数量。确保示例准确且注释良好。 数据集应密切反映您的生产用例。
|
| 多样性 |
包括执行以下操作的不同示例:
涵盖预期输入的全部范围 代表不同的难度等级 包括边缘案例和变体 防止过度拟合到狭窄的图案
|
| 输出格式 |
在助手响应中明确指定所需的输出格式。示例包括 JSON 结构、表格、CSV 格式或特定于您的应用程序的自定义格式。
|
| 多回合对话 |
损失仅在助手回合中计算,不计算用户回合。 每个助手回复的格式都应正确。 在对话回合中保持一致性。
|
| 质量清单 |
|