本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
要创建使用模型作为判断的模型评估作业,必须指定提示数据集。此提示数据集使用与自动模型评估任务相同的格式,并且在推理期间使用您选择评估的模型。
如果您想使用已经生成的响应来评估非 Amazon Bedrock 模型,请按中所述将其包含在提示数据集中。使用您自己的推理响应数据为评估任务准备数据集当您提供自己的推理响应数据时,Amazon Bedrock 会跳过模型调用步骤,并使用您提供的数据执行评估任务。
自定义提示数据集必须存储在 Amazon S3 中,并使用 JSON 行格式和.jsonl
文件扩展名。每行都必须是有效的 JSON 对象。每个评估任务的数据集中最多可以有 1000 条提示。
对于使用控制台创建的任务,您必须更新 S3 存储桶上的跨源资源共享 (CORS) 配置。要了解有关所需 CORS 权限的更多信息,请参阅 S3 存储桶所需的跨源资源共享 (CORS) 权限。
为 Amazon Bedrock 为您调用模型的评估工作准备数据集
要运行 Amazon Bedrock 为您调用模型的评估任务,请创建一个包含以下键值对的提示数据集:
-
prompt
— 您希望模特响应的提示。 -
referenceResponse
—(可选)基本真相响应。 -
category
–(可选)生成每个类别报告的评估分数。
注意
如果您选择提供基本真相响应 (referenceResponse)
,Amazon Bedrock 将在计算完整性 (Builtin.Completeness
) 和正确性 () 指标时使用此参数。Builtin.Correctness
您也可以在不提供真实情况响应的情况下使用这些指标。要查看这两种场景的裁判提示,请参阅中您选择的评委模型部分内置指标评估器提示 model-as-a-judge评估作业。
下面是一个包含 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
您也可以在不提供真实情况响应的情况下使用这些指标。要查看这两种场景的裁判提示,请参阅中您选择的评委模型部分内置指标评估器提示 model-as-a-judge评估作业。
以下是一个自定义示例数据集,包含 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"
}
]
}