自定义提示数据集 - Amazon Bedrock

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

自定义提示数据集

您可以在模型评估作业中使用自定义提示数据集。

自定义提示数据集必须存储在 Amazon S3 中,使用 JSON 行格式和 .jsonl 文件扩展名。将数据集上传到 Amazon S3 时,请务必更新 S3 存储桶上的跨源资源共享 (CORS) 配置。要了解有关所需 CORS 权限的更多信息,请参阅 对 S3 存储桶的必要跨源资源共享 (CORS) 权限

对自动模型评估作业中使用的自定义提示数据集的要求

在自动模型评估作业中,您可以为在模型评估作业中选择的每个指标使用一个自定义提示数据集。自定义数据集使用 JSON 行格式 (.jsonl),每行都必须是一个有效的 JSON 对象。每个自动评估作业的数据集中最多可以有 1000 条提示。

必须在自定义数据集中使用以下键。

  • prompt – 必要键,用于指明以下任务的输入:

    • 模型在一般文本生成中应当响应的提示。

    • 模型在问答任务类型中应当回答的问题。

    • 模型在文本摘要任务中应当总结的文本。

    • 模型在分类任务中应当分类的文本。

  • referenceResponse – 必要键,用于指明在针对以下任务类型评估模型时,所依据的真实响应:

    • 问答任务中所有提示的答案。

    • 所有准确性和稳健性评估的答案。

  • category–(可选)生成每个类别报告的评估分数。

举个例子,准确性既要求提供要问的问题,也要求提供检查模型响应所依据的答案。因此,使用键 prompt 和问题中包含的值,使用键 referenceResponse 和答案中包含的值,如下所示。

{ "prompt": "Bobigny is the capital of", "referenceResponse": "Seine-Saint-Denis", "category": "Capitals" }

前面的示例是某个 JSON 行输入文件中的一行,该文件将作为推理请求发送给您的模型。系统将为您的 JSON 行数据集中的每条此类记录调用模型。以下数据输入示例用于问答任务,该任务使用可选的 category 键进行评估。

{"prompt":"Aurillac is the capital of", "category":"Capitals", "referenceResponse":"Cantal"} {"prompt":"Bamiyan city is the capital of", "category":"Capitals", "referenceResponse":"Bamiyan Province"} {"prompt":"Sokhumi is the capital of", "category":"Capitals", "referenceResponse":"Abkhazia"}

要详细了解使用人工的模型评估作业的格式要求,请参阅 对使用人工的模型评估作业中自定义提示数据集的要求

对使用人工的模型评估作业中自定义提示数据集的要求

在 JSON 行格式中,每一行都是一个有效的 JSON 对象。在每个模型评估作业中,一个提示数据集最多可以包含 1000 条提示。

有效的提示输入必须包含prompt密钥。categoryreferenceResponse都是可选的。category 键用于将提示标记为特定的类别,在模型评估报告卡中查看结果时,可以使用这些类别来筛选结果。referenceResponse 键用于指定工作人员在评估期间可以参考的真实响应。

工作人员可以在自己的 UI 中看到您为 promptreferenceResponse 指定的内容。

下面是一个包含 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."}

为清楚说明,下面的示例显示了一个展开来的单个条目

{ "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." }