

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

# 使用監督式微調微調Amazon Nova模型
<a name="nova-2-sft-data-prep"></a>

Amazon Nova 2.0 SFT 資料使用與 1.0 Amazon Nova 相同的 Converse API 格式，並新增選用的推理內容欄位。如需完整的格式規格，請參閱 [ReasoningContentBlock](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ReasoningContentBlock.html) 和 [Converse API 結構描述](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-call.html)。

**支援的功能：**
+ **輸入類型** – 使用者內容區塊中的文字、影像或影片
+ **助理內容** – 純文字回應和推理內容
+ **資料集合成** – 必須是同質的。選擇下列其中一項：純文字轉彎、文字 \$1 影像轉彎，或文字 \$1 影片轉彎

**重要**  
您無法在相同資料集內或不同回合之間混合影像和影片。

**目前的限制：**
+ **工具用量** – 雖然輸入格式支援工具用量，但 2.0 SFT Amazon Nova 目前不支援。新增工具區段可能會導致您的任務失敗。
+ **多模態推理內容** – 雖然 Converse 格式支援以影像為基礎的推理內容，但 Amazon Nova 2.0 SFT 不支援。
+ **驗證集** – 可透過 UI 支援提供驗證集，但在 SFT 訓練期間不支援。

**支援的媒體格式：**
+ **影像** – PNG、JPEG、GIF
+ **影片** – MOV、MKV、MP4

## 資料格式範例
<a name="nova-2-sft-data-examples"></a>

------
#### [ Text-only ]

此範例顯示與 Amazon Nova1.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 ]

此範例顯示具有 2.0 Amazon Nova 選用推理內容的文字。

```
{
  "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 \$1 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 \$1 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"
        }
      ]
    }
  ]
}
```

------

## 推理內容
<a name="nova-2-reasoning-modes"></a>

合理的內容 （也稱為chain-of-thought) 會在產生最終答案之前擷取模型的中繼思考步驟。`assistant` 然後，使用 `reasoningContent` 欄位來包含這些推理追蹤。

**如何計算損失：**
+ **使用推理內容** – 訓練損失包括推理權杖和最終輸出權杖
+ **沒有推理內容** – 僅根據最終輸出權杖計算訓練損失

**啟用推理模式的時機：**當您希望模型在產生最終輸出之前產生思維權杖，或需要在複雜推理任務上改善效能時，請在訓練組態`reasoning_enabled: true`中設定 。當您針對無法從明確推理步驟中受益的直接任務進行訓練`reasoning_enabled: false`時，請設定 。

**注意**  
無論您的訓練資料是否包含推理內容，都可以啟用推理模式。不過，建議在訓練資料中包含推理追蹤，讓模型可以從這些範例中學習，並改善推理品質。

**格式化準則：**
+ 使用純文字來推理內容。
+ 避免標記標籤，例如 `<thinking>`和 ，`</thinking>`除非您的任務特別要求。
+ 確保推理內容清晰且與問題解決程序相關。

**有效的推理內容應包括：**
+ 中繼想法和分析
+ 邏輯扣除和推論步驟
+ Step-by-step解決問題的方法
+ 步驟和結論之間的明確連線

如果您的資料集缺少推理追蹤，您可以使用像 Nova Premier 這樣的推理能力模型來建立它們。將輸入輸出對提供給模型，並擷取其推理程序，以建置推理擴增資料集。

## 資料集準備準則
<a name="nova-2-dataset-preparation"></a>

下表提供準備訓練資料集的指導方針。


**資料集準備準則**  

| 準則 | Description | 
| --- | --- | 
| 大小和品質 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/nova-2-sft-data-prep.html)  | 
| 多樣性 |  包含執行下列動作的多樣化範例： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/nova-2-sft-data-prep.html)  | 
| 輸出格式 |  在助理回應中明確指定所需的輸出格式。範例包括您應用程式特有的 JSON 結構、資料表、CSV 格式或自訂格式。  | 
| 多回合對話 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/nova-2-sft-data-prep.html)  | 
| 品質檢查清單 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/nova-2-sft-data-prep.html)  | 