

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

# Amazon SageMaker AI를 사용하여 모델 사용자 지정
<a name="customize-model"></a>

Amazon SageMaker AI 모델 사용자 지정은 AI 모델을 사용자 지정하는 기존의 복잡하고 시간이 많이 걸리는 프로세스를 몇 달 동안의 노력에서 며칠 만에 완료할 수 있는 간소화된 워크플로로 변환하는 기능입니다. 이 기능은 고도로 차별화된 고객 경험을 생성하기 위해 독점 데이터로 파운데이션 모델을 사용자 지정해야 하는 AI 개발자가 직면한 중요한 문제를 해결합니다. step-by-step 가이드 및 고급 구성 옵션을 포함한 자세한 사용자 지정 설명서는이 SageMaker AI 가이드에 나와 있습니다. Nova 모델 사용자 지정에 대한 간략한 개요는 Amazon Nova 사용 설명서의 [ SageMaker로 사용자 지정 및 미세 조정](https://docs.aws.amazon.com/nova/latest/userguide/customize-fine-tune-sagemaker.html)을 참조하세요.

이 기능에는 컴퓨팅 리소스 관리의 운영 오버헤드를 없애는 서버리스 인프라로 구동되는 포괄적인 고급 모델 사용자 지정 기술 제품군과 함께 자연어 요구 사항을 이해하는 새로운 가이드 사용자 인터페이스가 포함되어 있습니다. 법률 연구 애플리케이션을 구축하든, 고객 서비스 챗봇을 개선하든, 도메인별 AI 에이전트를 개발하든이 기능은 proof-of-concept에서 프로덕션 배포까지 경로를 가속화합니다.

Amazon Bedrock Evaluations로 구동되는 모델 사용자 지정의 기능은 처리를 위해 지리 AWS 리전 내에서 데이터를 안전하게 전송할 수 있습니다. 자세한 내용은 [Amazon Bedrock Evaluations 설명서를](https://docs.aws.amazon.com/bedrock/latest/userguide/evaluation-judge.html) 참조하세요.

## 주요 개념
<a name="model-customize-concepts"></a>

**서버리스 훈련**

모든 인프라 복잡성을 추상화하여 모델 개발에 전적으로 집중할 수 있는 완전관리형 컴퓨팅 인프라입니다. 여기에는 모델 크기 및 훈련 요구 사항에 따른 GPU 인스턴스(P5, P4de, P4d, G5)의 자동 프로비저닝, 각 사용자 지정 기법에 대한 모범 사례를 통합하는 사전 최적화된 훈련 레시피, UI를 통해 액세스할 수 있는 라이브 지표 및 로그를 사용한 실시간 모니터링, 비용 최적화를 위한 훈련 완료 후 리소스의 자동 정리가 포함됩니다.

**모델 사용자 지정 기법**

지도 미세 조정(SFT), 직접 선호도 최적화(DPO), 검증 가능한 보상을 통한 강화 학습(RLVR), AI 피드백을 통한 강화 학습(RLAIF)을 포함한 포괄적인 고급 방법 세트입니다.

**사용자 지정 모델**

자체 데이터로 훈련하여 특정 사용 사례에 맞게 조정된 기본 파운데이션 모델의 특수 버전은 원래 파운데이션 모델의 일반적인 기능을 유지하면서 요구 사항에 맞는 도메인별 지식, 용어, 스타일 또는 동작을 추가하는 AI 모델을 생성합니다.

**AI 모델 사용자 지정 자산**

모델 사용자 지정 프로세스 중에 사용자 지정 모델을 훈련, 개선 및 평가하는 데 사용되는 리소스 및 아티팩트입니다. 이러한 자산에는 **데이터 세트**, 훈련 예제 모음(프롬프트-응답 페어, 도메인별 텍스트 또는 레이블이 지정된 데이터)를 사용하여 파운데이션 모델을 미세 조정하여 특정 동작을 학습합니다. 지식, 또는 스타일 및 **평가자**, 보상 ***함수***(특정 기준에 따라 모델 출력을 채점하는 코드 기반 로직, RLVR 훈련 및 사용자 지정 득점자 평가에 사용) 또는 ***보상 프롬프트***(LLM이 모델 응답의 품질을 판단하도록 안내하는 자연어 지침, RLAIF 훈련 및 LLM-as-a-judge 평가에 사용됨).

**모델 패키지 그룹**

훈련 작업에서 로깅된 모든 모델을 추적하여 모델 버전 및 계보에 대한 중앙 위치를 제공하는 수집 컨테이너입니다.

**로깅된 모델**

서버리스 훈련 작업을 실행할 때 SageMaker AI에서 생성한 출력입니다. 이는 미세 조정된 모델(성공적인 작업), 체크포인트(포인트가 있는 실패한 작업) 또는 연결된 메타데이터(포인트가 없는 실패한 작업)일 수 있습니다.

**등록된 모델**

공식 추적 및 거버넌스 목적으로 표시된 로깅된 모델로, 전체 계보 및 수명 주기 관리를 지원합니다.

**계보**

는 SageMaker AI 및 Amazon Bedrock 전반에서 훈련 작업, 입력 데이터세트, 출력 모델, 평가 작업 및 배포 간의 관계를 자동으로 캡처했습니다.

**교차 계정 공유**

전체 계보 가시성을 유지하면서 Resource Access Manager(RAM)를 사용하여 AWS AWS 계정 간에 모델, 데이터 세트 및 평가자를 공유하는 기능입니다.

# Amazon SageMaker AI에서 Amazon Nova 모델 사용자 지정
<a name="nova-model"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova [1.0 사용 설명서 또는 Amazon Nova 2.0 사용](https://docs.aws.amazon.com//nova/latest/userguide/nova-model.html) 설명서의 Amazon SageMaker AI에서 Amazon Nova 모델 사용자 지정을 참조하세요. [https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model.html](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model.html) 

# Amazon Nova 레시피
<a name="nova-model-recipes"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova [1.0 사용 설명서 또는 Amazon Nova ](https://docs.aws.amazon.com//nova/latest/userguide/nova-model-recipes.html)[2.0 사용 설명서의 Amazon Nova](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model-recipes.html) 레시피를 참조하세요.

# SageMaker 훈련 작업에 대한 Amazon Nova 사용자 지정
<a name="nova-model-training-job"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova [1.0 사용 설명서 또는 Amazon Nova 2.0 사용](https://docs.aws.amazon.com//nova/latest/userguide/nova-model-training-job.html) 설명서의 SageMaker 훈련 작업에 대한 Amazon Nova 사용자 지정을 참조하세요. [https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model-training-job.html](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model-training-job.html) 

**Topics**
+ [

# Amazon Nova 증류
](nova-distillation.md)
+ [

# Nova 사용자 지정 SDK
](nova-customization-sdk.md)
+ [

# SageMaker 훈련 작업을 사용하여 Amazon Nova 모델 미세 조정
](nova-fine-tuning-training-job.md)
+ [

# 여러 반복에서 진행 상황 모니터링
](nova-model-monitor.md)
+ [

# SageMaker AI로 훈련된 모델 평가
](nova-model-evaluation.md)

# Amazon Nova 증류
<a name="nova-distillation"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova [1.0 사용 설명서의 Amazon Nova](https://docs.aws.amazon.com//nova/latest/userguide/nova-distillation.html) distillation을 참조하세요.

# Nova 사용자 지정 SDK
<a name="nova-customization-sdk"></a>

Amazon Nova Customization SDK는 훈련 및 평가부터 배포 및 추론에 이르기까지 전체 수명 주기에 걸쳐 Amazon Nova 모델을 사용자 지정하기 위한 포괄적인 Python SDK입니다.

이 주제가 이동되었습니다. 최신 정보는 [Amazon Nova 1.0 사용 설명서 또는 Amazon Nova ](https://docs.aws.amazon.com//nova/latest/userguide/nova-customization-sdk.html)[2.0 사용 설명서의 Nova](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-customization-sdk.html) Customization SDK를 참조하세요.

# SageMaker 훈련 작업을 사용하여 Amazon Nova 모델 미세 조정
<a name="nova-fine-tuning-training-job"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova [1.0 사용 설명서 또는 Amazon Nova 2.0 사용](https://docs.aws.amazon.com//nova/latest/userguide/nova-fine-tune-1.html) 설명서의 SageMaker 훈련 작업을 사용하여 Amazon Nova 모델 미세 조정을 참조하세요. [https://docs.aws.amazon.com//nova/latest/nova2-userguide/smtj-training.html](https://docs.aws.amazon.com//nova/latest/nova2-userguide/smtj-training.html) 

# 여러 반복에서 진행 상황 모니터링
<a name="nova-model-monitor"></a>

이 주제가 이동되었습니다. 최신 정보는 [Amazon Nova 1.0 사용 설명서](https://docs.aws.amazon.com//nova/latest/userguide/nova-model-monitor.html) 또는 [Amazon Nova 2](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model-monitor.html).0 사용 설명서의 반복 진행 상황 모니터링을 참조하세요.

# SageMaker AI로 훈련된 모델 평가
<a name="nova-model-evaluation"></a>

이 주제가 이동되었습니다. 최신 정보는 [Amazon Nova 1.0 사용 설명서 또는 Amazon Nova 2.0 사용](https://docs.aws.amazon.com//nova/latest/userguide/nova-model-evaluation.html) 설명서의 SageMaker AI 훈련 모델 평가를 참조하세요. [https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model-evaluation.html](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model-evaluation.html) 

# Amazon SageMaker HyperPod에서 Amazon Nova 사용자 지정
<a name="nova-hp"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova [1.0 사용 설명서 또는 Amazon Nova 2.0 사용](https://docs.aws.amazon.com//nova/latest/userguide/nova-hp.html) 설명서의 Amazon SageMaker HyperPod에서 Amazon Nova 사용자 지정을 참조하세요. [https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-hp.html](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-hp.html) 

# Nova 사용자 지정 SDK
<a name="nova-hp-customization-sdk"></a>

이 주제가 이동되었습니다. 최신 정보는 [Amazon Nova 1.0 사용 설명서 또는 Amazon Nova ](https://docs.aws.amazon.com//nova/latest/userguide/nova-hp-customization-sdk.html)[2.0 사용 설명서의 Nova](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-hp-customization-sdk.html) Customization SDK를 참조하세요.

# Amazon HyperPod 필수 명령 가이드
<a name="nova-hp-essential-commands-guide"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova 1.0 사용 설명서의 SageMaker HyperPod 필수 명령 가이드 또는 [Amazon Nova 2.0 사용 설명서를](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-hp-essential-commands-guide.html) 참조하세요. [https://docs.aws.amazon.com//nova/latest/userguide/nova-hp-essential-commands-guide.html](https://docs.aws.amazon.com//nova/latest/userguide/nova-hp-essential-commands-guide.html) 

# 제한된 인스턴스 그룹(RIG)을 포함하는 HyperPod EKS 클러스터 생성
<a name="nova-hp-cluster"></a>

이 주제가 이동되었습니다. 최신 정보는 [Amazon Nova 1.0 사용 설명서 또는 Amazon Nova 2.0 사용](https://docs.aws.amazon.com//nova/latest/userguide/nova-hp-cluster.html) 설명서의 RIG를 사용하여 SageMaker HyperPod EKS 클러스터 생성을 참조하세요. [https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-hp-cluster.html](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-hp-cluster.html) 

# SageMaker AI HyperPod에 대한 Nova Forge 액세스 및 설정
<a name="nova-forge-hp-access"></a>

이 주제가 이동되었습니다. 최신 정보는 [Amazon Nova 1.0 사용 설명서 또는 Amazon Nova 2.0 사용](https://docs.aws.amazon.com//nova/latest/userguide/nova-forge-hp-access.html) 설명서의 SageMaker AI HyperPod에 대한 Nova Forge 액세스 및 설정을 참조하세요. [https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-forge-hp-access.html](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-forge-hp-access.html) 

# Amazon Nova 모델에 대한 훈련
<a name="nova-hp-training"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova [1.0 사용 설명서 또는 Amazon Nova ](https://docs.aws.amazon.com//nova/latest/userguide/nova-hp-training.html)[2.0 사용 설명서의 Amazon Nova](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-hp-training.html) 모델 훈련을 참조하세요.

# Amazon SageMaker HyperPod에서 Amazon Nova 모델 미세 조정 HyperPod
<a name="nova-hp-fine-tune"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova 1.0 사용 설명서의 Amazon SageMaker HyperPod에서 Amazon Nova 모델 미세 조정을 참조하세요. [https://docs.aws.amazon.com//nova/latest/userguide/nova-hp-fine-tune.html](https://docs.aws.amazon.com//nova/latest/userguide/nova-hp-fine-tune.html) 

# 훈련된 모델 평가
<a name="nova-hp-evaluate"></a>

이 주제가 이동되었습니다. 최신 정보는 [Amazon Nova 1.0 사용 설명서](https://docs.aws.amazon.com//nova/latest/userguide/nova-hp-evaluate.html) 또는 [Amazon Nova 2.0 사용 설명서](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-hp-evaluate.html)의 훈련된 모델 평가를 참조하세요.

# 반복 훈련
<a name="nova-iterative-training"></a>

반복 훈련을 사용하면 여러 훈련 주기를 통해 모델 성능을 개선하고 이전 체크포인트를 기반으로 장애 모드를 체계적으로 해결하고 변화하는 요구 사항에 적응할 수 있습니다.

이 주제가 이동되었습니다. 최신 정보는 [Amazon Nova 1.0 사용 설명서](https://docs.aws.amazon.com//nova/latest/userguide/nova-iterative-training.html)의 반복 훈련 또는 [Amazon Nova 2.0 사용 설명서를](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-iterative-training.html) 참조하세요.

# Amazon Bedrock 추론
<a name="nova-model-bedrock-inference"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon [Nova 1.0 사용 설명서 또는 Amazon](https://docs.aws.amazon.com//nova/latest/userguide/nova-model-bedrock-inference.html) [Nova 2.0 사용 설명서의 Amazon](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model-bedrock-inference.html) Bedrock 추론을 참조하세요.

# Amazon Nova 모델 사용자 지정의 제한 사항
<a name="nova-model-limitations"></a>

이 주제가 이동되었습니다. 최신 정보는 Amazon Nova [2.0 사용 설명서의 Amazon Nova](https://docs.aws.amazon.com//nova/latest/nova2-userguide/nova-model-limitations.html) 모델 사용자 지정 제한 사항을 참조하세요.

# 개방형 가중치 모델 사용자 지정
<a name="model-customize-open-weight"></a>

이 섹션에서는 개방형 가중치 모델 사용자 지정을 시작하는 프로세스를 안내합니다.

**Topics**
+ [

# 사전 조건
](model-customize-open-weight-prereq.md)
+ [

# UI에서 모델 사용자 지정을 위한 자산 생성
](model-customize-open-weight-create-assets-ui.md)
+ [

# AI 모델 사용자 지정 작업 제출
](model-customize-open-weight-job.md)
+ [

# 모델 평가 작업 제출
](model-customize-open-weight-evaluation.md)
+ [

# 모델 배포
](model-customize-open-weight-deployment.md)
+ [

# 샘플 데이터 세트 및 평가자
](model-customize-open-weight-samples.md)

# 사전 조건
<a name="model-customize-open-weight-prereq"></a>

시작하기 전에 다음 필수 조건을 완료합니다.
+ Studio 액세스 권한이 있는 SageMaker AI 도메인에 온보딩합니다. Studio를 도메인의 기본 환경으로 설정할 권한이 없는 경우 관리자에게 문의하세요. 자세한 내용은 [Amazon SageMaker AI 도메인 개요를](https://docs.aws.amazon.com/sagemaker/latest/dg/gs-studio-onboard.html) 참조하세요.
+ 현재 버전 설치의 단계에 AWS CLI 따라를 업데이트합니다. [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html#install-tool-bundled) 
+ 로컬 컴퓨터에서 `aws configure`를 실행하고 AWS 보안 인증을 제공하세요. 자격 AWS 증명에 대한 자세한 내용은 [AWS 자격 증명 이해 및 가져오기를 참조하세요](https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html).

## 필수 IAM 권한
<a name="model-customize-open-weight-iam"></a>

SageMaker AI 모델 사용자 지정을 수행하려면 SageMaker AI 도메인 실행에 적절한 권한을 추가해야 합니다. 이렇게 하려면 인라인 IAM 권한 정책을 생성하여 IAM 역할에 연결할 수 있습니다. 정책 추가에 대한 자세한 내용은 Identity and *AWS Access Management 사용 설명서의* [IAM 자격 증명 권한 추가 및 제거](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html)를 참조하세요.

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowNonAdminStudioActions",
            "Effect": "Allow",
            "Action": [
                "sagemaker:CreatePresignedDomainUrl",
                "sagemaker:DescribeDomain",
                "sagemaker:DescribeUserProfile",
                "sagemaker:DescribeSpace",
                "sagemaker:ListSpaces",
                "sagemaker:DescribeApp",
                "sagemaker:ListApps"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:domain/*",
                "arn:aws:sagemaker:*:*:user-profile/*",
                "arn:aws:sagemaker:*:*:app/*",
                "arn:aws:sagemaker:*:*:space/*"
             ]
        },
        {
            "Sid": "LambdaListPermissions",
            "Effect": "Allow",
            "Action": [
                "lambda:ListFunctions"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "LambdaPermissionsForRewardFunction",
            "Effect": "Allow",
            "Action": [
                "lambda:CreateFunction",
                "lambda:DeleteFunction",
                "lambda:InvokeFunction",
                "lambda:GetFunction"
            ],
            "Resource": [
                "arn:aws:lambda:*:*:function:*SageMaker*",
                "arn:aws:lambda:*:*:function:*sagemaker*",
                "arn:aws:lambda:*:*:function:*Sagemaker*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "LambdaLayerForAWSSDK",
            "Effect": "Allow",
            "Action": [
                "lambda:GetLayerVersion"
            ],
            "Resource": [
                "arn:aws:lambda:*:336392948345:layer:AWSSDK*"
            ]
        },
        {
            "Sid": "SageMakerPublicHubPermissions",
            "Effect": "Allow",
            "Action": [
                "sagemaker:ListHubContents"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:aws:hub/SageMakerPublicHub"
            ]
        },
        {
            "Sid": "SageMakerHubPermissions",
            "Effect": "Allow",
            "Action": [
                "sagemaker:ListHubs",
                "sagemaker:ListHubContents",
                "sagemaker:DescribeHubContent",
                "sagemaker:DeleteHubContent",
                "sagemaker:ListHubContentVersions",
                "sagemaker:Search"
            ],
            "Resource": [
                "*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "JumpStartAccess",
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::jumpstart*"
            ]
        },
        {
            "Sid": "ListMLFlowOperations",
            "Effect": "Allow",
            "Action": [
                "sagemaker:ListMlflowApps",
                "sagemaker:ListMlflowTrackingServers"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "MLFlowAccess",
            "Effect": "Allow",
            "Action": [
                "sagemaker:UpdateMlflowApp",
                "sagemaker:DescribeMlflowApp",
                "sagemaker:CreatePresignedMlflowAppUrl",
                "sagemaker:CallMlflowAppApi",
                "sagemaker-mlflow:*"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:mlflow-app/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "BYODataSetS3Access",
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::*SageMaker*",
                "arn:aws:s3:::*Sagemaker*",
                "arn:aws:s3:::*sagemaker*"
            ]
        },
        {
            "Sid": "AllowHubPermissions",
            "Effect": "Allow",
            "Action": [
                "sagemaker:ImportHubContent"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:hub/*",
                "arn:aws:sagemaker:*:*:hub-content/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "PassRoleForSageMaker",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole"
            ],
            "Resource": [
                "arn:aws:iam::*:role/service-role/AmazonSageMaker-ExecutionRole-*"
            ],
            "Condition": {
                "StringEquals": {
                    "iam:PassedToService": "sagemaker.amazonaws.com",
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "PassRoleForAWSLambda",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole"
            ],
            "Resource": [
                "arn:aws:iam::*:role/service-role/AmazonSageMaker-ExecutionRole-*"
            ],
            "Condition": {
                "StringEquals": {
                    "iam:PassedToService": "lambda.amazonaws.com",
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "PassRoleForBedrock",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole"
            ],
            "Resource": [
                "arn:aws:iam::*:role/service-role/AmazonSageMaker-ExecutionRole-*"
            ],
            "Condition": {
                "StringEquals": {
                    "iam:PassedToService": "bedrock.amazonaws.com",
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "TrainingJobRun",
            "Effect": "Allow",
            "Action": [
                "sagemaker:CreateTrainingJob",
                "sagemaker:DescribeTrainingJob",
                "sagemaker:ListTrainingJobs"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:training-job/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "ModelPackageAccess",
            "Effect": "Allow",
            "Action": [
                "sagemaker:CreateModelPackage",
                "sagemaker:DescribeModelPackage",
                "sagemaker:ListModelPackages",
                "sagemaker:CreateModelPackageGroup",
                "sagemaker:DescribeModelPackageGroup",
                "sagemaker:ListModelPackageGroups",
                "sagemaker:CreateModel"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:model-package-group/*",
                "arn:aws:sagemaker:*:*:model-package/*",
                "arn:aws:sagemaker:*:*:model/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "TagsPermission",
            "Effect": "Allow",
            "Action": [
                "sagemaker:AddTags",
                "sagemaker:ListTags"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:model-package-group/*",
                "arn:aws:sagemaker:*:*:model-package/*",
                "arn:aws:sagemaker:*:*:hub/*",
                "arn:aws:sagemaker:*:*:hub-content/*",
                "arn:aws:sagemaker:*:*:training-job/*",
                "arn:aws:sagemaker:*:*:model/*",
                "arn:aws:sagemaker:*:*:endpoint/*",
                "arn:aws:sagemaker:*:*:endpoint-config/*",
                "arn:aws:sagemaker:*:*:pipeline/*",
                "arn:aws:sagemaker:*:*:inference-component/*",
                "arn:aws:sagemaker:*:*:action/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "LogAccess",
            "Effect": "Allow",
            "Action": [
                "logs:DescribeLogGroups",
                "logs:DescribeLogStreams",
                "logs:GetLogEvents"
            ],
            "Resource": [
                "arn:aws:logs:*:*:log-group*",
                "arn:aws:logs:*:*:log-group:/aws/sagemaker/TrainingJobs:log-stream:*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "BedrockDeploy",
            "Effect": "Allow",
            "Action": [
                "bedrock:CreateModelImportJob"
            ],
            "Resource": [
                "arn:aws:bedrock:*:*:*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "BedrockOperations",
            "Effect": "Allow",
            "Action": [
                "bedrock:GetModelImportJob",
                "bedrock:GetImportedModel",
                "bedrock:ListProvisionedModelThroughputs",
                "bedrock:ListCustomModelDeployments",
                "bedrock:ListCustomModels",
                "bedrock:ListModelImportJobs",
                "bedrock:GetEvaluationJob",
                "bedrock:CreateEvaluationJob", 
                "bedrock:InvokeModel"
            ],
            "Resource": [
                "arn:aws:bedrock:*:*:evaluation-job/*",
                "arn:aws:bedrock:*:*:imported-model/*",
                "arn:aws:bedrock:*:*:model-import-job/*",
                "arn:aws:bedrock:*:*:foundation-model/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "BedrockFoundationModelOperations",
            "Effect": "Allow",
            "Action": [
                "bedrock:GetFoundationModelAvailability",
                "bedrock:ListFoundationModels"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "SageMakerPipelinesAndLineage",
            "Effect": "Allow",
            "Action": [
                "sagemaker:ListActions",
                "sagemaker:ListArtifacts",
                "sagemaker:QueryLineage",
                "sagemaker:ListAssociations",
                "sagemaker:AddAssociation",
                "sagemaker:DescribeAction",
                "sagemaker:AddAssociation",
                "sagemaker:CreateAction",
                "sagemaker:CreateContext",
                "sagemaker:DescribeTrialComponent"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:artifact/*",
                "arn:aws:sagemaker:*:*:action/*",
                "arn:aws:sagemaker:*:*:context/*",
                "arn:aws:sagemaker:*:*:action/*",
                "arn:aws:sagemaker:*:*:model-package/*",
                "arn:aws:sagemaker:*:*:context/*",
                "arn:aws:sagemaker:*:*:pipeline/*",
                "arn:aws:sagemaker:*:*:experiment-trial-component/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "ListOperations",
            "Effect": "Allow",
            "Action": [
                "sagemaker:ListInferenceComponents",
                "sagemaker:ListWorkforces"
            ],
            "Resource": [
                "*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "SageMakerInference",
            "Effect": "Allow",
            "Action": [
                "sagemaker:DescribeInferenceComponent",
                "sagemaker:CreateEndpoint",
                "sagemaker:CreateEndpointConfig",
                "sagemaker:DescribeEndpoint",
                "sagemaker:DescribeEndpointConfig",
                "sagemaker:ListEndpoints"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:inference-component/*",
                "arn:aws:sagemaker:*:*:endpoint/*",
                "arn:aws:sagemaker:*:*:endpoint-config/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "SageMakerPipelines",
            "Effect": "Allow",
            "Action": [
                "sagemaker:DescribePipelineExecution",
                "sagemaker:ListPipelineExecutions",
                "sagemaker:ListPipelineExecutionSteps",
                "sagemaker:CreatePipeline",
                "sagemaker:UpdatePipeline",
                "sagemaker:StartPipelineExecution"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:pipeline/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        }
    ]
}
```

[AmazonSageMakerFullAccessPolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonSageMakerFullAccess.html)를 실행 역할에 연결한 경우이 축소된 정책을 추가할 수 있습니다.

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "LambdaListPermissions",
            "Effect": "Allow",
            "Action": [
                "lambda:ListFunctions"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "LambdaPermissionsForRewardFunction",
            "Effect": "Allow",
            "Action": [
                "lambda:CreateFunction",
                "lambda:DeleteFunction",
                "lambda:InvokeFunction",
                "lambda:GetFunction"
            ],
            "Resource": [
                "arn:aws:lambda:*:*:function:*SageMaker*",
                "arn:aws:lambda:*:*:function:*sagemaker*",
                "arn:aws:lambda:*:*:function:*Sagemaker*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "LambdaLayerForAWSSDK",
            "Effect": "Allow",
            "Action": [
                "lambda:GetLayerVersion"
            ],
            "Resource": [
                "arn:aws:lambda:*:336392948345:layer:AWSSDK*"
            ]
        },
        {
            "Sid": "S3Access",
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::*SageMaker*",
                "arn:aws:s3:::*Sagemaker*",
                "arn:aws:s3:::*sagemaker*",
                "arn:aws:s3:::jumpstart*"
            ]
        },
        {
            "Sid": "PassRoleForSageMakerAndLambdaAndBedrock",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole"
            ],
            "Resource": [
                "arn:aws:iam::*:role/service-role/AmazonSageMaker-ExecutionRole-*"
            ],
            "Condition": { 
                "StringEquals": { 
                    "iam:PassedToService": [ 
                        "lambda.amazonaws.com", 
                        "bedrock.amazonaws.com"
                     ],
                     "aws:ResourceAccount": "${aws:PrincipalAccount}" 
                 } 
            }
        },
        {
            "Sid": "BedrockDeploy",
            "Effect": "Allow",
            "Action": [
                "bedrock:CreateModelImportJob"
            ],
            "Resource": [
                "*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "BedrockOperations",
            "Effect": "Allow",
            "Action": [
                "bedrock:GetModelImportJob",
                "bedrock:GetImportedModel",
                "bedrock:ListProvisionedModelThroughputs",
                "bedrock:ListCustomModelDeployments",
                "bedrock:ListCustomModels",
                "bedrock:ListModelImportJobs",
                "bedrock:GetEvaluationJob",
                "bedrock:CreateEvaluationJob",
                "bedrock:InvokeModel"
            ],
            "Resource": [
                "arn:aws:bedrock:*:*:evaluation-job/*",
                "arn:aws:bedrock:*:*:imported-model/*",
                "arn:aws:bedrock:*:*:model-import-job/*",
                "arn:aws:bedrock:*:*:foundation-model/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceAccount": "${aws:PrincipalAccount}"
                }
            }
        },
        {
            "Sid": "BedrockFoundationModelOperations",
            "Effect": "Allow",
            "Action": [
                "bedrock:GetFoundationModelAvailability",
                "bedrock:ListFoundationModels"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```

그런 다음 **신뢰 정책 편집**을 클릭하고 다음 정책으로 바꾼 다음 **정책 업데이트를** 클릭해야 합니다.

```
{
    "Version": "2012-10-17",		 	 	                    
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                 "Service": "lambda.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        },
        {
            "Effect": "Allow",
            "Principal": {
                   "Service": "sagemaker.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        },
        {
            "Effect": "Allow",
            "Principal": {
                  "Service": "bedrock.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
```

# UI에서 모델 사용자 지정을 위한 자산 생성
<a name="model-customize-open-weight-create-assets-ui"></a>

UI에서 모델 사용자 지정에 사용할 수 있는 데이터 세트 및 평가자 자산을 생성하고 관리할 수 있습니다.

## 자산
<a name="model-customize-open-weight-assets"></a>

왼쪽 패널과 Amazon SageMaker Studio UI에서 **자산을** 선택한 다음 **데이터세트를** 선택합니다.

![\[모델 사용자 지정에 대한 액세스 권한이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-16.png)


**데이터 세트 업로드**를 선택하여 모델 사용자 지정 작업에 사용할 데이터 세트를 추가합니다. **필수 데이터 입력 형식을** 선택하면 사용할 데이터 세트 형식의 참조에 액세스할 수 있습니다.

![\[모델 사용자 지정에 대한 액세스 권한이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-15.png)


## 예측기
<a name="model-customize-open-weight-evaluators"></a>

강화 학습 사용자 지정 작업에 보상 **함수** 및 **보상 프롬프트를** 추가할 수도 있습니다.

![\[모델 사용자 지정에 대한 액세스 권한이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-14.png)


UI는 보상 함수 또는 보상 프롬프트에 필요한 형식에 대한 지침도 제공합니다.

![\[모델 사용자 지정에 대한 액세스 권한이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-13.png)


## AWS SDK를 사용한 모델 사용자 지정을 위한 자산
<a name="model-customize-open-weight-create-assets-sdk"></a>

SageMaker AI Python SDK를 사용하여 자산을 생성할 수도 있습니다. 아래 샘플 코드 조각을 참조하세요.

```
from sagemaker.ai_registry.air_constants import REWARD_FUNCTION, REWARD_PROMPT
from sagemaker.ai_registry.dataset import DataSet, CustomizationTechnique
from sagemaker.ai_registry.evaluator import Evaluator

# Creating a dataset example
dataset = DataSet.create(
            name="sdkv3-gen-ds2",
            source="s3://sample-test-bucket/datasets/training-data/jamjee-sft-ds1.jsonl", # or use local filepath as source.
            customization_technique=CustomizationTechnique.SFT
        )

# Refreshes status from hub
dataset.refresh()
pprint(dataset.__dict__)

# Creating an evaluator. Method : Lambda
evaluator = Evaluator.create(
                name = "sdk-new-rf11",
                source="arn:aws:lambda:us-west-2:<>:function:<function-name>8",
                type=REWARD_FUNCTION
        )

# Creating an evaluator. Method : Bring your own code
evaluator = Evaluator.create(
                name = "eval-lambda-test",
                source="/path_to_local/eval_lambda_1.py",
                type = REWARD_FUNCTION
        )

# Optional wait, by default we have wait = True during create call.
evaluator.wait()

evaluator.refresh()
pprint(evaluator)
```

# AI 모델 사용자 지정 작업 제출
<a name="model-customize-open-weight-job"></a>

SageMaker AI 모델 사용자 지정 기능은 왼쪽 패널의 Amazon SageMaker Studio 모델 페이지에서 액세스할 수 있습니다. 모델 사용자 지정 데이터세트 및 평가자를 생성하고 관리할 수 있는 자산 페이지를 찾을 수도 있습니다.

![\[모델 사용자 지정에 대한 액세스 권한이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-12.png)


모델 사용자 지정 작업 제출을 시작하려면 모델 옵션을 선택하여 Jumpstart 기본 모델 탭에 액세스합니다.

![\[기본 모델을 선택하는 방법을 포함하는 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-11.png)


모델 카드에서 모델 사용자 지정을 직접 클릭하거나 Meta에서 원하는 모델을 검색할 수 있습니다.

![\[모델 카드와 사용자 지정할 모델을 선택하는 방법이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-10.png)


모델 카드를 클릭하면 모델 세부 정보 페이지에 액세스하고 모델 사용자 지정을 클릭한 다음 UI로 사용자 지정을 선택하여 RLVR 작업 구성을 시작할 수 있습니다.

![\[사용자 지정 작업을 시작하는 방법을 포함하는 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-9.png)


그런 다음 사용자 지정 모델 이름을 입력하고 사용할 모델 사용자 지정 기술을 선택하고 작업 하이퍼파라미터를 구성할 수 있습니다.

![\[모델 사용자 지정 기법 선택이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-8.png)


![\[모델 사용자 지정 기법 선택이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-7.png)


## SDK를 사용한 AI 모델 사용자 지정 작업 제출
<a name="model-customize-open-weight-job-sdk"></a>

SageMaker AI Python SDK를 사용하여 모델 사용자 지정 작업을 제출할 수도 있습니다.

```
# Submit a DPO model customization job

from sagemaker.modules.train.dpo_trainer import DPOTrainer
from sagemaker.modules.train.common import TrainingType

trainer = DPOTrainer(
    model=BASE_MODEL,
    training_type=TrainingType.LORA,
    model_package_group_name=MODEL_PACKAGE_GROUP_NAME,
    training_dataset=TRAINING_DATASET,
    s3_output_path=S3_OUTPUT_PATH,
    sagemaker_session=sagemaker_session,
    role=ROLE_ARN
)
```

## 사용자 지정 작업 모니터링
<a name="model-customize-open-weight-monitor"></a>

작업을 제출한 직후 모델 사용자 지정 훈련 작업 페이지로 리디렉션됩니다.

![\[모델 사용자 지정 기법 선택이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-6.png)


작업이 완료되면 오른쪽 상단의 사용자 지정 모델로 이동 버튼을 클릭하여 **사용자 지정 모델** 세부 정보 페이지로 이동할 수 있습니다.

![\[모델 사용자 지정 기법 선택이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-5.png)


사용자 지정 모델 세부 정보 페이지에서 다음을 통해 사용자 지정 모델을 추가로 사용할 수 있습니다.

1. 성능, 생성된 아티팩트 위치, 훈련 구성 하이퍼파라미터 및 훈련 로그에 대한 정보 확인.

1. 다른 데이터 세트로 평가 작업을 시작합니다(지속적인 사용자 지정).

1. SageMaker AI 추론 엔드포인트 또는 Amazon Bedrock Custom Model Import를 사용하여 모델을 배포합니다.  
![\[모델 사용자 지정 기법 선택이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-4.png)

# 모델 평가 작업 제출
<a name="model-customize-open-weight-evaluation"></a>

이 섹션에서는 개방형 사용자 지정 모델 평가에 대해 설명합니다. 이를 통해 평가 작업 제출 프로세스를 안내할 수 있습니다. 고급 평가 작업 제출 사용 사례에 대한 추가 리소스가 제공됩니다.

**Topics**
+ [

# 시작하기
](model-customize-evaluation-getting-started.md)
+ [

# 평가 유형 및 작업 제출
](model-customize-evaluation-types.md)
+ [

# 평가 지표 형식
](model-customize-evaluation-metrics-formats.md)
+ [

# BYOD(Bring-Your-Own-Dataset) 작업에 지원되는 데이터 세트 형식
](model-customize-evaluation-dataset-formats.md)
+ [

# 프리셋 및 사용자 지정 스코어러로 평가
](model-customize-evaluation-preset-custom-scorers.md)

# 시작하기
<a name="model-customize-evaluation-getting-started"></a>

## SageMaker Studio를 통해 평가 작업 제출
<a name="model-customize-evaluation-studio"></a>

### 1단계: 모델 카드에서 평가로 이동
<a name="model-customize-evaluation-studio-step1"></a>

모델을 사용자 지정한 후 모델 카드에서 평가 페이지로 이동합니다.

개방형 사용자 지정 모델 훈련에 대한 자세한 내용은 [https://docs.aws.amazon.com/sagemaker/latest/dg/model-customize-open-weight-job.html](https://docs.aws.amazon.com/sagemaker/latest/dg/model-customize-open-weight-job.html) 참조하십시오.

SageMaker는 내 모델 탭에서 사용자 지정 모델을 시각화합니다.

![\[등록된 모델 카드 페이지\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/getting-started-registered-model-card.png)


최신 버전 보기를 선택한 다음 평가를 선택합니다.

![\[모델 사용자 지정 페이지\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/getting-started-evaluate-from-model-card.png)


### 2단계: 평가 작업 제출
<a name="model-customize-evaluation-studio-step2"></a>

제출 버튼을 선택하고 평가 작업을 제출합니다. 이렇게 하면 최소 MMLU 벤치마크 작업이 제출됩니다.

지원되는 평가 작업 유형에 대한 자세한 내용은 섹션을 참조하세요[평가 유형 및 작업 제출](model-customize-evaluation-types.md).

![\[평가 작업 제출 페이지\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/getting-started-benchmark-submission.png)


### 3단계: 평가 작업 진행 상황 추적
<a name="model-customize-evaluation-studio-step3"></a>

평가 작업 진행 상황은 평가 단계 탭에서 추적됩니다.

![\[평가 작업 진행 상황\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/getting-started-benchmark-tracking.png)


### 4단계: 평가 작업 결과 보기
<a name="model-customize-evaluation-studio-step4"></a>

평가 작업 결과는 평가 결과 탭에 시각화됩니다.

![\[평가 작업 지표\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/getting-started-benchmark-results.png)


### 5단계: 완료된 평가 보기
<a name="model-customize-evaluation-studio-step5"></a>

완료된 평가 작업은 모델 카드의 평가에 표시됩니다.

![\[완료된 평가 작업\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/getting-started-benchmark-completed-model-card.png)


## SageMaker Python SDK를 통해 평가 작업 제출
<a name="model-customize-evaluation-sdk"></a>

### 1단계: BenchMarkEvaluator 생성
<a name="model-customize-evaluation-sdk-step1"></a>

등록된 훈련된 모델, AWS S3 출력 위치 및 MLFlow 리소스 ARN을에 전달`BenchMarkEvaluator`한 다음 초기화합니다.

```
from sagemaker.train.evaluate import BenchMarkEvaluator, Benchmark  
  
evaluator = BenchMarkEvaluator(  
    benchmark=Benchmark.MMLU,  
    model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",  
    s3_output_path="s3://<bucket-name>/<prefix>/eval/",  
    mlflow_resource_arn="arn:aws:sagemaker:<region>:<account-id>:mlflow-tracking-server/<tracking-server-name>",  
    evaluate_base_model=False  
)
```

### 2단계: 평가 작업 제출
<a name="model-customize-evaluation-sdk-step2"></a>

`evaluate()` 메서드를 호출하여 평가 작업을 제출합니다.

```
execution = evaluator.evaluate()
```

### 3단계: 평가 작업 진행 상황 추적
<a name="model-customize-evaluation-sdk-step3"></a>

실행 `wait()` 메서드를 호출하여 평가 작업 진행 상황을 실시간으로 업데이트합니다.

```
execution.wait(target_status="Succeeded", poll=5, timeout=3600)
```

### 4단계: 평가 작업 결과 보기
<a name="model-customize-evaluation-sdk-step4"></a>

`show_results()` 메서드를 호출하여 평가 작업 결과를 표시합니다.

```
execution.show_results()
```

# 평가 유형 및 작업 제출
<a name="model-customize-evaluation-types"></a>

## 표준화된 데이터 세트를 사용한 벤치마킹
<a name="model-customize-evaluation-benchmarking"></a>

벤치마크 평가 유형을 사용하여 MMLU 및 BBH와 같은 인기 있는 데이터세트를 포함한 표준화된 벤치마크 데이터세트에서 모델의 품질을 평가합니다.


| 벤치마크 | 사용자 지정 데이터 세트 지원 | 모달리티 | 설명 | Metrics | 전략 | 하위 태스크 사용 가능 | 
| --- | --- | --- | --- | --- | --- | --- | 
| mmlu | 아니요 | 텍스트 | 다중 태스크 언어 이해 - 57개 주제에 걸친 지식을 테스트합니다. | 정확도 | zs\$1cot | 예 | 
| mmlu\$1pro | 아니요 | 텍스트 | MMLU - 전문 하위 세트 - 법률, 의학, 회계, 엔지니어링 등 전문 분야에 중점을 둡니다. | 정확도 | zs\$1cot | 아니요 | 
| bbh | 아니요 | 텍스트 | 고급 추론 태스크 - 높은 수준의 인지 능력과 문제 해결 능력을 테스트하는 도전적 문제의 모음입니다. | 정확도 | fs\$1cot | 예 | 
| gpqa | 아니요 | 텍스트 | 일반 물리학 질문 응답 - 물리 개념 이해와 관련 문제 해결 능력을 평가합니다. | 정확도 | zs\$1cot | 아니요 | 
| math | 아니요 | 텍스트 | 수학적 문제 해결 - 대수학, 미적분학, 문장제 문제 등 여러 주제에서 수학적 추론 능력을 측정합니다. | exact\$1match | zs\$1cot | 예 | 
| strong\$1reject | 아니요 | 텍스트 | 품질 제어 작업 - 부적절하거나 유해하거나 잘못된 콘텐츠를 감지하고 거부하는 모델의 능력을 테스트합니다. | deflection | zs | 예 | 
| ifeval | 아니요 | 텍스트 | 지침 준수 평가 - 모델이 주어진 지침을 얼마나 정확하게 따르고 요구 조건에 맞게 태스크를 완료하는지 측정합니다. | 정확도 | zs | 아니요 | 

BYOD 형식에 대한 자세한 내용은 섹션을 참조하세요[BYOD(Bring-Your-Own-Dataset) 작업에 지원되는 데이터 세트 형식](model-customize-evaluation-dataset-formats.md).

### 사용 가능한 하위 작업
<a name="model-customize-evaluation-benchmarking-subtasks"></a>

다음은 MMLU(Massive Multitask Language Understanding), BBH(Big Bench Hard), StrongReject 및 MATH를 포함한 여러 도메인에서 모델 평가에 사용할 수 있는 하위 작업을 나열합니다. 이러한 하위 태스크를 통해 모델의 특정 기능 및 지식 영역에서 성능을 평가할 수 있습니다.

**MMLU 하위 작업**

```
MMLU_SUBTASKS = [
    "abstract_algebra",
    "anatomy",
    "astronomy",
    "business_ethics",
    "clinical_knowledge",
    "college_biology",
    "college_chemistry",
    "college_computer_science",
    "college_mathematics",
    "college_medicine",
    "college_physics",
    "computer_security",
    "conceptual_physics",
    "econometrics",
    "electrical_engineering",
    "elementary_mathematics",
    "formal_logic",
    "global_facts",
    "high_school_biology",
    "high_school_chemistry",
    "high_school_computer_science",
    "high_school_european_history",
    "high_school_geography",
    "high_school_government_and_politics",
    "high_school_macroeconomics",
    "high_school_mathematics",
    "high_school_microeconomics",
    "high_school_physics",
    "high_school_psychology",
    "high_school_statistics",
    "high_school_us_history",
    "high_school_world_history",
    "human_aging",
    "human_sexuality",
    "international_law",
    "jurisprudence",
    "logical_fallacies",
    "machine_learning",
    "management",
    "marketing",
    "medical_genetics",
    "miscellaneous",
    "moral_disputes",
    "moral_scenarios",
    "nutrition",
    "philosophy",
    "prehistory",
    "professional_accounting",
    "professional_law",
    "professional_medicine",
    "professional_psychology",
    "public_relations",
    "security_studies",
    "sociology",
    "us_foreign_policy",
    "virology",
    "world_religions"
]
```

**BBH 하위 작업**

```
BBH_SUBTASKS = [
    "boolean_expressions",
    "causal_judgement",
    "date_understanding",
    "disambiguation_qa",
    "dyck_languages",
    "formal_fallacies",
    "geometric_shapes",
    "hyperbaton",
    "logical_deduction_five_objects",
    "logical_deduction_seven_objects",
    "logical_deduction_three_objects",
    "movie_recommendation",
    "multistep_arithmetic_two",
    "navigate",
    "object_counting",
    "penguins_in_a_table",
    "reasoning_about_colored_objects",
    "ruin_names",
    "salient_translation_error_detection",
    "snarks",
    "sports_understanding",
    "temporal_sequences",
    "tracking_shuffled_objects_five_objects",
    "tracking_shuffled_objects_seven_objects",
    "tracking_shuffled_objects_three_objects",
    "web_of_lies",
    "word_sorting"
]
```

**수학 하위 작업**

```
MATH_SUBTASKS = [
    "algebra", 
    "counting_and_probability", 
    "geometry",
    "intermediate_algebra", 
    "number_theory", 
    "prealgebra", 
    "precalculus"
]
```

**StrongReject 하위 작업**

```
STRONG_REJECT_SUBTASKS = [
    "gcg_transfer_harmbench", 
    "gcg_transfer_universal_attacks",
    "combination_3", 
    "combination_2", 
    "few_shot_json", 
    "dev_mode_v2",
    "dev_mode_with_rant",
    "wikipedia_with_title", 
    "distractors",
    "wikipedia",
     "style_injection_json", 
    "style_injection_short",
    "refusal_suppression", 
    "prefix_injection", 
    "distractors_negated",
    "poems", 
    "base64", 
    "base64_raw", "
    base64_input_only",
    "base64_output_only", 
    "evil_confidant", 
    "aim", 
    "rot_13",
    "disemvowel", 
    "auto_obfuscation", 
    "auto_payload_splitting", 
    "pair",
    "pap_authority_endorsement", 
    "pap_evidence_based_persuasion",
    "pap_expert_endorsement", 
    "pap_logical_appeal", 
    "pap_misrepresentation"
]
```

### 벤치마크 작업 제출
<a name="model-customize-evaluation-benchmarking-submit"></a>

------
#### [ SageMaker Studio ]

![\[SageMaker Studio를 통한 벤치마킹을 위한 최소 구성\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/benchmark-submission-sagemaker-studio.png)


------
#### [ SageMaker Python SDK ]

```
from sagemaker.train.evaluate import get_benchmarks
from sagemaker.train.evaluate import BenchMarkEvaluator

Benchmark = get_benchmarks()

# Create evaluator with MMLU benchmark
evaluator = BenchMarkEvaluator(
benchmark=Benchmark.MMLU,
model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",
s3_output_path="s3://<bucket-name>/<prefix>/",
evaluate_base_model=False
)

execution = evaluator.evaluate()
```

SageMaker Python SDK를 통한 평가 작업 제출에 대한 자세한 내용은 [https://sagemaker.readthedocs.io/en/stable/model\$1customization/evaluation.html](https://sagemaker.readthedocs.io/en/stable/model_customization/evaluation.html) 참조하세요.

------

## 판사로서의 대규모 언어 모델(LLMAJ) 평가
<a name="model-customize-evaluation-llmaj"></a>

LLM-as-a-judge(LLMAJ) 평가를 사용하여 다른 경계 모델을 활용하여 대상 모델 응답의 등급을 매깁니다. 평가 작업을 시작하기 위해 `create_evaluation_job` API를 호출하여 AWS Bedrock 모델을 판단자로 사용할 수 있습니다.

지원되는 판사 모델에 대한 자세한 내용은 [https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html) 참조하십시오.

2가지 지표 형식을 사용하여 평가를 정의할 수 있습니다.
+ **기본 제공 지표:** AWS Bedrock 기본 제공 지표를 활용하여 모델의 추론 응답 품질을 분석합니다. 자세한 내용은 [https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation-type-judge-prompt.html](https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation-type-judge-prompt.html) 참조하십시오.
+ **사용자 지정 지표:** Bedrock Evaluation 사용자 지정 지표 형식으로 사용자 지정 지표를 정의하여 자체 지침을 사용하여 모델의 추론 응답 품질을 분석합니다. 자세한 내용은 [https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation-custom-metrics-prompt-formats.html](https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation-custom-metrics-prompt-formats.html) 참조하십시오.

### 기본 제공 지표 LLMAJ 작업 제출
<a name="model-customize-evaluation-llmaj-builtin"></a>

------
#### [ SageMaker Studio ]

![\[SageMaker Studio를 통한 LLMAJ 벤치마킹을 위한 최소 구성\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/llmaj-as-judge-submission-sagemaker-studio.png)


------
#### [ SageMaker Python SDK ]

```
from sagemaker.train.evaluate import LLMAsJudgeEvaluator

evaluator = LLMAsJudgeEvaluator(
    model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",
    evaluator_model="<bedrock-judge-model-id>",
    dataset="s3://<bucket-name>/<prefix>/<dataset-file>.jsonl",
    builtin_metrics=["<builtin-metric-1>", "<builtin-metric-2>"],
    s3_output_path="s3://<bucket-name>/<prefix>/",
    evaluate_base_model=False
)

execution = evaluator.evaluate()
```

SageMaker Python SDK를 통한 평가 작업 제출에 대한 자세한 내용은 [https://sagemaker.readthedocs.io/en/stable/model\$1customization/evaluation.html](https://sagemaker.readthedocs.io/en/stable/model_customization/evaluation.html) 참조하십시오.

------

### 사용자 지정 지표 LLMAJ 작업 제출
<a name="model-customize-evaluation-llmaj-custom"></a>

사용자 지정 지표(들)를 정의합니다.

```
{
    "customMetricDefinition": {
        "name": "PositiveSentiment",
        "instructions": (
            "You are an expert evaluator. Your task is to assess if the sentiment of the response is positive. "
            "Rate the response based on whether it conveys positive sentiment, helpfulness, and constructive tone.\n\n"
            "Consider the following:\n"
            "- Does the response have a positive, encouraging tone?\n"
            "- Is the response helpful and constructive?\n"
            "- Does it avoid negative language or criticism?\n\n"
            "Rate on this scale:\n"
            "- Good: Response has positive sentiment\n"
            "- Poor: Response lacks positive sentiment\n\n"
            "Here is the actual task:\n"
            "Prompt: {{prompt}}\n"
            "Response: {{prediction}}"
        ),
        "ratingScale": [
            {"definition": "Good", "value": {"floatValue": 1}},
            {"definition": "Poor", "value": {"floatValue": 0}}
        ]
    }
}
```

자세한 내용은 [https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation-custom-metrics-prompt-formats.html](https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation-custom-metrics-prompt-formats.html) 참조하십시오.

------
#### [ SageMaker Studio ]

![\[사용자 지정 지표 > 사용자 지정 지표 추가를 통해 사용자 지정 지표 업로드\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/custom-llmaj-metrics-submission-sagemaker-studio.png)


------
#### [ SageMaker Python SDK ]

```
evaluator = LLMAsJudgeEvaluator(
    model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",
    evaluator_model="<bedrock-judge-model-id>",
    dataset="s3://<bucket-name>/<prefix>/<dataset-file>.jsonl",
    custom_metrics=custom_metric_dict = {
        "customMetricDefinition": {
            "name": "PositiveSentiment",
            "instructions": (
                "You are an expert evaluator. Your task is to assess if the sentiment of the response is positive. "
                "Rate the response based on whether it conveys positive sentiment, helpfulness, and constructive tone.\n\n"
                "Consider the following:\n"
                "- Does the response have a positive, encouraging tone?\n"
                "- Is the response helpful and constructive?\n"
                "- Does it avoid negative language or criticism?\n\n"
                "Rate on this scale:\n"
                "- Good: Response has positive sentiment\n"
                "- Poor: Response lacks positive sentiment\n\n"
                "Here is the actual task:\n"
                "Prompt: {{prompt}}\n"
                "Response: {{prediction}}"
            ),
            "ratingScale": [
                {"definition": "Good", "value": {"floatValue": 1}},
                {"definition": "Poor", "value": {"floatValue": 0}}
            ]
        }
    },
    s3_output_path="s3://<bucket-name>/<prefix>/",
    evaluate_base_model=False
)
```

------

## 사용자 지정 득점자
<a name="model-customize-evaluation-custom-scorers"></a>

자체 사용자 지정 scorer 함수를 정의하여 평가 작업을 시작합니다. 시스템은 프라임 수학과 프라임 코드라는 두 가지 기본 제공 득점자를 제공합니다. 자체 득점자 함수를 가져올 수도 있습니다. scorer 함수 코드를 직접 복사하거나 연결된 ARN을 사용하여 자체 Lambda 함수 정의를 가져올 수 있습니다. 기본적으로 두 scorer 유형 모두 F1 점수, ROUGE 및 BLEU와 같은 표준 지표를 포함하는 평가 결과를 생성합니다.

기본 제공 및 사용자 지정 득점자와 해당 요구 사항/계약에 대한 자세한 내용은 섹션을 참조하세요[프리셋 및 사용자 지정 스코어러로 평가](model-customize-evaluation-preset-custom-scorers.md).

### 데이터 세트 등록
<a name="model-customize-evaluation-custom-scorers-register-dataset"></a>

사용자 지정 득점자를 위한 자체 데이터 세트를 SageMaker Hub 콘텐츠 데이터 세트로 등록하여 가져옵니다.

------
#### [ SageMaker Studio ]

Studio에서 전용 데이터 세트 페이지를 사용하여 데이터 세트를 업로드합니다.

![\[SageMaker Studio에 등록된 평가 데이터 세트\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/dataset-registration-sagemaker-studio.png)


------
#### [ SageMaker Python SDK ]

SageMaker Python SDK에서 전용 데이터 세트 페이지를 사용하여 데이터 세트를 업로드합니다.

```
from sagemaker.ai_registry.dataset import DataSet

dataset = DataSet.create(
    name="your-bring-your-own-dataset",
    source="s3://<bucket-name>/<prefix>/<dataset-file>.jsonl"
)
dataset.refresh()
```

------

### 기본 제공 scorer 작업 제출
<a name="model-customize-evaluation-custom-scorers-builtin"></a>

------
#### [ SageMaker Studio ]

![\[기본 제공 사용자 지정 점수에 대한 코드 실행 또는 수학 답변 중에서 선택\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/builtin-scorer-submission-sagemaker-studio.png)


------
#### [ SageMaker Python SDK ]

```
from sagemaker.train.evaluate import CustomScorerEvaluator
from sagemaker.train.evaluate import get_builtin_metrics

BuiltInMetric = get_builtin_metrics()

evaluator_builtin = CustomScorerEvaluator(
    evaluator=BuiltInMetric.PRIME_MATH,
    dataset="arn:aws:sagemaker:<region>:<account-id>:hub-content/<hub-content-id>/DataSet/your-bring-your-own-dataset/<version>",
    model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",
    s3_output_path="s3://<bucket-name>/<prefix>/",
    evaluate_base_model=False
)

execution = evaluator.evaluate()
```

`BuiltInMetric.PRIME_CODE` 기본 제공 점수 평가에서 `BuiltInMetric.PRIME_MATH` 또는를 선택합니다.

------

### 사용자 지정 scorer 작업 제출
<a name="model-customize-evaluation-custom-scorers-custom"></a>

사용자 지정 보상 함수를 정의합니다. 자세한 내용은 [사용자 지정 득점자(자체 지표 가져오기)](model-customize-evaluation-preset-custom-scorers.md#model-customize-evaluation-custom-scorers-byom) 단원을 참조하십시오.

**사용자 지정 보상 함수 등록**

------
#### [ SageMaker Studio ]

![\[SageMaker Studio > 자산 > 평가자 > 평가자 생성 > 보상 함수 생성으로 이동\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/custom-scorer-submission-sagemaker-studio.png)


![\[사용자 지정 득점자 > 사용자 지정 지표에서 등록된 사전 설정 보상 함수를 참조하는 사용자 지정 득점자 평가 작업 제출\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/custom-scorer-benchmark-submission-sagemaker-studio.png)


------
#### [ SageMaker Python SDK ]

```
from sagemaker.ai_registry.evaluator import Evaluator
from sagemaker.ai_registry.air_constants import REWARD_FUNCTION

evaluator = Evaluator.create(
    name = "your-reward-function-name",
    source="/path_to_local/custom_lambda_function.py",
    type = REWARD_FUNCTION
)
```

```
evaluator = CustomScorerEvaluator(
    evaluator=evaluator,
    dataset="s3://<bucket-name>/<prefix>/<dataset-file>.jsonl",
    model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",
    s3_output_path="s3://<bucket-name>/<prefix>/",
    evaluate_base_model=False
)

execution = evaluator.evaluate()
```

------

# 평가 지표 형식
<a name="model-customize-evaluation-metrics-formats"></a>

다음 지표 형식에서 모델의 품질을 평가합니다.
+ 모델 평가 요약
+ MLFlow
+ TensorBoard

## 모델 평가 요약
<a name="model-customize-evaluation-metrics-summary"></a>

평가 작업을 제출할 때 AWS S3 출력 위치를 지정합니다. SageMaker는 평가 요약 .json 파일을 위치에 자동으로 업로드합니다. 벤치마크 요약 S3 경로는 다음과 같습니다.

```
s3://<your-provide-s3-location>/<training-job-name>/output/output/<evaluation-job-name>/eval_results/
```

** AWS S3 위치 전달**

------
#### [ SageMaker Studio ]

![\[출력 아티팩트 위치로 전달(AWS S3 URI)\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/s3-output-path-submission-sagemaker-studio.png)


------
#### [ SageMaker Python SDK ]

```
evaluator = BenchMarkEvaluator(
    benchmark=Benchmark.MMLU,
    model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",
    s3_output_path="s3://<bucket-name>/<prefix>/eval/",
    evaluate_base_model=False
)

execution = evaluator.evaluate()
```

------

`.json` AWS S3 위치에서 로 직접 읽거나 UI에서 자동으로 시각화합니다.

```
{
  "results": {
    "custom|gen_qa_gen_qa|0": {
      "rouge1": 0.9152812653966208,
      "rouge1_stderr": 0.003536439199232507,
      "rouge2": 0.774569918517409,
      "rouge2_stderr": 0.006368825746765958,
      "rougeL": 0.9111255645823356,
      "rougeL_stderr": 0.003603841524881021,
      "em": 0.6562150055991042,
      "em_stderr": 0.007948251702846893,
      "qem": 0.7522396416573348,
      "qem_stderr": 0.007224355240883467,
      "f1": 0.8428757602152095,
      "f1_stderr": 0.005186300690881584,
      "f1_score_quasi": 0.9156170336744968,
      "f1_score_quasi_stderr": 0.003667700152375464,
      "bleu": 100.00000000000004,
      "bleu_stderr": 1.464411857851008
    },
    "all": {
      "rouge1": 0.9152812653966208,
      "rouge1_stderr": 0.003536439199232507,
      "rouge2": 0.774569918517409,
      "rouge2_stderr": 0.006368825746765958,
      "rougeL": 0.9111255645823356,
      "rougeL_stderr": 0.003603841524881021,
      "em": 0.6562150055991042,
      "em_stderr": 0.007948251702846893,
      "qem": 0.7522396416573348,
      "qem_stderr": 0.007224355240883467,
      "f1": 0.8428757602152095,
      "f1_stderr": 0.005186300690881584,
      "f1_score_quasi": 0.9156170336744968,
      "f1_score_quasi_stderr": 0.003667700152375464,
      "bleu": 100.00000000000004,
      "bleu_stderr": 1.464411857851008
    }
  }
}
```

![\[SageMaker Studio에서 시각화된 사용자 지정 gen-qa 벤치마크의 샘플 성능 지표\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/gen-qa-metrics-visualization-sagemaker-studio.png)


## MLFlow 로깅
<a name="model-customize-evaluation-metrics-mlflow"></a>

**SageMaker MLFlow 리소스 ARN 제공**

SageMaker Studio는 모델 사용자 지정 기능을 처음 사용할 때 각 Studio 도메인에 프로비저닝되는 기본 MLFlow 앱을 사용합니다. SageMaker Studio는 평가 작업 제출 시 기본 MLflow 앱 관련 ARN을 사용합니다.

또한 평가 작업을 제출하고 MLFlow 리소스 ARN을 명시적으로 제공하여 실시간 분석을 위해 지표를 연결된 추적 서버/앱으로 스트리밍할 수 있습니다.

**SageMaker Python SDK**

```
evaluator = BenchMarkEvaluator(
    benchmark=Benchmark.MMLU,
    model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",
    s3_output_path="s3://<bucket-name>/<prefix>/eval/",
    mlflow_resource_arn="arn:aws:sagemaker:<region>:<account-id>:mlflow-tracking-server/<tracking-server-name>",
    evaluate_base_model=False
)

execution = evaluator.evaluate()
```

모델 수준 및 시스템 수준 지표 시각화:

![\[MMLU 벤치마킹 작업에 대한 샘플 모델 수준 오류 및 정확도\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/model-metrics-mlflow.png)


![\[LLMAJ 벤치마킹 작업에 대한 기본 제공 지표 샘플\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/llmaj-metrics-mlflow.png)


![\[MMLU 벤치마킹 작업에 대한 샘플 시스템 수준 지표\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/system-metrics-mlflow.png)


## TensorBoard
<a name="model-customize-evaluation-metrics-tensorboard"></a>

 AWS S3 출력 위치를 사용하여 평가 작업을 제출합니다. SageMaker는 TensorBoard 파일을 위치에 자동으로 업로드합니다.

SageMaker는 TensorBoard 파일을 다음 위치에 있는 AWS S3에 업로드합니다.

```
s3://<your-provide-s3-location>/<training-job-name>/output/output/<evaluation-job-name>/tensorboard_results/eval/
```

**다음과 같이 AWS S3 위치를 전달합니다.**

------
#### [ SageMaker Studio ]

![\[출력 아티팩트 위치로 전달(AWS S3 URI)\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/s3-output-path-submission-sagemaker-studio.png)


------
#### [ SageMaker Python SDK ]

```
evaluator = BenchMarkEvaluator(
    benchmark=Benchmark.MMLU,
    model="arn:aws:sagemaker:<region>:<account-id>:model-package/<model-package-name>/<version>",
    s3_output_path="s3://<bucket-name>/<prefix>/eval/",
    evaluate_base_model=False
)

execution = evaluator.evaluate()
```

------

**샘플 모델 수준 지표**

![\[벤치마킹 작업의 결과를 표시하는 SageMaker TensorBoard\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/metrics-in-tensorboard.png)


# BYOD(Bring-Your-Own-Dataset) 작업에 지원되는 데이터 세트 형식
<a name="model-customize-evaluation-dataset-formats"></a>

Custom Scorer 및 LLM-as-judge 평가 유형에는 AWS S3에 위치한 사용자 지정 데이터 세트 JSONL 파일이 필요합니다. 다음 지원되는 형식 중 하나를 준수하는 JSON Lines 파일로 파일을 제공해야 합니다. 이 문서의 예제는 명확성을 위해 확장되었습니다.

각 형식에는 고유한 뉘앙스가 있지만 최소한 모두 사용자 프롬프트가 필요합니다.


**필수 필드**  

| Field | 필수 | 
| --- | --- | 
| 사용자 프롬프트 | 예 | 
| 시스템 프롬프트 | 아니요 | 
| 실측 정보 | 사용자 지정 Scorer에만 해당 | 
| 카테고리 | 아니요 | 

**1: OpenAI 형식**

```
{
    "messages": [
        {
            "role": "system",    # System prompt (looks for system role)
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",       # Query (looks for user role)
            "content": "Hello!"
        },
        {
            "role": "assistant",  # Ground truth (looks for assistant role)
            "content": "Hello to you!"
        }
    ]
}
```

**2. SageMaker 평가**

```
{
   "system":"You are an English major with top marks in class who likes to give minimal word responses: ",
   "query":"What is the symbol that ends the sentence as a question",
   "response":"?", # Ground truth
   "category": "Grammar"
}
```

**3. HuggingFace 프롬프트 완료**

표준 형식과 대화 형식이 모두 지원됩니다.

```
# Standard

{
    "prompt" : "What is the symbol that ends the sentence as a question", # Query
    "completion" : "?" # Ground truth
}

# Conversational
{
    "prompt": [
        {
            "role": "user", # Query (looks for user role)
            "content": "What is the symbol that ends the sentence as a question"
        }
    ],
    "completion": [
        {
            "role": "assistant", # Ground truth (looks for assistant role)
            "content": "?"
        }
    ]
}
```

**4. HuggingFace 기본 설정**

표준 형식(문자열)과 대화 형식(메시지 배열)을 모두 지원합니다.

```
# Standard: {"prompt": "text", "chosen": "text", "rejected": "text"}
{
     "prompt" : "The sky is", # Query
     "chosen" : "blue", # Ground truth
     "rejected" : "green"
}

# Conversational:
{
    "prompt": [
        {
            "role": "user", # Query (looks for user role)
            "content": "What color is the sky?"
        }
    ],
    "chosen": [
        {
            "role": "assistant", # Ground truth (looks for assistant role)
            "content": "It is blue."
        }
    ],
    "rejected": [
        {
            "role": "assistant",
            "content": "It is green."
        }
    ]
}
```

**5. Verl 형식**

Verl 형식(현재 및 레거시 형식 모두)은 강화 학습 사용 사례에 지원됩니다. 참조용 Verl 문서: [https://verl.readthedocs.io/en/latest/preparation/prepare\$1data.html](https://verl.readthedocs.io/en/latest/preparation/prepare_data.html)

VERL 형식의 사용자는 일반적으로 실제 응답을 제공하지 않습니다. 어쨌든 제공하려면 `extra_info.answer` 또는 필드 중 하나를 사용합니다. `reward_model.ground_truth``extra_info`가 우선합니다.

SageMaker는 다음 VERL 관련 필드가 있는 경우 메타데이터로 보존합니다.
+ `id`
+ `data_source`
+ `ability`
+ `reward_model`
+ `extra_info`
+ `attributes`
+ `difficulty`

```
# Newest VERL format where `prompt` is an array of messages.
{
  "data_source": "openai/gsm8k",
  "prompt": [
    {
      "content": "You are a helpful math tutor who explains solutions to questions step-by-step.",
      "role": "system"
    },
    {
      "content": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May? Let's think step by step and output the final answer after \"####\".",
      "role": "user"
    }
  ],
  "ability": "math",
  "extra_info": {
    "answer": "Natalia sold 48/2 = <<48/2=24>>24 clips in May.\nNatalia sold 48+24 = <<48+24=72>>72 clips altogether in April and May.\n#### 72",
    "index": 0,
    "question": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?",
    "split": "train"
  },
  "reward_model": {
    "ground_truth": "72" # Ignored in favor of extra_info.answer
  }
}

# Legacy VERL format where `prompt` is a string. Also supported.
{
  "data_source": "openai/gsm8k",
  "prompt": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May? Let's think step by step and output the final answer after \"####\".",
  "extra_info": {
    "answer": "Natalia sold 48/2 = <<48/2=24>>24 clips in May.\nNatalia sold 48+24 = <<48+24=72>>72 clips altogether in April and May.\n#### 72",
    "index": 0,
    "question": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?",
    "split": "train"
  }
}
```

# 프리셋 및 사용자 지정 스코어러로 평가
<a name="model-customize-evaluation-preset-custom-scorers"></a>

사용자 지정 득점자 평가 유형을 사용하는 경우 SageMaker Evaluation은 [volcengine/verl](https://github.com/volcengine/verl) RL 훈련 라이브러리에서 가져온 두 개의 기본 제공 득점자('보상 함수'라고도 함) 프라임 수학 및 프라임 코드 또는 Lambda 함수로 구현된 사용자 지정 득점자를 지원합니다.

## 기본 제공 Scorer
<a name="model-customize-evaluation-builtin-scorers"></a>

**프라임 수학**

프라임 수학 채점자는 수학 질문을 프롬프트/쿼리로 포함하고 올바른 답변을 실측 정보로 포함하는 사용자 지정 JSONL 항목 데이터 세트를 기대합니다. 데이터 세트는에 언급된 지원되는 형식 중 하나일 수 있습니다[BYOD(Bring-Your-Own-Dataset) 작업에 지원되는 데이터 세트 형식](model-customize-evaluation-dataset-formats.md).

예제 데이터 세트 항목(명확성을 위해 확장됨):

```
{
    "system":"You are a math expert: ",
    "query":"How many vertical asymptotes does the graph of $y=\\frac{2}{x^2+x-6}$ have?",
    "response":"2" # Ground truth aka correct answer
}
```

**프라임 코드**

프라임 코드 득점자는 `metadata` 필드에 지정된 코딩 문제 및 테스트 사례를 포함하는 항목의 사용자 지정 JSONL 데이터 세트를 기대합니다. 테스트 사례를 각 항목의 예상 함수 이름, 샘플 입력 및 예상 출력으로 구성합니다.

예제 데이터 세트 항목(명확성을 위해 확장됨):

```
{
    "system":"\\nWhen tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.\\n\\n[ASSESS]\\n\\n[ADVANCE]\\n\\n[VERIFY]\\n\\n[SIMPLIFY]\\n\\n[SYNTHESIZE]\\n\\n[PIVOT]\\n\\n[OUTPUT]\\n\\nYou should strictly follow the format below:\\n\\n[ACTION NAME]\\n\\n# Your action step 1\\n\\n# Your action step 2\\n\\n# Your action step 3\\n\\n...\\n\\nNext action: [NEXT ACTION NAME]\\n\\n",
    "query":"A number N is called a factorial number if it is the factorial of a positive integer. For example, the first few factorial numbers are 1, 2, 6, 24, 120,\\nGiven a number N, the task is to return the list/vector of the factorial numbers smaller than or equal to N.\\nExample 1:\\nInput: N = 3\\nOutput: 1 2\\nExplanation: The first factorial number is \\n1 which is less than equal to N. The second \\nnumber is 2 which is less than equal to N,\\nbut the third factorial number is 6 which \\nis greater than N. So we print only 1 and 2.\\nExample 2:\\nInput: N = 6\\nOutput: 1 2 6\\nExplanation: The first three factorial \\nnumbers are less than equal to N but \\nthe fourth factorial number 24 is \\ngreater than N. So we print only first \\nthree factorial numbers.\\nYour Task:  \\nYou don't need to read input or print anything. Your task is to complete the function factorialNumbers() which takes an integer N as an input parameter and return the list/vector of the factorial numbers smaller than or equal to N.\\nExpected Time Complexity: O(K), Where K is the number of factorial numbers.\\nExpected Auxiliary Space: O(1)\\nConstraints:\\n1<=N<=10^{18}\\n\\nWrite Python code to solve the problem. Present the code in \\n```python\\nYour code\\n```\\nat the end.",
    "response": "", # Dummy string for ground truth. Provide a value if you want NLP metrics like ROUGE, BLEU, and F1.
    ### Define test cases in metadata field
    "metadata": {
        "fn_name": "factorialNumbers",
        "inputs": ["5"],
        "outputs": ["[1, 2]"]
    }
}
```

## 사용자 지정 득점자(자체 지표 가져오기)
<a name="model-customize-evaluation-custom-scorers-byom"></a>

필요에 맞는 사용자 지정 지표를 계산할 수 있는 사용자 지정 사후 처리 로직을 사용하여 모델 평가 워크플로를 완전히 사용자 지정할 수 있습니다. 사용자 지정 득점자를 모델 응답을 수락하고 보상 점수를 반환하는 AWS Lambda 함수로 구현해야 합니다.

### 샘플 Lambda 입력 페이로드
<a name="model-customize-evaluation-custom-scorers-lambda-input"></a>

사용자 지정 AWS Lambda는 OpenAI 형식의 입력을 예상합니다. 예제:

```
{
    "id": "123",
    "messages": [
        {
            "role": "user",
            "content": "Do you have a dedicated security team?"
        },
        {
            "role": "assistant",
            "content": "As an AI developed by Amazon, I do not have a dedicated security team..."
        }
    ],
    "reference_answer": {
        "compliant": "No",
        "explanation": "As an AI developed by Company, I do not have a traditional security team..."
    }
}
```

### 샘플 Lambda 출력 페이로드
<a name="model-customize-evaluation-custom-scorers-lambda-output"></a>

SageMaker 평가 컨테이너는 Lambda 응답이 다음 형식을 따를 것으로 예상합니다.

```
{
    "id": str,                              # Same id as input sample
    "aggregate_reward_score": float,        # Overall score for the sample
    "metrics_list": [                       # OPTIONAL: Component scores
        {
            "name": str,                    # Name of the component score
            "value": float,                 # Value of the component score
            "type": str                     # "Reward" or "Metric"
        }
    ]
}
```

### 사용자 지정 Lambda 정의
<a name="model-customize-evaluation-custom-scorers-lambda-definition"></a>

샘플 입력 및 예상 출력이 있는 완전히 구현된 사용자 지정 득점자의 예는 [https://docs.aws.amazon.com/sagemaker/latest/dg/nova-implementing-reward-functions.html\$1nova-reward-llm-judge-example](https://docs.aws.amazon.com/sagemaker/latest/dg/nova-implementing-reward-functions.html#nova-reward-llm-judge-example) 찾을 수 있습니다.

다음 스켈레톤을 자체 함수의 시작점으로 사용합니다.

```
def lambda_handler(event, context):
    return lambda_grader(event)

def lambda_grader(samples: list[dict]) -> list[dict]:
    """
    Args:
        Samples: List of dictionaries in OpenAI format
            
        Example input:
        {
            "id": "123",
            "messages": [
                {
                    "role": "user",
                    "content": "Do you have a dedicated security team?"
                },
                {
                    "role": "assistant",
                    "content": "As an AI developed by Company, I do not have a dedicated security team..."
                }
            ],
            # This section is the same as your training dataset
            "reference_answer": {
                "compliant": "No",
                "explanation": "As an AI developed by Company, I do not have a traditional security team..."
            }
        }
        
    Returns:
        List of dictionaries with reward scores:
        {
            "id": str,                              # Same id as input sample
            "aggregate_reward_score": float,        # Overall score for the sample
            "metrics_list": [                       # OPTIONAL: Component scores
                {
                    "name": str,                    # Name of the component score
                    "value": float,                 # Value of the component score
                    "type": str                     # "Reward" or "Metric"
                }
            ]
        }
    """
```

### 입력 및 출력 필드
<a name="model-customize-evaluation-custom-scorers-fields"></a>

**입력 필드**


| 필드 | 설명 | 추가 참고 사항 | 
| --- | --- | --- | 
| id | 샘플의 고유 식별자 | 출력에서 다시 에코됩니다. 문자열 형식 | 
| messages | OpenAI 형식으로 정렬된 채팅 기록 | 메시지 객체 배열 | 
| messages[].role | 메시지 화자 | 공통 값: "user", "assistant", "system" | 
| messages[].content | 메시지의 텍스트 콘텐츠 | 일반 문자열 | 
| metadata | 그레이딩에 도움이 되는 자유 형식 정보 | 객체, 훈련 데이터에서 전달되는 선택적 필드 | 

**출력 필드**


**출력 필드**  

| 필드 | 설명 | 추가 참고 사항 | 
| --- | --- | --- | 
| id | 입력 샘플과 동일한 식별자 | 입력과 일치해야 합니다. | 
| aggregate\$1reward\$1score | 샘플의 전체 점수 | 부동 소수점(예: 0.0\$11.0 또는 작업 정의 범위) | 
| metrics\$1list | 집계를 구성하는 구성 요소 점수 | 지표 객체 배열 | 

### 필수 권한
<a name="model-customize-evaluation-custom-scorers-permissions"></a>

평가를 실행하는 데 사용하는 SageMaker 실행 역할에 AWS Lambda 권한이 있는지 확인합니다.

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "lambda:InvokeFunction"
            ],
            "Resource": "arn:aws:lambda:region:account-id:function:function-name"
        }
    ]
}
```

 AWS Lambda 함수의 실행 역할에 기본 Lambda 실행 권한과 다운스트림 AWS 호출에 필요할 수 있는 추가 권한이 있는지 확인합니다.

```
{
  "Version": "2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": "arn:aws:logs:*:*:*"
    }
  ]
}
```

# 모델 배포
<a name="model-customize-open-weight-deployment"></a>

사용자 지정 모델 세부 정보 페이지에서 SageMaker AI 추론 엔드포인트 또는 Amazon Bedrock을 사용하여 사용자 지정 모델을 배포할 수도 있습니다.

![\[모델 사용자 지정 기법 선택이 포함된 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/images/screenshot-open-model-1.png)


# 샘플 데이터 세트 및 평가자
<a name="model-customize-open-weight-samples"></a>

## 감독 미세 조정(SFT)
<a name="model-customize-open-weight-samples-sft"></a>
+ 이름: TAT-QA
+ 라이선스: CC-BY-4.0
+ 링크: [https://huggingface.co/datasets/next-tat/TAT-QA](https://huggingface.co/datasets/next-tat/TAT-QA)
+ 사전 처리 - 형식 지정

**샘플 1개 **

```
{
    "prompt": "Given a table and relevant text descriptions, answer the following question.\n\nTable:\n<table border=\"1\" class=\"dataframe\">\n  <tbody>\n    <tr>\n      <td></td>\n      <td>2019</td>\n      <td>2018</td>\n    </tr>\n    <tr>\n      <td></td>\n      <td>$'000</td>\n      <td>$'000</td>\n    </tr>\n    <tr>\n      <td>Revenue from external customers</td>\n      <td></td>\n      <td></td>\n    </tr>\n    <tr>\n      <td>Australia</td>\n      <td>144,621</td>\n      <td>129,431</td>\n    </tr>\n    <tr>\n      <td>New Zealand</td>\n      <td>13,036</td>\n      <td>8,912</td>\n    </tr>\n    <tr>\n      <td>Total</td>\n      <td>157,657</td>\n      <td>138,343</td>\n    </tr>\n  </tbody>\n</table>\n\nParagraphs:\n    4. SEGMENT INFORMATION\n\n    During the 2019 and 2018 financial years, the Group operated wholly within one business segment being the operation and management of storage centres in Australia and New Zealand.\n\n    The Managing Director is the Group\u2019s chief operating decision maker and monitors the operating results on a portfolio wide basis. Monthly management reports are evaluated based upon the overall performance of NSR consistent with the presentation within the consolidated financial statements. The Group\u2019s financing (including finance costs and finance income) are managed on a Group basis and not allocated to operating segments.\n\n    The operating results presented in the statement of profit or loss represent the same segment information as reported in internal management information.\n\n    The revenue information above excludes interest income and is based on the location of storage centres.\n\nQuestion: How many business segments were present in 2019 and 2018?\n\nAnswer:",
    "completion": "one",
    "data_idx": "2951"
}
```

## 직접 선호 최적화(DPO)
<a name="model-customize-open-weight-samples-dpo"></a>
+ 이름: Ultrafeedback
+ 라이선스: MIT
+ 링크: [https://huggingface.co/datasets/openbmb/UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback)
+ 사전 처리 단계: 형식 지정 및 하위 샘플링.

**샘플 1개**

```
{
    "source": "evol_instruct",
    "prompt": "Can you write a C++ program that prompts the user to enter the name of a country and checks if it borders the Mediterranean Sea? Here's some starter code to help you out:\n#include <iostream>\n#include <string>\nusing namespace std;\nint main() {\n    string country;\n    // prompt user for input\n    cout << \"Enter the name of a country: \";\n    cin >> country;\n    // check if country borders the Mediterranean Sea\n    // [C++ code]\n    return 0;\n}",
    "chosen": "Here's a C++ program that prompts the user to enter the name of a country and checks if it borders the Mediterranean Sea:\n\n#include <iostream>\n#include <string>\n#include <set>\n#include <map>\n#include <algorithm>\n\nusing namespace std;\n\nint main() {\n    // store countries and their bordering seas in a map\n    map<string, set<string>> countries;\n    countries[\"Algeria\"] = {\"Mediterranean Sea\", \"North African Coast\"};\n    countries[\"France\"] = {\"Mediterranean Sea\", \"English Channel\"};\n    countries[\"Italy\"] = {\"Mediterranean Sea\", \"Adriatic Sea\"};\n    countries[\"Malta\"] = {\"Mediterranean Sea\", \"North African Coast\"};\n    countries[\"Spain\"] = {\"Mediterranean Sea\", \"Atlantic Ocean\"};\n    countries[\"Tunisia\"] = {\"Mediterranean Sea\", \"North African Coast\"};\n\n    string country;\n    cout << \"Enter the name of a country: \";\n    cin >> country;\n\n    // check if country is in the map\n    if (countries.find(country)!= countries.end()) {\n        // check if country borders the Mediterranean Sea\n        set<string> borders = countries.at(country);\n        if (borders.find(\"Mediterranean Sea\")!= borders.end()) {\n            cout << country << \" borders the Mediterranean Sea.\" << endl;\n        } else {\n            cout << country << \" does not border the Mediterranean Sea.\" << endl;\n        }\n    } else {\n        cout << country << \" is not a recognized country.\" << endl;\n    }\n\n    return 0;\n}\n\nIn this program, we first define a map called countries that stores each country's name as a key and a set of its surrounding seas as the value. We use a set to store each sea name so that we can easily check if a country borders a certain sea.\n\nWe then present the user with a prompt to enter the name of a country. We use a while loop to ensure that the user enters a valid country name. We check if the country is in the map, and if so, we retrieve its bordering seas from the map.\n\nFinally, we check if the Mediterranean Sea is among the set of borders. If it is, we inform the user that the country borders the Mediterranean Sea. If not, we inform the user that the country does not border the Mediterranean Sea.",
    "chosen-rating": 5.0,
    "chosen-model": "starchat",
    "rejected": "Sure, here is the program using the C++11 algorithm \"cds::algorithm::GreaterEqual\":\n#include <iostream>\n#include <string>\n#include <algorithm>\n#include <vector>\n#include <cctype>\n\nusing namespace std;\n\nint main() {\n    string country;\n    cout << \"Enter the name of a country: \";\n    cin >> country;\n    std::vector<string> vec;\n    vec.push_back(country);\n    size_t index = std::find_if(vec.begin(), vec.end(), [](const string& s) {\n        return std::any_of(s.begin(), s.end(), [](const char& c) {\n            return c == '}}';\n    });\n    if (index != vec.end()) {\n        if ((*index)[0] == 'M') {\n            cout << \"Country is bordered by the Mediterranean Sea.\" << endl;\n        } else {\n            cout << \"Country does not border the Mediterranean Sea.\" << endl;\n        }\n    } else {\n        cout << \"Country is not found.\" << endl;\n    }\n    return 0;\n}",
    "rejected-rating": 1.25,
    "rejected-model": "pythia-12b"
}
```

## AI 피드백에서 강화 학습(RLAIF) - 쌍별 판단
<a name="model-customize-open-weight-samples-rlaif"></a>

**입력 데이터 세트**

소스 데이터 세트: [https://github.com/WeOpenML/PandaLM](https://github.com/WeOpenML/PandaLM)

**샘플 1개**

```
{
    "data_source": "WeOpenML/PandaLM",
    "prompt": [
        {
            "role": "user",
            "content": "Below are two responses for a given task. The task is defined by the Instruction with an Input that provides further context. Evaluate the responses and generate a reference answer for the task.\n\n
            ### Instruction:\nCompare the given products.\n\n### Input:\niPhone 11 and Google Pixel 4\n\n
            ### Response 1:\nThe iPhone 11 has a larger screen size and a longer battery life than the Google Pixel 4.\n\n
            ### Response 2:\nThe iPhone 11 and Google Pixel 4 are both flagship smartphones released in 2018. The iPhone 11 has a 6.1-inch LCD display, while the Google Pixel 4 has a 5.7-inch OLED display. The iPhone 11 has an A13 Bionic chipset, while the Google Pixel 4 has a Qualcomm Snapdragon 845 chipset. The iPhone 11 has a dual-camera system, while the Google Pixel 4 has a single camera system. The iPhone 11 has a longer battery life, while the Google Pixel 4 has a faster processor.\n\n### Evaluation:\n"
        }
    ],
    "ability": "pairwise-judging",
    "reward_model": {
        "style": "llmj",
        "ground_truth": "2\n\n### Reason: Response 2 provides a more detailed and comprehensive comparison of the two products, including their specifications and features. Response 1 only mentions two aspects of the products and does not provide as much information.\n\n### Reference: The iPhone 11 and Google Pixel 4 are both flagship smartphones released in 2018. The iPhone 11 has a 6.1-inch LCD display, while the Google Pixel 4 has a 5.7-inch OLED display. The iPhone 11 has an A13 Bionic chipset, while the Google Pixel 4 has a Qualcomm Snapdragon 845 chipset. The iPhone 11 has a dual-camera system, while the Google Pixel 4 has a single camera system. The iPhone 11 has a longer battery life, while the Google Pixel 4 has a faster processor."
    },
    "extra_info": {
        "split": "train",
        "index": 0,
        "raw_output_sequence": "2\n\n### Reason: Response 2 provides a more detailed and comprehensive comparison of the two products, including their specifications and features. Response 1 only mentions two aspects of the products and does not provide as much information.\n\n### Reference: The iPhone 11 and Google Pixel 4 are both flagship smartphones released in 2018. The iPhone 11 has a 6.1-inch LCD display, while the Google Pixel 4 has a 5.7-inch OLED display. The iPhone 11 has an A13 Bionic chipset, while the Google Pixel 4 has a Qualcomm Snapdragon 845 chipset. The iPhone 11 has a dual-camera system, while the Google Pixel 4 has a single camera system. The iPhone 11 has a longer battery life, while the Google Pixel 4 has a faster processor.\n",
        "llmj": {
            "question": "Below are two responses for a given task. The task is defined by the Instruction with an Input that provides further context. Evaluate the responses and generate a reference answer for the task.\n\n### Instruction:\nCompare the given products.\n\n### Input:\niPhone 11 and Google Pixel 4\n\n### Response 1:\nThe iPhone 11 has a larger screen size and a longer battery life than the Google Pixel 4.\n\n### Response 2:\nThe iPhone 11 and Google Pixel 4 are both flagship smartphones released in 2018. The iPhone 11 has a 6.1-inch LCD display, while the Google Pixel 4 has a 5.7-inch OLED display. The iPhone 11 has an A13 Bionic chipset, while the Google Pixel 4 has a Qualcomm Snapdragon 845 chipset. The iPhone 11 has a dual-camera system, while the Google Pixel 4 has a single camera system. The iPhone 11 has a longer battery life, while the Google Pixel 4 has a faster processor.\n\n### Evaluation:\n",
            "ground_truth": "2\n\n### Reason: Response 2 provides a more detailed and comprehensive comparison of the two products, including their specifications and features. Response 1 only mentions two aspects of the products and does not provide as much information.\n\n### Reference: The iPhone 11 and Google Pixel 4 are both flagship smartphones released in 2018. The iPhone 11 has a 6.1-inch LCD display, while the Google Pixel 4 has a 5.7-inch OLED display. The iPhone 11 has an A13 Bionic chipset, while the Google Pixel 4 has a Qualcomm Snapdragon 845 chipset. The iPhone 11 has a dual-camera system, while the Google Pixel 4 has a single camera system. The iPhone 11 has a longer battery life, while the Google Pixel 4 has a faster processor.",
            "document_in_context": null
        },
        "sample_size": 1980
    }
}
```

## RLAIF - 사고 체인
<a name="model-customize-open-weight-samples-rlaif2"></a>

**입력 데이터 세트 **

소스 데이터: [https://huggingface.co/datasets/thesven/gsm8k-reasoning/tree/main/data](https://huggingface.co/datasets/thesven/gsm8k-reasoning/tree/main/data)

**샘플 1개**

```
{
    "data_source": "openai/gsm8k",
    "prompt": [
        {
            "role": "system",
            "content": "\nYou are an AI assistant that uses a Chain of Thought (CoT) approach with reflection to answer queries.\n\nFollow these steps:\n- Think through the problem step by step within the ‹thinking> tags.\n- Reflect on your thinking\n\nto check for any errors or improvements within the ‹reflection› tags.\n- Make any necessary adjustments based on your reflection.\n- Provide your final, concise answer within the ‹output> tags.\n\nImportant: The <thinking> and ‹reflection› sections are for your internal reasoning process only.\nDo not include any part of the final answer in these sections.\nThe actual response to the query must be entirely contained within the ‹output› tags.\n\nUse the following format for your response:\n<thinking>\n[Your initial thought process goes here]\n</thinking›\n\n<reasoning>\n[Your step-by-step reasoning goes here. This is your internal thought process, not the final answer. You can create as many reasoning steps as necessary in your process.]\n</reasoning>\n\n‹reflection>\n[Your reflection on your reasoning, checking for errors or improvements. You can create as many reflection steps as necessary in your process.]\n</ reflection>\n\n<adjustment>\n[Any adjustments to your thinking based on your reflection]\n</adjustment>\n\n<output>\n[Your final, concise answer to the query. This is the only part that will be shown to the user.]\n</output>\n"
        },
        {
            "role": "user",
            "content": "A craft store makes a third of its sales in the fabric section, a quarter of its sales in the jewelry section, and the rest in the stationery section. They made 36 sales today. How many sales were in the stationery section?"
        }
    ],
    "ability": "chain-of-thought",
    "reward_model": {
        "style": "llmj-cot",
        "ground_truth": "Thus, there were 36 - 12 - 9 = <<36-12-9=15>>15 sales in the stationery section."
    },
    "extra_info": {
        "split": "train",
        "index": 0,
        "question": "A craft store makes a third of its sales in the fabric section, a quarter of its sales in the jewelry section, and the rest in the stationery section. They made 36 sales today. How many sales were in the stationery section?",
        "short_answer": "15",
        "model_output": "<thinking>\nTo find the number of sales in the stationery section, I need to first calculate the number of sales in the fabric and jewelry sections. The store makes a third of its sales in the fabric section, which is 1/3 of 36 sales. I can calculate this as 36 * 1/3 = 12 sales in the fabric section. The store makes a quarter of its sales in the jewelry section, which is 1/4 of 36 sales. I can calculate this as 36 * 1/4 = 9 sales in the jewelry section. Since the rest of the sales are in the stationery section, I can subtract the sales from the other two sections from the total number of sales to find the number of sales in the stationery section.\n</thinking>\n\n<reasoning>\n1. Calculate the number of sales in the fabric section: 36 * 1/3 = 12\n2. Calculate the number of sales in the jewelry section: 36 * 1/4 = 9\n3. Calculate the number of sales in the stationery section: 36 - 12 - 9 = 15\n</reasoning>\n\n‹reflection>\nUpon reviewing my reasoning, I noticed that my calculations seem correct, but I should ensure that I understand the question correctly. The question asks for the number of sales in the stationery section, and I believe I have correctly calculated that. However, I should double-check my math to make sure it's accurate.\n</reflection>\n\n<adjustment>\nUpon re-examining my math, I am confident that my calculations are correct. The fabric section makes up 1/3 of the sales, the jewelry section makes up 1/4, and the rest is the stationery section. My math checks out, and I am confident in my answer.\n</adjustment>\n\n<output>\n15\n</output>"
    }
}
```

## RLAIF - 충실도
<a name="model-customize-open-weight-samples-rlaif3"></a>

**입력 데이터 세트**

소스: [https://huggingface.co/datasets/rajpurkar/squad\$1v2/blob/main/squad\$1v2/train-00000-of-00001.parquet](https://huggingface.co/datasets/rajpurkar/squad_v2/blob/main/squad_v2/train-00000-of-00001.parquet)

**샘플 1개**

```
{
    "data_source": "squad_v2",
    "prompt": [
        {
            "role": "system",
            "content": "You are a helpful assistant that answers questions based on the provided context. Only use information from the context."
        },
        {
            "role": "user",
            "content": "Context: Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group Destiny's Child. Managed by her father, Mathew Knowles, the group became one of the world's best-selling girl groups of all time. Their hiatus saw the release of Beyoncé's debut album, Dangerously in Love (2003), which established her as a solo artist worldwide, earned five Grammy Awards and featured the Billboard Hot 100 number-one singles \"Crazy in Love\" and \"Baby Boy\".\n\nQuestion: When did Beyonce start becoming popular?"
        }
    ],
    "ability": "faithfulness",
    "reward_model": {
        "style": "llmj-faithfulness",
        "ground_truth": "Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group Destiny's Child. Managed by her father, Mathew Knowles, the group became one of the world's best-selling girl groups of all time. Their hiatus saw the release of Beyoncé's debut album, Dangerously in Love (2003), which established her as a solo artist worldwide, earned five Grammy Awards and featured the Billboard Hot 100 number-one singles \"Crazy in Love\" and \"Baby Boy\"."
    },
    "extra_info": {
        "question": "When did Beyonce start becoming popular?",
        "split": "train",
        "index": 0
    }
}
```

## RLAIF - 요약
<a name="model-customize-open-weight-samples-rlaif4"></a>

**입력 데이터 세트**

소스: 정리된 gsm8k 데이터 세트 [https://huggingface.co/datasets/thesven/gsm8k-reasoning/tree/main/data](https://huggingface.co/datasets/thesven/gsm8k-reasoning/tree/main/data)

**샘플 1개**

```
{
    "data_source": "cnn_dailymail",
    "prompt": [
        {
            "role": "system",
            "content": "You are a helpful assistant that creates concise, accurate summaries of news articles. Focus on the key facts and main points."
        },
        {
            "role": "user",
            "content": "Summarize the following article:\n\nLONDON, England (Reuters) -- Harry Potter star Daniel Radcliffe gains access to a reported £20 million ($41.1 million) fortune as he turns 18 on Monday, but he insists the money won't cast a spell on him. Daniel Radcliffe as Harry Potter in \"Harry Potter and the Order of the Phoenix\" To the disappointment of gossip columnists around the world, the young actor says he has no plans to fritter his cash away on fast cars, drink and celebrity parties. \"I don't plan to be one of those people who, as soon as they turn 18, suddenly buy themselves a massive sports car collection or something similar,\" he told an Australian interviewer earlier this month. \"I don't think I'll be particularly extravagant. \"The things I like buying are things that cost about 10 pounds -- books and CDs and DVDs.\" At 18, Radcliffe will be able to gamble in a casino, buy a drink in a pub or see the horror film \"Hostel: Part II,\" currently six places below his number one movie on the UK box office chart. Details of how he'll mark his landmark birthday are under wraps. His agent and publicist had no comment on his plans. \"I'll definitely have some sort of party,\" he said in an interview. \"Hopefully none of you will be reading about it.\" Radcliffe's earnings from the first five Potter films have been held in a trust fund which he has not been able to touch. Despite his growing fame and riches, the actor says he is keeping his feet firmly on the ground. \"People are always looking to say 'kid star goes off the rails,'\" he told reporters last month. \"But I try very hard not to go that way because it would be too easy for them.\" His latest outing as the boy wizard in \"Harry Potter and the Order of the Phoenix\" is breaking records on both sides of the Atlantic and he will reprise the role in the last two films.  Watch I-Reporter give her review of Potter's latest » . There is life beyond Potter, however. The Londoner has filmed a TV movie called \"My Boy Jack,\" about author Rudyard Kipling and his son, due for release later this year. He will also appear in \"December Boys,\" an Australian film about four boys who escape an orphanage. Earlier this year, he made his stage debut playing a tortured teenager in Peter Shaffer's \"Equus.\" Meanwhile, he is braced for even closer media scrutiny now that he's legally an adult: \"I just think I'm going to be more sort of fair game,\" he told Reuters. E-mail to a friend . Copyright 2007 Reuters. All rights reserved.This material may not be published, broadcast, rewritten, or redistributed."
        }
    ],
    "ability": "summarization",
    "reward_model": {
        "style": "llmj-summarization",
        "ground_truth": "Harry Potter star Daniel Radcliffe gets £20M fortune as he turns 18 Monday .\nYoung actor says he has no plans to fritter his cash away .\nRadcliffe's earnings from first five Potter films have been held in trust fund ."
    },
    "extra_info": {
        "question": "LONDON, England (Reuters) -- Harry Potter star Daniel Radcliffe gains access to a reported £20 million ($41.1 million) fortune as he turns 18 on Monday, but he insists the money won't cast a spell on him. Daniel Radcliffe as Harry Potter in \"Harry Potter and the Order of the Phoenix\" To the disappointment of gossip columnists around the world, the young actor says he has no plans to fritter his cash away on fast cars, drink and celebrity parties. \"I don't plan to be one of those people who, as soon as they turn 18, suddenly buy themselves a massive sports car collection or something similar,\" he told an Australian interviewer earlier this month. \"I don't think I'll be particularly extravagant. \"The things I like buying are things that cost about 10 pounds -- books and CDs and DVDs.\" At 18, Radcliffe will be able to gamble in a casino, buy a drink in a pub or see the horror film \"Hostel: Part II,\" currently six places below his number one movie on the UK box office chart. Details of how he'll mark his landmark birthday are under wraps. His agent and publicist had no comment on his plans. \"I'll definitely have some sort of party,\" he said in an interview. \"Hopefully none of you will be reading about it.\" Radcliffe's earnings from the first five Potter films have been held in a trust fund which he has not been able to touch. Despite his growing fame and riches, the actor says he is keeping his feet firmly on the ground. \"People are always looking to say 'kid star goes off the rails,'\" he told reporters last month. \"But I try very hard not to go that way because it would be too easy for them.\" His latest outing as the boy wizard in \"Harry Potter and the Order of the Phoenix\" is breaking records on both sides of the Atlantic and he will reprise the role in the last two films.  Watch I-Reporter give her review of Potter's latest » . There is life beyond Potter, however. The Londoner has filmed a TV movie called \"My Boy Jack,\" about author Rudyard Kipling and his son, due for release later this year. He will also appear in \"December Boys,\" an Australian film about four boys who escape an orphanage. Earlier this year, he made his stage debut playing a tortured teenager in Peter Shaffer's \"Equus.\" Meanwhile, he is braced for even closer media scrutiny now that he's legally an adult: \"I just think I'm going to be more sort of fair game,\" he told Reuters. E-mail to a friend . Copyright 2007 Reuters. All rights reserved.This material may not be published, broadcast, rewritten, or redistributed.",
        "split": "train",
        "index": 0,
        "source_id": "42c027e4ff9730fbb3de84c1af0d2c50"
    }
}
```

## RLAIF - 사용자 지정 프롬프트
<a name="model-customize-open-weight-samples-rlaif5"></a>

이 예제에서는 [RLAIF - 사고 체인](#model-customize-open-weight-samples-rlaif2)를 사용하여 사용자 지정 jinja 프롬프트가 프리셋 프롬프트 중 하나를 대체하는 방법을 설명합니다.

**다음은 CoT에 대한 사용자 지정 프롬프트의 예입니다.**

```
You are an expert logical reasoning evaluator specializing in Chain-of-Thought (CoT) analysis. 

Given: A problem prompt and a model's reasoning-based response. 

Goal: Assess the quality and structure of logical reasoning, especially for specialized domains (law, medicine, finance, etc.).

Scoring rubric (start at 0.0, then add or subtract):

Core Components:

Structural Completeness (0.3 max)
- Clear problem statement: +0.05
- Defined variables/terminology: +0.05
- Organized given information: +0.05
- Explicit proof target: +0.05
- Step-by-step reasoning: +0.05
- Clear conclusion: +0.05

Logical Quality (0.4 max)
- Valid logical flow: +0.1
- Proper use of if-then relationships: +0.1
- Correct application of domain principles: +0.1
- No logical fallacies: +0.1

Technical Accuracy (0.3 max)
- Correct use of domain terminology: +0.1
- Accurate application of domain rules: +0.1
- Proper citation of relevant principles: +0.1

Critical Deductions:
A. Invalid logical leap: -0.3
B. Missing critical steps: -0.2
C. Incorrect domain application: -0.2
D. Unclear/ambiguous reasoning: -0.1

Additional Instructions:
- Verify domain-specific terminology and principles
- Check for logical consistency throughout
- Ensure conclusions follow from premises
- Flag potential domain-specific compliance issues
- Consider regulatory/professional standards where applicable

Return EXACTLY this JSON (no extra text):
{
    "score": <numerical score 0.0-1.0>,
    "component_scores": {
        "structural_completeness": <score>,
        "logical_quality": <score>,
        "technical_accuracy": <score>
    },
    "steps_present": {
        "problem_statement": <true/false>,
        "variable_definitions": <true/false>,
        "given_information": <true/false>,
        "proof_target": <true/false>,
        "step_reasoning": <true/false>,
        "conclusion": <true/false>
    },
    "reasoning": "<explain scoring decisions and identify any logical gaps>",
    "domain_flags": ["<any domain-specific concerns or compliance issues>"]
}

### (Prompt field from dataset)
Problem Prompt: {{ prompt }}

Model's Response: {{ model_output }}

### Ground truth (if applicable):
{{ ground_truth }}
```

## Verifiable Rewards(RLVR)의 강화 학습 - 정확한 일치
<a name="model-customize-open-weight-samples-RLVR"></a>

**입력 데이터 세트**

소스: [https://huggingface.co/datasets/openai/gsm8k](https://huggingface.co/datasets/openai/gsm8k)

**샘플**

```
{
  "data_source": "openai/gsm8k",
  "prompt": [
    {
      "content": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May? Let\'s think step by step and output the final answer after \\"####\\".",
      "role": "user"
    }
  ],
  "ability": "math",
  "reward_model": {
    "ground_truth": "72",
    "style": "rule"
  },
  "extra_info": {
    "answer": "Natalia sold 48\\/2 = <<48\\/2=24>>24 clips in May.\\nNatalia sold 48+24 = <<48+24=72>>72 clips altogether in April and May.\\n#### 72",
    "index": 0,
    "question": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?",
    "split": "train"
  }
}
```

## RLVR - 코드 실행
<a name="model-customize-open-weight-samples-RLVR2"></a>

**입력 데이터 세트**

소스: [https://huggingface.co/datasets/open-r1/codeforces](https://huggingface.co/datasets/open-r1/codeforces)

**샘플**

```
{
  "data_source": "codeforces",
  "prompt": [
    {
      "content": "\nWhen tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.\n\n[ASSESS]\n\n[ADVANCE]\n\n[VERIFY]\n\n[SIMPLIFY]\n\n[SYNTHESIZE]\n\n[PIVOT]\n\n[OUTPUT]\n\nYou should strictly follow the format below:\n\n[ACTION NAME]\n\n# Your action step 1\n\n# Your action step 2\n\n# Your action step 3\n\n...\n\nNext action: [NEXT ACTION NAME]\n\n",
      "role": "system"
    },
    {
      "content": "Title: Zebras\n\nTime Limit: None seconds\n\nMemory Limit: None megabytes\n\nProblem Description:\nOleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in it. Let us denote bad days as 0 and good days as 1. Then, for example, sequences of days 0, 010, 01010 are zebras, while sequences 1, 0110, 0101 are not.\n\nOleg tells you the story of days he lived in chronological order in form of string consisting of 0 and 1. Now you are interested if it is possible to divide Oleg's life history into several subsequences, each of which is a zebra, and the way it can be done. Each day must belong to exactly one of the subsequences. For each of the subsequences, days forming it must be ordered chronologically. Note that subsequence does not have to be a group of consecutive days.\n\nInput Specification:\nIn the only line of input data there is a non-empty string *s* consisting of characters 0 and 1, which describes the history of Oleg's life. Its length (denoted as |*s*|) does not exceed 200<=000 characters.\n\nOutput Specification:\nIf there is a way to divide history into zebra subsequences, in the first line of output you should print an integer *k* (1<=\u2264<=*k*<=\u2264<=|*s*|), the resulting number of subsequences. In the *i*-th of following *k* lines first print the integer *l**i* (1<=\u2264<=*l**i*<=\u2264<=|*s*|), which is the length of the *i*-th subsequence, and then *l**i* indices of days forming the subsequence. Indices must follow in ascending order. Days are numbered starting from 1. Each index from 1 to *n* must belong to exactly one subsequence. If there is no way to divide day history into zebra subsequences, print -1.\n\nSubsequences may be printed in any order. If there are several solutions, you may print any of them. You do not have to minimize nor maximize the value of *k*.\n\nDemo Input:\n['0010100\\n', '111\\n']\n\nDemo Output:\n['3\\n3 1 3 4\\n3 2 5 6\\n1 7\\n', '-1\\n']\n\nNote:\nnone\n\nWrite Python code to solve the problem. Present the code in \n```python\nYour code\n```\nat the end.",
      "role": "user"
    }
  ],
  "ability": "code",
  "reward_model": {
    "ground_truth": "{\"inputs\": [\"0010100\", \"111\", \"0\", \"1\", \"0101010101\", \"010100001\", \"000111000\", \"0101001000\", \"0000001000\", \"0101\", \"000101110\", \"010101010\", \"0101001010\", \"0100101100\", \"0110100000\", \"0000000000\", \"1111111111\", \"0010101100\", \"1010000\", \"0001110\", \"0000000000011001100011110101000101000010010111000100110110000011010011110110001100100001001001010010\", \"01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\", \"0010011100000000\"], \"outputs\": [\"3\\n1 1\\n5 2 3 4 5 6\\n1 7\", \"-1\", \"1\\n1 1\", \"-1\", \"-1\", \"-1\", \"3\\n3 1 6 7\\n3 2 5 8\\n3 3 4 9\", \"4\\n5 1 2 3 4 5\\n3 6 7 8\\n1 9\\n1 10\", \"8\\n1 1\\n1 2\\n1 3\\n1 4\\n1 5\\n3 6 7 8\\n1 9\\n1 10\", \"-1\", \"-1\", \"1\\n9 1 2 3 4 5 6 7 8 9\", \"2\\n5 1 2 3 4 5\\n5 6 7 8 9 10\", \"2\\n5 1 2 3 8 9\\n5 4 5 6 7 10\", \"-1\", \"10\\n1 1\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6\\n1 7\\n1 8\\n1 9\\n1 10\", \"-1\", \"2\\n3 1 8 9\\n7 2 3 4 5 6 7 10\", \"-1\", \"-1\", \"22\\n1 1\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6\\n1 7\\n1 8\\n7 9 24 25 26 27 28 29\\n7 10 13 14 17 18 23 30\\n11 11 12 15 16 19 22 31 32 33 34 35\\n3 20 21 36\\n3 37 46 47\\n9 38 39 40 45 48 57 58 75 76\\n17 41 42 43 44 49 50 51 54 55 56 59 72 73 74 77 80 81\\n9 52 53 60 71 78 79 82 83 84\\n7 61 64 65 66 67 70 85\\n5 62 63 68 69 86\\n3 87 88 89\\n3 90 91 92\\n5 93 94 95 96 97\\n3 98 99 100\", \"1\\n245 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 ...\", \"8\\n3 1 8 9\\n5 2 3 4 7 10\\n3 5 6 11\\n1 12\\n1 13\\n1 14\\n1 15\\n1 16\"]}",
    "style": "rule"
  },
  "extra_info": {
    "index": 49,
    "split": "train"
  }
}
```

**보상 함수**

보상 함수: [https://github.com/volcengine/verl/tree/main/verl/utils/reward\$1score/prime\$1code](https://github.com/volcengine/verl/tree/main/verl/utils/reward_score/prime_code)

## RLVR - 수학 답변
<a name="model-customize-open-weight-samples-RLVR3"></a>

**입력 데이터 세트**

소스: 정리된 gsm8k 데이터 세트 [https://huggingface.co/datasets/thesven/gsm8k-reasoning/tree/main/data](https://huggingface.co/datasets/thesven/gsm8k-reasoning/tree/main/data)

**샘플**

```
[
    {
        "content": "\nYou are an AI assistant that uses a Chain of Thought (CoT) approach with reflection to answer queries...",
        "role": "system"
    },
    {
        "content": "A craft store makes a third of its sales in the fabric section, a quarter of its sales in the jewelry section, and the rest in the stationery section. They made 36 sales today. How many sales were in the stationery section?",
        "role": "user"
    },
    {
        "content": "\nTo find the number of sales in the stationery section, I need to first calculate the number of sales in the fabric and jewelry sections...\n\n\n<reasoning>\n1. Calculate the number of sales in the fabric section: 36 * 1/3 = 12\n2. Calculate the number of sales in the jewelry section: 36 * 1/4 = 9\n3. Calculate the number of sales in the stationery section: 36 - 12 - 9 = 15\n</reasoning>\n\n<reflection>\nUpon reviewing my reasoning, I noticed that my calculations seem correct...\n</reflection>\n\n<adjustment>\nUpon re-examining my math, I am confident that my calculations are correct...\n</adjustment>\n\n<output>\n15\n</output>",
        "role": "assistant"
    }
]
```

**보상 계산**

보상 함수: [https://github.com/volcengine/verl/blob/main/verl/utils/reward\$1score/gsm8k.py](https://github.com/volcengine/verl/blob/main/verl/utils/reward_score/gsm8k.py)

## RLVR - 사용자 지정 Lambda
<a name="model-customize-open-weight-samples-RLVR4"></a>

**입력 데이터 세트**

소스: 정리된 gsm8k 데이터 세트 [https://huggingface.co/datasets/thesven/gsm8k-reasoning/tree/main/data](https://huggingface.co/datasets/thesven/gsm8k-reasoning/tree/main/data)

**샘플**

```
[
  {
    "content": "\nYou are an AI assistant that uses a Chain of Thought (CoT) approach with reflection to answer queries.\n\nFollow these steps:\n- Think through the problem step by step within the ‹thinking> tags.\n- Reflect on your thinking\n\nto check for any errors or improvements within the ‹reflection› tags.\n- Make any necessary adjustments based on your reflection.\n- Provide your final, concise answer within the ‹output> tags.\n\nImportant: The <thinking> and ‹reflection› sections are for your internal reasoning process only.\nDo not include any part of the final answer in these sections.\nThe actual response to the query must be entirely contained within the ‹output› tags.\n\nUse the following format for your response:\n<thinking>\n[Your initial thought process goes here]\n</thinking›\n\n<reasoning>\n[Your step-by-step reasoning goes here. This is your internal thought process, not the final answer. You can create as many reasoning steps as necessary in your process.]\n</reasoning>\n\n‹reflection>\n[Your reflection on your reasoning, checking for errors or improvements. You can create as many reflection steps as necessary in your process.]\n</ reflection>\n\n<adjustment>\n[Any adjustments to your thinking based on your reflection]\n</adjustment>\n\n<output>\n[Your final, concise answer to the query. This is the only part that will be shown to the user.]\n</output>\n",
    "role": "system"
  },
  {
    "content": "A craft store makes a third of its sales in the fabric section, a quarter of its sales in the jewelry section, and the rest in the stationery section. They made 36 sales today. How many sales were in the stationery section?",
    "role": "user"
  },
  {
    "content": "<thinking>\nTo find the number of sales in the stationery section, I need to first calculate the number of sales in the fabric and jewelry sections. The store makes a third of its sales in the fabric section, which is 1/3 of 36 sales. I can calculate this as 36 * 1/3 = 12 sales in the fabric section. The store makes a quarter of its sales in the jewelry section, which is 1/4 of 36 sales. I can calculate this as 36 * 1/4 = 9 sales in the jewelry section. Since the rest of the sales are in the stationery section, I can subtract the sales from the other two sections from the total number of sales to find the number of sales in the stationery section.\n</thinking>\n\n<reasoning>\n1. Calculate the number of sales in the fabric section: 36 * 1/3 = 12\n2. Calculate the number of sales in the jewelry section: 36 * 1/4 = 9\n3. Calculate the number of sales in the stationery section: 36 - 12 - 9 = 15\n</reasoning>\n\n‹reflection>\nUpon reviewing my reasoning, I noticed that my calculations seem correct, but I should ensure that I understand the question correctly. The question asks for the number of sales in the stationery section, and I believe I have correctly calculated that. However, I should double-check my math to make sure it's accurate.\n</reflection>\n\n<adjustment>\nUpon re-examining my math, I am confident that my calculations are correct. The fabric section makes up 1/3 of the sales, the jewelry section makes up 1/4, and the rest is the stationery section. My math checks out, and I am confident in my answer.\n</adjustment>\n\n<output>\n15\n</output>",
    "role": "assistant"
  }
]
```

**샘플 보상 계산**

```
# RLVR Evaluator for OSS

# lambda_grader.py
import json
import re
import uuid
from typing import Any, Dict, List
 
def custom_reward(assistant_answer: str, ground_truth: str) -> float:
    """
    Add custom reward computation here
 
    Example:-
    Reward = fraction of ground-truth words that are correct
    in the correct position.
 
    Example:
      gt:   "the cat sat"
      ans:  "the dog sat"
 
      word-by-word:
        "the" == "the"  -> correct
        "dog" != "cat"  -> wrong
        "sat" == "sat"  -> correct
 
      correct = 2 out of 3 -> reward = 2/3 ≈ 0.67
    """
    ans_words = assistant_answer.strip().lower().split()
    gt_words = ground_truth.strip().lower().split()
 
    if not gt_words:
        return 0.0
 
    correct = 0
    for aw, gw in zip(ans_words, gt_words):
        if aw == gw:
            correct += 1
 
    return correct / len(gt_words)
 
 
# Lambda utility functions
def _ok(body: Any, code: int = 200) -> Dict[str, Any]:
    return {
        "statusCode": code,
        "headers": {
            "content-type": "application/json",
            "access-control-allow-origin": "*",
            "access-control-allow-methods": "POST,OPTIONS",
            "access-control-allow-headers": "content-type",
        },
        "body": json.dumps(body),
    }
 
def _assistant_text(sample: Dict[str, Any]) -> str:
    """Extract assistant text from sample messages."""
    for m in reversed(sample.get("messages", [])):
        if m.get("role") == "assistant":
            return (m.get("content") or "").strip()
    return ""
 
def _sample_id(sample: Dict[str, Any]) -> str:
    """Generate or extract sample ID."""
    if isinstance(sample.get("id"), str) and sample["id"]:
        return sample["id"]
 
    return str(uuid.uuid4())
 
def _ground_truth(sample: Dict[str, Any]) -> str:
    """Extract ground truth from sample or metadata if available"""
 
    if isinstance(sample.get("reference_answer"), str) and sample["reference_answer"]:
        return sample["reference_answer"].strip()
 
    md = sample.get("metadata") or {}
    gt = md.get("reference_answer", None) or md.get("ground_truth", None)
    if gt is None:
        return ""
    return str(gt).strip()
 
 
def _score_and_metrics(sample: Dict[str, Any]) -> Dict[str, Any]:
    sid = _sample_id(sample)
    solution_text = _assistant_text(sample)
 
    # Extract ground truth
    gt = _ground_truth(sample)
 
    metrics_list: List[Dict[str, Any]] = []
 
    # Custom rlvr scoring
    if solution_text and gt:
        
        # Compute score
        reward_score = custom_reward(
            assistant_answer=solution_text,
            ground_truth=gt
        )
        
        # Add detailed metrics
        metrics_list.append({
            "name": "custom_reward_score", 
            "value": float(reward_score), 
            "type": "Reward"
        })
       
        # The aggregate reward score is the custom reward score
        aggregate_score = float(reward_score)
        
    else:
        # No solution text or ground truth - default to 0
        aggregate_score = 0.0
        metrics_list.append({
            "name": "default_zero", 
            "value": 0.0, 
            "type": "Reward"
        })
    print("detected score", {
        "id": sid,
        "aggregate_reward_score": float(aggregate_score),
        "metrics_list": metrics_list,
    })
    return {
        "id": sid,
        "aggregate_reward_score": float(aggregate_score),
        "metrics_list": metrics_list,
    }
 
def lambda_handler(event, context):
    """AWS Lambda handler for custom reward lambda grading."""
    # CORS preflight
    if event.get("requestContext", {}).get("http", {}).get("method") == "OPTIONS":
        return _ok({"ok": True})
 
    # Body may be a JSON string (API GW/Function URL) or already a dict (Invoke)
    raw = event.get("body") or "{}"
    try:
        body = json.loads(raw) if isinstance(raw, str) else raw
    except Exception as e:
        return _ok({"error": f"invalid JSON body: {e}"}, 400)
 
    # Accept top-level list, {"batch":[...]}, or single sample object
    if isinstance(body, dict) and isinstance(body.get("batch"), list):
        samples = body["batch"]
    else:
        return _ok({
            "error": "Send a sample object, or {'batch':[...]} , or a top-level list of samples."
        }, 400)
 
    try:
        results = [_score_and_metrics(s) for s in samples]
    except Exception as e:
        return _ok({"error": f"Custom scoring failed: {e}"}, 500)
 
    return _ok(results)
```

**샘플 보상 함수 코드**

```
# RLVR Evaluator for OSS
# lambda_grader.py

import json
import re
import uuid from typing 
import Any, Dict, List
 
def custom_reward(assistant_answer: str, ground_truth: str) -> float:
    """
    Add custom reward computation here
 
    Example:-
    Reward = fraction of ground-truth words that are correct
    in the correct position.
 
    Example:
      gt:   "the cat sat"
      ans:  "the dog sat"
 
      word-by-word:
        "the" == "the"  -> correct
        "dog" != "cat"  -> wrong
        "sat" == "sat"  -> correct
 
      correct = 2 out of 3 -> reward = 2/3 ≈ 0.67
    """
    ans_words = assistant_answer.strip().lower().split()
    gt_words = ground_truth.strip().lower().split()
 
    if not gt_words:
        return 0.0
 
    correct = 0
    for aw, gw in zip(ans_words, gt_words):
        if aw == gw:
            correct += 1
 
    return correct / len(gt_words)
 
 
# Lambda utility functions
def _ok(body: Any, code: int = 200) -> Dict[str, Any]:
    return {
        "statusCode": code,
        "headers": {
            "content-type": "application/json",
            "access-control-allow-origin": "*",
            "access-control-allow-methods": "POST,OPTIONS",
            "access-control-allow-headers": "content-type",
        },
        "body": json.dumps(body),
    }
 
def _assistant_text(sample: Dict[str, Any]) -> str:
    """Extract assistant text from sample messages."""
    for m in reversed(sample.get("messages", [])):
        if m.get("role") == "assistant":
            return (m.get("content") or "").strip()
    return ""
 
def _sample_id(sample: Dict[str, Any]) -> str:
    """Generate or extract sample ID."""
    if isinstance(sample.get("id"), str) and sample["id"]:
        return sample["id"]
 
    return str(uuid.uuid4())
 
def _ground_truth(sample: Dict[str, Any]) -> str:
    """Extract ground truth from sample or metadata if available"""
 
    if isinstance(sample.get("reference_answer"), str) and sample["reference_answer"]:
        return sample["reference_answer"].strip()
 
    md = sample.get("metadata") or {}
    gt = md.get("reference_answer", None) or md.get("ground_truth", None)
    if gt is None:
        return ""
    return str(gt).strip()
 
 
def _score_and_metrics(sample: Dict[str, Any]) -> Dict[str, Any]:
    sid = _sample_id(sample)
    solution_text = _assistant_text(sample)
 
    # Extract ground truth
    gt = _ground_truth(sample)
 
    metrics_list: List[Dict[str, Any]] = []
 
    # Custom rlvr scoring
    if solution_text and gt:
        
        # Compute score
        reward_score = custom_reward(
            assistant_answer=solution_text,
            ground_truth=gt
        )
        
        # Add detailed metrics
        metrics_list.append({
            "name": "custom_reward_score", 
            "value": float(reward_score), 
            "type": "Reward"
        })
       
        # The aggregate reward score is the custom reward score
        aggregate_score = float(reward_score)
        
    else:
        # No solution text or ground truth - default to 0
        aggregate_score = 0.0
        metrics_list.append({
            "name": "default_zero", 
            "value": 0.0, 
            "type": "Reward"
        })
    print("detected score", {
        "id": sid,
        "aggregate_reward_score": float(aggregate_score),
        "metrics_list": metrics_list,
    })
    return {
        "id": sid,
        "aggregate_reward_score": float(aggregate_score),
        "metrics_list": metrics_list,
    }
 
def lambda_handler(event, context):
    """AWS Lambda handler for custom reward lambda grading."""
    # CORS preflight
    if event.get("requestContext", {}).get("http", {}).get("method") == "OPTIONS":
        return _ok({"ok": True})
 
    # Body may be a JSON string (API GW/Function URL) or already a dict (Invoke)
    raw = event.get("body") or "{}"
    try:
        body = json.loads(raw) if isinstance(raw, str) else raw
    except Exception as e:
        return _ok({"error": f"invalid JSON body: {e}"}, 400)
 
    # Accept top-level list, {"batch":[...]}, or single sample object
    if isinstance(body, dict) and isinstance(body.get("batch"), list):
        samples = body["batch"]
    else:
        return _ok({
            "error": "Send a sample object, or {'batch':[...]} , or a top-level list of samples."
        }, 400)
 
    try:
        results = [_score_and_metrics(s) for s in samples]
    except Exception as e:
        return _ok({"error": f"Custom scoring failed: {e}"}, 500)
 
    return _ok(results)
```

**샘플 보상 프롬프트**

```
You are an expert RAG response evaluator specializing in faithfulness and relevance assessment.
Given: Context documents, a question, and response statements.
Goal: Evaluate both statement-level faithfulness and overall response relevance to the question.

Scoring rubric (start at 0.0, then add or subtract):

Core Components:

Faithfulness Assessment (0.6 max)
Per statement evaluation:
- Direct support in context: +0.2
- Accurate inference from context: +0.2
- No contradictions with context: +0.2
Deductions:
- Hallucination: -0.3
- Misrepresentation of context: -0.2
- Unsupported inference: -0.1

Question Relevance (0.4 max)
- Direct answer to question: +0.2
- Appropriate scope/detail: +0.1
- Proper context usage: +0.1
Deductions:
- Off-topic content: -0.2
- Implicit/meta responses: -0.2
- Missing key information: -0.1

Critical Flags:
A. Complete hallucination
B. Context misalignment
C. Question misinterpretation
D. Implicit-only responses

Additional Instructions:
- Evaluate each statement independently
- Check for direct textual support
- Verify logical inferences
- Assess answer completeness
- Flag any unsupported claims

Return EXACTLY this JSON (no extra text):
{
    "statements_evaluation": [
        {
            "statement": "<statement_text>",
            "verdict": <0 or 1>,
            "reason": "<detailed explanation>",
            "context_support": "<relevant context quote or 'None'>"
        }
    ],
    "overall_assessment": {
        "question_addressed": <0 or 1>,
        "reasoning": "<explanation>",
        "faithfulness_score": <0.0-1.0>,
        "relevance_score": <0.0-1.0>
    },
    "flags": ["<any critical issues>"]
}

## Current Evaluation Task

### Context
{{ ground_truth }}

### Question
{{ extra_info.question }}

### Model's Response
{{ model_output }}
```

# 릴리스 정보
<a name="model-customize-release-note"></a>

**SageMaker AI 모델 사용자 지정 이미지**

**지원 계획**
+ 메이저 버전: 다음 메이저 릴리스 후 12개월
+ 마이너 버전: 다음 마이너 릴리스 후 6개월
+ 패치 버전: 지원이 보장되지 않음(최신 패치로 업그레이드)

다음은 Amazon EKS(EKS) 및 SageMaker AI 훈련 작업(SMTJ)용 기본 딥 러닝 컨테이너에 대한 릴리스 정보입니다.


****  

| 버전 | Type | 서비스 | 이미지 URL | 
| --- | --- | --- | --- | 
|  1.0.0  | CUDA | EKS |  `652744875666.dkr.ecr.amazonaws.com/hyperpod-model-customization:verl-eks-v1.0.0`  | 
|  1.0.0  | CUDA | SMTJ |  `652744875666.dkr.ecr.amazonaws.com/hyperpod-model-customization:verl-smtj-v1.0.0`  | 
|  1.0.0  | CUDA | SMJT |  `652744875666.dkr.ecr.amazonaws.com/hyperpod-model-customization:v1-v1.0.0`  | 
|  1.0.0  | CUDA | SMTJ |  `652744875666.dkr.ecr.amazonaws.com/hyperpod-model-customization:llama-90b-v1.0.0`  | 

**AWS 리전 지원**


****  

| 리전 | 코드 | 서버리스 SMTJ 지원 | 
| --- | --- | --- | 
| 아시아 태평양(뭄바이) | ap-south-1 | 아니요 | 
| 아시아 태평양(싱가포르) | ap-southeast-1 | 아니요 | 
| 아시아 태평양(시드니) | ap-southeast-2 | 아니요 | 
| 아시아 태평양(도쿄) | ap-northeast-1 | yes | 
| 유럽(프랑크푸르트) | eu-central-1 | 아니요 | 
| 유럽(아일랜드) | eu-west-1 | yes | 
| 유럽(스톡홀름) | eu-north-1 | 아니요 | 
| 남아메리카(상파울루) | sa-east-1 | 아니요 | 
| 미국 동부(버지니아 북부) | us-east-1 | yes | 
| 미국 동부(오하이오) | us-east-2 | 아니요 | 
| 미국 서부(캘리포니아 북부) | us-west-1 | 아니요 | 
| 미국 서부(오리건) | us-west-2 | yes | 