Nova 2.0의 SFT - Amazon SageMaker AI

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

Nova 2.0의 SFT

Amazon Nova Lite 2.0은 고급 추론 모드, 향상된 멀티모달 이해, 확장된 컨텍스트 처리 등 지도 미세 조정을 위한 향상된 기능을 제공합니다. Nova 2.0의 SFT를 사용하면 복잡한 작업에서 모델의 우수한 성능을 유지하면서 이러한 강력한 기능을 특정 사용 사례에 적용할 수 있습니다.

Nova 2.0 기반 SFT의 주요 기능은 다음과 같습니다.

  • 추론 모드 지원: 향상된 분석 기능에 대한 최종 답변 전에 명시적 추론 트레이스를 생성하도록 모델을 훈련합니다.

  • 고급 멀티모달 훈련: 향상된 정확도로 문서 이해(PDF), 비디오 이해 및 이미지 기반 작업을 미세 조정합니다.

  • 도구 호출 기능: 복잡한 워크플로에 대한 외부 도구 및 함수 호출을 효과적으로 사용하도록 모델을 훈련합니다.

  • 확장된 컨텍스트 지원: 문서 집약적인 애플리케이션의 안정성과 정확성을 높여 더 긴 컨텍스트 기간을 활용합니다.

추론 모드 선택(Nova 2.0만 해당)

Amazon Nova 2.0은 향상된 분석 기능을 위한 추론 모드를 지원합니다.

  • 추론 모드(활성화):

    • 훈련 구성reasoning_enabled: true에서 설정

    • 최종 답변 전에 추론 트레이스를 생성하도록 모델 훈련

    • 복잡한 추론 작업의 성능을 개선합니다.

  • 비합리적 모드(비활성화됨):

    • 파라미터 설정 reasoning_enabled: false 또는 생략(기본값)

    • 명시적 추론이 없는 표준 SFT

    • step-by-step 추론의 이점을 얻지 못하는 작업에 적합

참고
  • 추론이 활성화되면 높은 추론 노력으로 작동합니다. SFT에는 낮은 추론 옵션이 없습니다.

  • SFT에는 멀티모달 추론 콘텐츠가 지원되지 않습니다. 추론 모드는 텍스트 전용 입력에 적용됩니다.

를 사용하여 이유 없는 데이터 세트에 대해 Amazon Nova를 훈련하는 reasoning_enabled: true 것은 허용됩니다. 그러나 Amazon Nova는 주로 추론을 적용하지 않고 데이터에 표시된 응답을 생성하는 방법을 배우기 때문에 모델이 추론 기능을 상실할 수 있습니다.

비합리적 데이터 세트에 대해 Amazon Nova를 훈련하지만 추론 중에 추론을 계속 사용하려는 경우:

  1. 훈련 중 추론 비활성화(reasoning_enabled: false)

  2. 추론 중 나중에 추론 활성화

이 접근 방식은 추론 시간에 추론을 허용하지만 추론 없이 추론에 비해 성능이 향상되지는 않습니다.

모범 사례: 추론 데이터 세트를 사용할 때 훈련 및 추론 모두에 대한 추론을 활성화하고 비합리적 데이터 세트를 사용할 때 둘 다에 대해 추론을 비활성화합니다.

데이터 형식을 호출하는 도구

SFT는 도구를 사용하기 위한 훈련 모델(함수 호출)을 지원합니다. 다음은 도구 호출을 위한 샘플 입력 형식입니다.

샘플 입력:

{ "schemaVersion": "bedrock-conversation-2024", "system": [ { "text": "You are an expert in composing function calls." } ], "toolConfig": { "tools": [ { "toolSpec": { "name": "getItemCost", "description": "Retrieve the cost of an item from the catalog", "inputSchema": { "json": { "type": "object", "properties": { "item_name": { "type": "string", "description": "The name of the item to retrieve cost for" }, "item_id": { "type": "string", "description": "The ASIN of item to retrieve cost for" } }, "required": [ "item_id" ] } } } }, { "toolSpec": { "name": "getItemAvailability", "description": "Retrieve whether an item is available in a given location", "inputSchema": { "json": { "type": "object", "properties": { "zipcode": { "type": "string", "description": "The zipcode of the location to check in" }, "quantity": { "type": "integer", "description": "The number of items to check availability for" }, "item_id": { "type": "string", "description": "The ASIN of item to check availability for" } }, "required": [ "item_id", "zipcode" ] } } } } ] }, "messages": [ { "role": "user", "content": [ { "text": "I need to check whether there are twenty pieces of the following item available. Here is the item ASIN on Amazon: id-123. Please check for the zipcode 94086" } ] }, { "role": "assistant", "content": [ { "reasoningContent": { "reasoningText": { "text": "The user wants to check how many pieces of the item with ASIN id-123 are available in the zipcode 94086" } } }, { "toolUse": { "toolUseId": "getItemAvailability_0", "name": "getItemAvailability", "input": { "zipcode": "94086", "quantity": 20, "item_id": "id-123" } } } ] }, { "role": "user", "content": [ { "toolResult": { "toolUseId": "getItemAvailability_0", "content": [ { "text": "[{\"name\": \"getItemAvailability\", \"results\": {\"availability\": true}}]" } ] } } ] }, { "role": "assistant", "content": [ { "text": "Yes, there are twenty pieces of item id-123 available at 94086. Would you like to place an order or know the total cost?" } ] } ] }

도구 호출 데이터에 대한 중요 고려 사항:

  • ToolUse는 어시스턴트 턴에만 표시되어야 합니다.

  • ToolResult는 사용자 교대에만 표시되어야 합니다.

  • ToolResult는 텍스트 또는 JSON 전용이어야 합니다. 다른 형식은 현재 Amazon Nova 모델에서 지원되지 않습니다.

  • toolSpec 내의 inputSchema는 유효한 JSON 스키마 객체여야 합니다.

  • 각 ToolResult는 이전 어시스턴트 ToolUse에서 유효한 toolUseId를 참조해야 하며, 각 toolUseId는 대화당 정확히 한 번 사용됩니다. ToolUse

데이터 형식 이해 문서화

SFT는 문서 이해 작업에 대한 모델 훈련을 지원합니다. 다음은 샘플 입력 형식입니다.

샘플 입력

{ "schemaVersion": "bedrock-conversation-2024", "messages": [ { "role": "user", "content": [ { "text": "What are the ways in which a customer can experience issues during checkout on Amazon?" }, { "document": { "format": "pdf", "source": { "s3Location": { "uri": "s3://my-bucket-name/path/to/documents/customer_service_debugging.pdf", "bucketOwner": "123456789012" } } } } ] }, { "role": "assistant", "content": [ { "text": "Customers can experience issues with 1. Data entry, 2. Payment methods, 3. Connectivity while placing the order. Which one would you like to dive into?" } ], "reasoning_content": [ { "text": "I need to find the relevant section in the document to answer the question.", "type": "text" } ] } ] }

문서 이해를 위한 중요 고려 사항:

  • PDF 파일만 지원됩니다.

  • 최대 문서 크기는 10MB입니다.

  • 샘플에는 문서와 텍스트가 포함될 수 있지만 문서를 다른 양식(예: 이미지 또는 비디오)과 혼합할 수는 없습니다.

SFT용 비디오 이해

SFT는 비디오 이해 작업을 위한 모델 미세 조정을 지원합니다. 다음은 샘플 입력 형식입니다.

샘플 입력

{ "schemaVersion": "bedrock-conversation-2024", "messages": [ { "role": "user", "content": [ { "text": "What are the ways in which a customer can experience issues during checkout on Amazon?" }, { "video": { "format": "mp4", "source": { "s3Location": { "uri": "s3://my-bucket-name/path/to/videos/customer_service_debugging.mp4", "bucketOwner": "123456789012" } } } } ] }, { "role": "assistant", "content": [ { "text": "Customers can experience issues with 1. Data entry, 2. Payment methods, 3. Connectivity while placing the order. Which one would you like to dive into?" } ], "reasoning_content": [ { "text": "I need to find the relevant section in the video to answer the question.", "type": "text" } ] } ] }

비디오 이해를 위한 중요 고려 사항:

  • 비디오는 최대 50MB일 수 있습니다.

  • 비디오 길이는 최대 15분입니다.

  • 샘플당 하나의 비디오만 허용되며 동일한 샘플의 여러 비디오는 지원되지 않습니다.

  • 샘플에는 비디오와 텍스트가 포함될 수 있지만 비디오를 다른 양식(예: 이미지 또는 문서)과 혼합할 수는 없습니다.

데이터 업로드 지침

훈련 및 검증 데이터 세트를 S3 버킷에 업로드합니다. 레시피의 run 블록에서 다음 위치를 지정합니다.

## Run config run: ... data_s3_path: "s3://<bucket-name>/<training-directory>/<training-file>.jsonl"

참고: <bucket-name>, <training-directory>, <training-file>, 및 <validation-directory>를 실제 S3 경로<validation-file>로 바꿉니다.

참고: Amazon Nova 2.0을 사용하는 SFT에는 현재 검증 데이터 세트가 지원되지 않습니다. 검증 데이터 세트가 제공되면 무시됩니다.

미세 조정 작업 생성

run 블록의 model_typemodel_name_or_path 필드를 사용하여 기본 모델을 정의합니다.

## Run config run: ... model_type: amazon.nova-2-lite-v1:0:256k model_name_or_path: nova-lite-2/prod ...

하이퍼파라미터 지침

훈련 접근 방식에 따라 다음과 같은 권장 하이퍼파라미터를 사용합니다.

전체 순위 훈련

  • 에포크: 1

  • 학습률(lr): 1e-5

  • 최소 학습률(min_lr): 1e-6

LoRA(낮은 순위 적응)

  • 에포크: 2

  • 학습률(lr): 5e-5

  • 최소 학습률(min_lr): 1e-6

참고: 데이터 세트 크기 및 검증 성능에 따라 이러한 값을 조정합니다. 훈련 지표를 모니터링하여 과적합을 방지합니다.