本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
為使用模型作為評判的模型評估任務建立提示資料集
若要建立使用模型作為評判的模型評估任務,您必須指定提示資料集。此提示資料集使用與自動模型評估任務相同的格式,並在推論期間與您選取要評估的模型搭配使用。
如果您想要使用已產生的回應來評估非 Amazon Bedrock 模型,請在提示資料集中包含它們,如 使用您自己的推論回應資料為評估任務準備資料集 中所述。當您提供自己的推論回應資料時,Amazon Bedrock 會略過模型調用步驟,並使用您提供的資料執行評估任務。
自訂提示資料集必須存放在 Amazon S3 中,並使用 JSON 行格式及 .jsonl 檔案副檔名。每行都必須是有效的 JSON 物件。每個評估任務在您的資料集中最多可有 1000 個提示。
LLM-as-a-judge 評估任務不需要 CORS 組態。對於以人工為基礎的評估任務,S3 輸出儲存貯體需要 CORS。如需詳細資訊,請參閱 S3 儲存貯體上所需的跨來源資源分享 (CORS) 許可。
針對 Amazon Bedrock 為您調用模型的評估任務準備資料集
若要執行 Amazon Bedrock 為您調用模型的評估任務,請建立包含下列鍵值對的提示資料集:
-
prompt– 您想要讓模型回應的提示。 -
referenceResponse– (選用) 基本事實回應。 -
category– (選用) 產生針對每個類別報告的評估分數。
注意
如果您選擇提供基本事實回應 (referenceResponse)),Amazon Bedrock 會在計算完整性 (Builtin.Completeness) 和正確性 (Builtin.Correctness) 指標時使用此參數。您也可以使用這些指標,而無需提供基本事實回應。若要查看這兩個案例的判斷提示,請參閱 模型即評判評估任務的內建指標評估工具提示 中所選判斷模型的一節。
以下是包含 6 個輸入並使用 JSON 行格式的自訂資料集範例。
{"prompt":"Provide the prompt you want the model to use during inference","category":"(Optional) Specify an optional category","referenceResponse":"(Optional) Specify a ground truth response."}
{"prompt":"Provide the prompt you want the model to use during inference","category":"(Optional) Specify an optional category","referenceResponse":"(Optional) Specify a ground truth response."}
{"prompt":"Provide the prompt you want the model to use during inference","category":"(Optional) Specify an optional category","referenceResponse":"(Optional) Specify a ground truth response."}
{"prompt":"Provide the prompt you want the model to use during inference","category":"(Optional) Specify an optional category","referenceResponse":"(Optional) Specify a ground truth response."}
{"prompt":"Provide the prompt you want the model to use during inference","category":"(Optional) Specify an optional category","referenceResponse":"(Optional) Specify a ground truth response."}
{"prompt":"Provide the prompt you want the model to use during inference","category":"(Optional) Specify an optional category","referenceResponse":"(Optional) Specify a ground truth response."}
下列範例是為了加強清晰度而擴充的單一項目。在實際提示資料集中,每行都必須是有效的 JSON 物件。
{ "prompt": "What is high intensity interval training?", "category": "Fitness", "referenceResponse": "High-Intensity Interval Training (HIIT) is a cardiovascular exercise approach that involves short, intense bursts of exercise followed by brief recovery or rest periods." }
使用您自己的推論回應資料為評估任務準備資料集
若要使用您已產生的回應執行評估任務,請建立包含下列鍵值對的提示資料集:
-
prompt– 您的模型用來產生回應的提示。 -
referenceResponse– (選用) 基本事實回應。 -
category– (選用) 產生針對每個類別報告的評估分數。 -
modelResponses– 您想要讓 Amazon Bedrock 評估之自己推論的回應。使用模型即評判的評估任務僅支援每個提示的一個模型回應,使用下列索引鍵定義:-
response– 包含模型推論回應的字串。 -
modelIdentifier– 識別產生回應之模型的字串。您只能在評估任務中使用一個唯一的modelIdentifier,而且資料集中的每個提示都必須使用此識別符。
-
注意
如果您選擇提供基本事實回應 (referenceResponse)),Amazon Bedrock 會在計算完整性 (Builtin.Completeness) 和正確性 (Builtin.Correctness) 指標時使用此參數。您也可以使用這些指標,而無需提供基本事實回應。若要查看這兩個案例的判斷提示,請參閱 模型即評判評估任務的內建指標評估工具提示 中所選判斷模型的一節。
以下是包含 6 個輸入並使用 JSON 行格式的自訂範例資料集。
{"prompt":"The prompt you used to generate the model response","referenceResponse":"(Optional) a ground truth response","category":"(Optional) a category for the prompt","modelResponses":[{"response":"The response your model generated","modelIdentifier":"A string identifying your model"}]} {"prompt":"The prompt you used to generate the model response","referenceResponse":"(Optional) a ground truth response","category":"(Optional) a category for the prompt","modelResponses":[{"response":"The response your model generated","modelIdentifier":"A string identifying your model"}]} {"prompt":"The prompt you used to generate the model response","referenceResponse":"(Optional) a ground truth response","category":"(Optional) a category for the prompt","modelResponses":[{"response":"The response your model generated","modelIdentifier":"A string identifying your model"}]} {"prompt":"The prompt you used to generate the model response","referenceResponse":"(Optional) a ground truth response","category":"(Optional) a category for the prompt","modelResponses":[{"response":"The response your model generated","modelIdentifier":"A string identifying your model"}]} {"prompt":"The prompt you used to generate the model response","referenceResponse":"(Optional) a ground truth response","category":"(Optional) a category for the prompt","modelResponses":[{"response":"The response your model generated","modelIdentifier":"A string identifying your model"}]} {"prompt":"The prompt you used to generate the model response","referenceResponse":"(Optional) a ground truth response","category":"(Optional) a category for the prompt","modelResponses":[{"response":"The response your model generated","modelIdentifier":"A string identifying your model"}]}
下列範例顯示提示資料集中為了加強清晰度而擴充的單一項目。
{ "prompt": "What is high intensity interval training?", "referenceResponse": "High-Intensity Interval Training (HIIT) is a cardiovascular exercise approach that involves short, intense bursts of exercise followed by brief recovery or rest periods.", "category": "Fitness", "modelResponses": [ { "response": "High intensity interval training (HIIT) is a workout strategy that alternates between short bursts of intense, maximum-effort exercise and brief recovery periods, designed to maximize calorie burn and improve cardiovascular fitness.", "modelIdentifier": "my_model" } ] }