翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
オプション 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" } }
強化ファインチューニングジョブを開始するときに、呼び出しログを入力データソースとして指定できます。Amazon Bedrock コンソール、 API、または SDK を使用してAWS CLI、強化ファインチューニングジョブを開始できます。
リクエストメタデータを提供するための要件
リクエストメタデータは、次の要件を満たしている必要があります。
-
JSON
key:value形式で提供されている。 -
キーと値のペアは、最大 256 文字の文字列である必要がある。
-
最大 16 個のキーと値のペアを指定する。
リクエストメタデータのフィルターの使用
リクエストメタデータを含む呼び出しログが利用可能になったら、リクエストメタデータに基づいてフィルターを適用して、モデルを微調整するために含めるプロンプトを選択的に選択できます。たとえば、 "project": "CustomerService"および "priority": "High"リクエストメタデータを持つもののみを含めることができます。
複数のリクエストメタデータを使用してログをフィルタリングするには、単一のブール演算子ANDまたは を使用しますOR。これらの演算子を組み合わせることはできません。単一リクエストのメタデータフィルタリングには、 Equals または Not Equals演算子を使用します。