옵션 2: 데이터 준비를 위한 간접 호출 로그 사용 - Amazon Bedrock

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

옵션 2: 데이터 준비를 위한 간접 호출 로그 사용

강화 미세 조정 작업을 생성할 때 Amazon Bedrock이 S3 버킷의 기존 호출 로그를 훈련 데이터로 사용하도록 할 수 있습니다. Amazon Bedrock의 경우 간접 호출 로그는 모델 호출에 대한 자세한 레코드입니다.

강화 미세 조정에 호출 로그를 사용하려면 모델 호출 로깅을 설정하고, 모델 호출 작업 중 하나를 사용하고, Amazon S3 버킷을 로그의 대상으로 설정했는지 확인합니다. 호출 로그 설정에 대한 자세한 내용은 CloudWatch Logs 및 Amazon S3를 사용하여 모델 호출 모니터링을 참조하세요.

S3 버킷의 호출 로그를 입력으로 사용하여 강화 미세 조정 작업을 시작하려면 먼저 S3 버킷의 로그에 액세스할 수 있는 Amazon Bedrock 권한을 제공해야 합니다. 자세한 내용은 호출 로그 액세스 단원을 참조하십시오.

선택적으로 모델 간접 호출 작업 중 하나를 사용하여 간접 호출 로그의 프롬프트-응답 페어에 요청 메타데이터를 추가한 다음 나중에 이를 사용하여 로그를 필터링할 수 있습니다. Amazon Bedrock은 필터링된 로그를 사용하여 모델을 미세 조정할 수 있습니다.

강화 미세 조정을 위해 호출 로그의 프롬프트 및 응답에 요청 메타데이터 추가

간접 호출 로그를 사용하면 간접 호출 로그에 연결된 요청 메타데이터를 사용하여 Amazon Bedrock이 강화 미세 조정에 사용할 훈련 데이터 세트 프롬프트를 식별할 수 있습니다.

다음은를 사용한 InvokeModel 호출의 호출 로그 예제입니다. requestMetadata

{ "schemaType": "ModelInvocationLog", "schemaVersion": "1.0", "timestamp": "2024-09-11T17:16:18Z", "accountId": "XXXXX", "identity": { "arn": "arn:aws:sts::XXXXXXX:assumed-role/Admin/XXXXXX" }, "region": "us-east-1", "requestId": "7ee514f3-9eff-467c-af75-8fd564ce58e5", "operation": "InvokeModel", "modelId": "meta.llama3-1-405b-instruct-v1:0", "input": { "inputContentType": "application/json", "inputBodyJson": { "prompt": "story of two dogs", "max_tokens_to_sample": 300 }, "inputTokenCount": 13 }, "output": { "outputContentType": "application/json", "outputBodyJson": { "type": "completion", "completion": " Here is a story about two dogs:\n\nRex and Charlie were best friends who lived next door to each other. Every morning, their owners would let them out into the backyard to play. Rex was a golden retriever with long, shaggy fur. He loved to run and chase sticks. Charlie was a corgi with short legs and a big smile. He was happy just sniffing the grass and rolling around. \n\nThe two dogs spent every day playing together. Rex would grab a stick and bring it over to Charlie, wagging his tail excitedly. Charlie would take the other end of the stick in his mouth and they'd have a friendly game of tug-of-war. After tiring themselves out, they'd flop down in the warm sunshine for a nap. \n\nAt lunchtime, their owners would call them in for food. Rex would gobble up his kibble hungrily while Charlie ate his at a more leisurely pace. After lunch, it was right back outside for more playtime. The afternoon sunbeams would light up their fur as they chased each other around the yard. \n\nWhen it started getting late, their owners called them in for the night. Rex and Charlie would head inside, tired but happy after another fun day of play. After slurping up fresh water from their bowls, they'd curl up on their beds, Rex's fluffy golden tail tucked over his nose and little", "stop_reason": "max_tokens", "stop": null }, "outputTokenCount": 300 }, "requestMetadata": { "project": "CustomerService", "intent": "ComplaintResolution", "priority": "High" } }

강화 미세 조정 작업을 시작할 때 호출 로그를 입력 데이터 소스로 지정할 수 있습니다. API AWS CLI또는 SDK를 사용하여 Amazon Bedrock 콘솔을 통해 강화 미세 조정 작업을 시작할 수 있습니다.

요청 메타데이터를 제공하기 위한 요구 사항

데이터 웨어하우스는 다음 요구 사항을 충족해야 합니다.

  • JSON key:value 형식으로 제공됩니다.

  • 키와 값 페어는 최대 256자의 문자열이어야 합니다.

  • 최대 16개의 키-값 페어를 제공합니다.

메타데이터 요청 필터 사용

요청 메타데이터가 있는 호출 로그를 사용할 수 있게 되면 요청 메타데이터를 기반으로 필터를 적용하여 모델 미세 조정에 포함할 프롬프트를 선택적으로 선택할 수 있습니다. 예를 들어 및 "project": "CustomerService" "priority": "High" 요청 메타데이터가 있는 만 포함할 수 있습니다.

여러 요청 메타데이터를 사용하여 로그를 필터링하려면 단일 부울 연산자 AND 또는를 사용합니다OR. 이러한 연산자는 결합할 수 없습니다. 단일 요청 메타데이터 필터링의 경우 Equals 또는 Not Equals 연산자를 사용합니다.