ChatGPT 最佳实践指南之:系统地测试变化

Test changes systematically

系统地测试变化

Improving performance is easier if you can measure it. In some cases a modification to a prompt will achieve better performance on a few isolated examples but lead to worse overall performance on a more representative set of examples. Therefore to be sure that a change is net positive to performance it may be necessary to define a comprehensive test suite (also known an as an "eval").

如果能够对性能进行衡量,那么改进性能就更容易。在某些情况下,对提示进行修改可能会在一些孤立的示例上获得更好的性能,但在更具代表性的示例集上可能会导致更差的整体性能。因此,为确保改变对性能的净增益,可能需要定义全面的测试套件(也称为“评估”)。

Sometimes it can be hard to tell whether a change — e.g., a new instruction or a new design — makes your system better or worse. Looking at a few examples may hint at which is better, but with small sample sizes it can be hard to distinguish between a true improvement or random luck. Maybe the change helps performance on some inputs, but hurts performance on others.

有时很难判断一个变化(例如新的指令或新的设计)是使系统变得更好还是更糟。通过查看几个示例可能可以暗示哪个更好,但是对于小样本量来说,很难区分是真正的改进还是随机运气。也许这个变化在某些输入上有助于性能,但对其他输入有害。

Evaluation procedures (or "evals") are useful for optimizing system designs. Good evals are:

评估程序(或“evals”)对于优化系统设计非常有用。良好的评估应该具备以下特点:

- Representative of real-world usage (or at least diverse)

- 代表现实世界的使用情况(或至少多样化)

- Contain many test cases for greater statistical power (see table below for guidelines)

- 包含许多测试用例以增加统计功效(请参考下表以获取指导方针)

- Easy to automate or repeat

- 易于自动化或重复进行

DIFFERENCE TO DETECT

差异的检测

SAMPLE SIZE NEEDED FOR 95% CONFIDENCE

需要的样本大小以达到95%的置信度

30%
~10
10%
~100
3%
~1,000
1%~10,000

Evaluation of outputs can be done by computers, humans, or a mix. Computers can automate evals with objective criteria (e.g., questions with single correct answers) as well as some subjective or fuzzy criteria, in which model outputs are evaluated by other model queries. OpenAI Evals is an open-source software framework that provides tools for creating automated evals.

所做的评估可以由计算机、人类或二者混合进行。计算机可以根据客观标准(例如,具有单个正确答案的问题)自动化评估,也可以根据其他模型查询来评估模型输出的一些主观或模糊标准。OpenAI Evals 是一个开源软件框架,提供了创建自动化评估的工具。

Model-based evals can be useful when there exists a range of possible outputs that would be considered equally high in quality (e.g. for questions with long answers). The boundary between what can be realistically evaluated with a model-based eval and what requires a human to evaluate is fuzzy and is constantly shifting as models become more capable. We encourage experimentation to figure out how well model-based evals can work for your use case.

基于模型的评估在存在一系列可能的输出被认为具有相等高质量的情况下(例如,对于答案较长的问题)可能会很有用。基于模型的评估能够进行实际评估和需要人类评估的边界是模糊的,并且随着模型能力的提升而不断变化。我们鼓励进行实验,以确定基于模型的评估在您的用例中能够发挥多大作用。

Tactic: Evaluate model outputs with reference to gold-standard answers

技巧:根据黄金标准答案评估模型输出

Suppose it is known that the correct answer to a question should make reference to a specific set of known facts. Then we can use a model query to count how many of the required facts are included in the answer.

假设我们已知正确答案应该引用一组特定的已知事实。然后,我们可以使用模型查询来计算答案中包含的必需事实的数量。

For example, using the following system message:

例如,使用以下系统消息:

SYSTEM

系统

You will be provided with text delimited by triple quotes that is supposed to be the answer to a question. Check if the following pieces of information are directly contained in the answer:

您将获得由三个反引号分隔的文本,这应该是一个问题的答案。检查以下信息是否直接包含在答案中:

- Neil Armstrong was the first person to walk on the moon.

尼尔·阿姆斯特朗是第一个在月球上行走的人。

- The date Neil Armstrong first walked on the moon was July 21, 1969.

尼尔·阿姆斯特朗首次登上月球的日期是1969年7月21日。

For each of these points perform the following steps:

对于这些要点,执行以下步骤:

1 - Restate the point.

1 - 重新阐述要点。

2 - Provide a citation from the answer which is closest to this point.

2 - 提供离此要点最近的答案中的引用。

3 - Consider if someone reading the citation who doesn't know the topic could directly infer the point. Explain why or why not before making up your mind.

3 - 考虑如果阅读引用的人不了解这个主题,能否直接推断出这个要点。在做出决定之前解释为什么或为什么不。

4 - Write "yes" if the answer to 3 was yes, otherwise write "no".

4 - 如果答案是“是”,则写“yes”,否则写“no”。

Finally, provide a count of how many "yes" answers there are. Provide this count as {"count": <insert count here>}.

最后,提供有多少个“yes”答案的计数。将此计数提供为{"count": <插入计数>}。

Here's an example input where both points are satisfied:

以下是满足两个要点的示例输入:

SYSTEM

系统

<insert system message above>

<插入上面的系统消息>

USER

用户

"""Neil Armstrong is famous for being the first human to set foot on the Moon. This historic event took place on July 21, 1969, during the Apollo 11 mission."""

"""尼尔·阿姆斯特朗因成为第一个登上月球的人而闻名。这一历史性事件发生在1969年7月21日,属于阿波罗11号任务。"""

Here's an example input where only one point is satisfied:

以下是只有一个满意要点的示例输入:

SYSTEM

系统

<insert system message above>

<插入上面的系统消息>

USER

用户

"""Neil Armstrong made history when he stepped off the lunar module, becoming the first person to walk on the moon."""

"""当尼尔·阿姆斯特朗踏出登月舱,成为第一个踏上月球的人时,他创造了历史。"""

Here's an example input where none are satisfied:

这是一个示例输入,其中没有满足要求的部分:

SYSTEM

系统

<insert system message above>

<插入上述系统消息>

USER

用户

"""In the summer of '69, a voyage grand,

Apollo 11, bold as legend's hand.

Armstrong took a step, history unfurled,

"One small step," he said, for a new world."""

"""在'69年的夏天,一次伟大的航行,

阿波罗11,勇敢如传说之手。

阿姆斯特朗迈出一步,历史展开,

他说:“迈出小小的一步”,为了一个新世界。

"""

There are many possible variants on this type of model-based eval. Consider the following variation which tracks the kind of overlap between the candidate answer and the gold-standard answer, and also tracks whether the candidate answer contradicts any part of the gold-standard answer.

这种基于模型的评估可以有很多可能的变体。考虑以下变种,跟踪候选答案与黄金标准答案之间的重叠类型,并跟踪候选答案是否与黄金标准答案的任何部分相矛盾。

SYSTEM

系统

Use the following steps to respond to user inputs. Fully restate each step before proceeding. i.e. "Step 1: Reason...".

使用以下步骤来回应用户输入。在继续之前,完整重新陈述每一步,例如“步骤1:逐步推理...”。

Step 1: Reason step-by-step about whether the information in the submitted answer compared to the expert answer is either: disjoint, equal, a subset, a superset, or overlapping (i.e. some intersection but not subset/superset).

步骤1:逐步推理提交的答案与专家答案的信息是否是不相交、相等、子集、超集或重叠(即有一些交集但不是子集/超集)。

Step 2: Reason step-by-step about whether the submitted answer contradicts any aspect of the expert answer.

步骤2:逐步推理提交的答案是否与专家答案的任何方面相矛盾。

Step 3: Output a JSON object structured like: {"type_of_overlap": "disjoint" or "equal" or "subset" or "superset" or "overlapping", "contradiction": true or false}

步骤3:输出一个结构化的JSON对象,形式如下:{"type_of_overlap": "不相交"或"相等"或"子集"或"超集"或"重叠","contradiction": true或false}。

Here's an example input with a substandard answer which nonetheless does not contradict the expert answer:

以下是一个具有不太理想的答案但并不与专家答案相矛盾的示例输入:

SYSTEM

系统

<insert system message above>

<插入上述系统消息>

USER

用户

Question: """What event is Neil Armstrong most famous for and on what date did it occur? Assume UTC time."""

问题:"尼尔·阿姆斯特朗最出名的事件是什么?它发生在哪个日期?假设使用UTC时间。"

Submitted Answer: """Didn't he walk on the moon or something?"""

提交的答案:"他是不是在月球上行走了什么的?"

Expert Answer: """Neil Armstrong is most famous for being the first person to walk on the moon. This historic event occurred on July 21, 1969."""

专家答案:"尼尔·阿姆斯特朗最出名的是成为第一个在月球上行走的人。这一历史事件发生在1969年7月21日。"

Here's an example input with answer that directly contradicts the expert answer:

以下是一个与专家答案直接相矛盾的示例输入:

SYSTEM

系统

<insert system message above>

<插入上述系统消息>

USER

用户

Question: """What event is Neil Armstrong most famous for and on what date did it occur? Assume UTC time."""

问题:"尼尔·阿姆斯特朗最出名的事件是什么?它发生在哪个日期?假设使用UTC时间。"

Submitted Answer: """On the 21st of July 1969, Neil Armstrong became the second person to walk on the moon, following after Buzz Aldrin."""

提交的答案:"在1969年7月21日,尼尔·阿姆斯特朗成为第二个登上月球的人,继巴兹·奥尔德林之后。"

Expert Answer: """Neil Armstrong is most famous for being the first person to walk on the moon. This historic event occurred on July 21, 1969."""

专家答案:"尼尔·阿姆斯特朗最出名的是成为第一个在月球上行走的人。这一历史事件发生在1969年7月21日。"

Here's an example input with a correct answer that also provides a bit more detail than is necessary:

以下是一个正确的答案,但提供了比必要的细节更多的示例输入:

SYSTEM

系统

<insert system message above>

<插入上述系统消息>

USER

用户

Question: """What event is Neil Armstrong most famous for and on what date did it occur? Assume UTC time."""

问题:"尼尔·阿姆斯特朗最出名的事件是什么?它发生在哪个日期?假设使用UTC时间。"

Submitted Answer: """At approximately 02:56 UTC on July 21st 1969, Neil Armstrong became the first human to set foot on the lunar surface, marking a monumental achievement in human history."""

提交的答案:"在1969年7月21日UTC时间的02:56左右,尼尔·阿姆斯特朗成为第一个踏上月球表面的人,标志着人类历史上的一个重大成就。"

Expert Answer: """Neil Armstrong is most famous for being the first person to walk on the moon. This historic event occurred on July 21, 1969."""

专家答案:"尼尔·阿姆斯特朗最出名的是成为第一个在月球上行走的人。这一历史事件发生在1969年7月21日。

0dc723301842065a1f8d61411a8ab6fa.jpeg

“点赞有美意,赞赏是鼓励”

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/28305.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C++类和对象——类的基础

目录 类的引入类的定义类的访问限定符和封装对象的实例化类对象的大小this指针 类的引入 在C语言中&#xff0c;结构体中只能定义变量 但是在C中&#xff0c;结构体不仅可以定义变量&#xff0c;还可以定义函数 下面就是C中的一个结构体&#xff1a; struct Stack {void init(…

《Linux0.11源码解读》理解(五) head之开启分页

先回顾一下地址长度以及组合的演变&#xff1a;16位cpu意味着其数据总线/寄存器也是16位&#xff0c;但是地址总线&#xff08;寻址能力&#xff09;与此无关&#xff0c;可能是20位。可以参考&#xff1a;cpu的位宽、操作系统的位宽和寻址能力的关系_cpu位宽_brahmsjiang的博客…

Android TextView 在最后一行末尾加图标

当前有个需求.显示一段文本&#xff0c;文本最多显示两行&#xff0c;点击展开后才显示完全。当没有显示完全的时候&#xff0c;需要在文本的第二行末尾显示图标&#xff0c;点击图标和文本&#xff0c;文本展开。难点在于图标需要和第二行文本显示在同一行&#xff0c;高度和文…

oracle 如何连同空表一起导出成dmp的方法

1、oracle导出dmp文件的时候&#xff0c;经常会出现一些空表&#xff0c;没有一并被导出的情况。 执行sql select alter table ||table_name|| allocate extent; from user_tables where num_rows0 or num_rows is null; 新建一个sql窗口&#xff0c;把查询结果的sql&#…

Pytorch自动求导机制详解

目录 1. 自动求导 1.1 梯度计算 1.1.1 一阶导数 1.1.2 二阶导数 1.1.3 向量 1.2 线性回归实战 1. 自动求导 在深度学习中&#xff0c;我们通常需要训练一个模型来最小化损失函数。这个过程可以通过梯度下降等优化算法来实现。梯度是函数在某一点上的变化率&#xff0c;可以告…

[黑苹果EFI]Lenovo ThinkPad T490电脑 Hackintosh 黑苹果引导文件

原文来源于黑果魏叔官网&#xff0c;转载需注明出处。&#xff08;下载请直接百度黑果魏叔&#xff09; 硬件型号驱动情况 主板Lenovo ThinkPad T490 处理器Intel Intel Core i5 8265U (Quad Core)已驱动 内存16 GB:8 GB Samsung DDR 4 2666 Mhz *2已驱动 硬盘PC SN520 NVM…

CentOS7中安装docker并配置阿里云加速器

文章目录 一、docker的安装二、docker的卸载三、配置加速器四、docker-compose安装五、docker-compose卸载六、docker-compose相关命令七、常用shell组合 一、docker的安装 参考&#xff1a;https://docs.docker.com/engine/install/centos 本文内容是基于&#xff1a;CentOS L…

文件IO 文件属性获取,目录操作

文件属性获取 int stat(const char *path, struct stat *buf); 功能&#xff1a;获取文件属性参数&#xff1a; path&#xff1a;文件路径名 buf&#xff1a;保存文件属性信息的结构体返回值&#xff1a; 成功&#xff1a;0 失败&#xff1a;-1struct stat {ino_t st_ino;…

批发小程序怎么做

批发订货小程序功能介绍 我们的批发订货小程序是一个集订货浏览权限、一客一价、业务员端口、代客下单、订单汇总和订单打印等功能于一体的专业平台。以下是对这些功能的详细描述&#xff1a; 1. 订货浏览权限&#xff1a;我们的小程序可以为不同用户分配不同的订货浏览权限。…

在LLM的支持下使游戏NPC具有记忆化的方法

问题 使用GPT这样的LLM去处理游戏中的NPC和玩家的对话是个很好的点子&#xff0c;那么如何处理记忆化的问题呢。 因为LLM的输入tokens是有限制的&#xff0c;所以伴随着问题的记忆context是有窗口大小限制的&#xff0c;将所有的记忆输入LLM并不现实。 所以这里看到了stanfo…

TOWE智能PDU是如何帮助机房安然度夏的?

最近&#xff0c;全国各地纷纷进入高温“火炉”模式&#xff0c;炎炎夏日&#xff0c;数据中心的工作温度不应该超过一定的限度。数据中心机房不仅要确保在高温多雨天气下安全、稳定的运维&#xff0c;还要承受降低企业总体运营成本的压力。这种需求下&#xff0c;相较于传统基…

【Matlab】智能优化算法_遗传算法GA

【Matlab】智能优化算法_遗传算法GA 1.背景介绍2.数学模型3.文件结构4.详细代码及注释4.1 crossover.m4.2 elitism.m4.3 GeneticAlgorithm.m4.4 initialization.m4.5 Main.m4.6 mutation.m4.7 selection.m4.8 Sphere.m 5.运行结果6.参考文献 1.背景介绍 遗传算法&#xff08;Ge…