Auto Byte

专注未来出行及智能汽车科技

微信扫一扫获取更多资讯

Science AI

关注人工智能与其他前沿技术、基础学科的交叉研究与融合发展

微信扫一扫获取更多资讯

张倩、小舟编辑

羊驼系列大模型和ChatGPT差多少?详细测评后,我沉默了

总的来说,该测试得出的结论是:MPT 还没有准备好在现实世界中使用,而 Vicuna 对于许多任务来说是 ChatGPT (3.5) 的可行替代品。

前段时间,谷歌的一份泄密文件引发了广泛关注。在这份文件中,一位谷歌内部的研究人员表达了一个重要观点:谷歌没有护城河,OpenAI 也没有。


这位研究人员表示,虽然表面看起来 OpenAI 和谷歌在 AI 大模型上你追我赶,但真正的赢家未必会从这两家中产生,因为一个第三方力量正在悄悄崛起。


这个力量名叫「开源」。围绕 Meta 的 LLaMA 等开源模型,整个社区正在迅速构建与 OpenAI、谷歌大模型能力类似的模型,而且开源模型的迭代速度更快,可定制性更强,更有私密性……「当免费的、不受限制的替代品质量相当时,人们不会为受限制的模型付费。」作者写道。


这些观点在社交媒体上引起了很大争议,其中一个比较大的争议是:那些开源模型是否真的能达到和 OpenAI ChatGPT 或谷歌 Bard 等商业闭源大模型相似的水平?现阶段两个阵营还有多大差距?


为了探索这个问题,一位名叫 Marco Tulio Ribeiro 的 Medium 博主在一些复杂任务上对部分模型(Vicuna-13B、MPT-7b-Chat VS. ChatGPT 3.5)进行了测试。


其中,Vicuna-13B 是加州大学伯克利分校、卡内基梅隆大学、斯坦福大学、加州大学圣迭戈分校的研究者们提出的一个开源模型,这个模型基于 LLaMA 13B 参数量的版本构建而成,在一项由 GPT-4 打分的测试中表现十分亮眼(参见《300 美元复刻 ChatGPT 九成功力,GPT-4 亲自监考,130 亿参数开源模型「小羊驼」来了》)。


MPT-7B 是 MosaicML 发布的大型语言模型,遵循 meta 的 LLaMA 模型的训练方案。MosaicML 表示,MPT-7B 与 meta 的 70 亿参数 LLaMA 模型的性能相当。


和它们对比的,自然是大语言模型标杆 ChatGPT。



Marco Tulio Ribeiro 是一位研究员,目前在微软研究院的自适应系统和交互组工作。他还是华盛顿大学的联合助理教授。这项工作由他和微软的另一位研究员 Scott Lundberg 共同完成。在测试中,他们使用了微软的 guidance 库来帮助设计 prompt。


热身:解方程


第一项任务是解简单的多项式方程,这些问题都有标准答案,比较容易评估对错。


对于指定的三个模型,测试者给出的题目是求二元一次方程「x^2+3x=0」的解。他们使用了以下 prompt:



三个模型表现如下。


ChatGPT:


equation = 'x^2 + 3.0x = 0'
roots = [0, -3]
answer_gpt = find_roots (llm=chatgpt, equation=equation)



Vicuna:


answer_vicuna = find_roots (llm=vicuna, equation=equation)



MPT:


answer_mpt = find_roots (llm=mpt, equation=equation)



显然,正确答案应该是 [-3, 0],只有 ChatGPT 答对了(Vicuna 甚至没有按照指定的格式作答)。


在这篇文章附带的 notebook 中,测试者编写了一个函数,用于生成具有整数根的随机二次方程,根的范围在 - 20 到 20 之间,并且对每个模型运行了 20 次 prompt。三个模型的准确率结果如下:


╔═══════════╦══════════╦
║   Model   ║ Accuracy ║     
╠═══════════╬══════════╬
║ ChatGPT   ║   80%    ║
║ Vicuna    ║    0%    ║ 
║ MPT       ║    0%    ║
╚═══════════╩══════════╩


在二元一次方程的测试中,虽然 GPT 做错了一些题,但 Vicuna 和 MPT 一道都没做对,经常在中间步骤中犯错(MPT 甚至经常不写中间步骤)。下面是一个 ChatGPT 错误的例子:



ChatGPT 在最后一步计算错误,(13 +- 25)/2 应该得到 [19,-6] 而不是 [19.5,-6.5]。


由于 Vicuna 和 MPT 实在不会解二元一次方程,测试者就找了一些更简单的题让他们做,比如 x-10=0。对于这些简单的方程,他们得到了以下统计结果:


╔═══════════╦══════════╦
║   Model   ║ Accuracy ║     
╠═══════════╬══════════╬
║ ChatGPT   ║   100%   ║
║ Vicuna    ║    85%   ║ 
║ MPT       ║    30%   ║
╚═══════════╩══════════╩


下面是一个 MPT 答错的例子:



结论


在这个非常简单的测试中,测试者使用相同的问题、相同的 prompt 得出的结论是:ChatGPT 在准确性方面远远超过了 Vicuna 和 MPT。


任务:提取片段 + 回答会议相关的问题


这个任务更加现实,而且在会议相关的问答中,出于安全性、隐私等方面考虑,大家可能更加倾向于用开源模型,而不是将私有数据发送给 OpenAI。


以下是一段会议记录(翻译结果来自 DeepL,仅供参考):



测试者给出的第一个测试问题是:「Steven 如何看待收购一事?」,prompt 如下:


qa_attempt1 = guidance ('''{{#system~}}
{{llm.default_system_prompt}}
{{~/system}}


{{#user~}}
You will read a meeting transcript, then extract the relevant segments to answer the following question:
Question: {{query}}
Here is a meeting transcript:
----
{{transcript}}
----
Please answer the following question:
Question: {{query}}
Extract from the transcript the most relevant segments for the answer, and then answer the question.
{{/user}}


{{#assistant~}}
{{gen 'answer'}}
{{~/assistant~}}''')


ChatGPT 给出了如下答案:



虽然这个回答是合理的,但 ChatGPT 并没有提取任何对话片段作为答案的支撑(因此不符合测试者设定的规范)。测试者在 notebook 中迭代了 5 个不同的 prompt,以下是一些例子:


qa_attempt3 = guidance ('''{{#system~}}
{{llm.default_system_prompt}}
{{~/system}}


{{#user~}}
You will read a meeting transcript, then extract the relevant segments to answer the following question:
Question: {{query}}
Here is a meeting transcript:
----
{{transcript}}
----
Based on the above, please answer the following question:
Question: {{query}}
Please extract from the transcript whichever conversation segments are most relevant for the answer, and then answer the question.
Note that conversation segments can be of any length, e.g. including multiple conversation turns.
Please extract at most 3 segments. If you need less than three segments, you can leave the rest blank.

As an example of output format, here is a fictitious answer to a question about another meeting transcript.
CONVERSATION SEGMENTS:
Segment 1: Peter and John discuss the weather.
Peter: John, how is the weather today?
John: It's raining.
Segment 2: Peter insults John
Peter: John, you are a bad person.
Segment 3: Blank
ANSWER: Peter and John discussed the weather and Peter insulted John.
{{/user}}


{{#assistant~}}
{{gen 'answer'}}
{{~/assistant~}}''')



在这个新的 prompt 中,ChatGPT 确实提取了相关的片段,但它没有遵循测试者规定的输出格式(它没有总结每个片段,也没有给出对话者的名字)。


不过,在构建出更复杂的 prompt 之后,ChatGPT 终于听懂了指示:


qa_attempt5 = guidance ('''{{#system~}}
{{llm.default_system_prompt}}
{{~/system}}


{{#user~}}
You will read a meeting transcript, then extract the relevant segments to answer the following question:
Question: What were the main things that happened in the meeting?
Here is a meeting transcript:
----
Peter: Hey
John: Hey
Peter: John, how is the weather today?
John: It's raining.
Peter: That's too bad. I was hoping to go for a walk later.
John: Yeah, it's a shame.
Peter: John, you are a bad person.
----
Based on the above, please answer the following question:
Question: {{query}}
Please extract from the transcript whichever conversation segments are most relevant for the answer, and then answer the question.
Note that conversation segments can be of any length, e.g. including multiple conversation turns.
Please extract at most 3 segments. If you need less than three segments, you can leave the rest blank.
{{/user}}
{{#assistant~}}
CONVERSATION SEGMENTS:
Segment 1: Peter and John discuss the weather.
Peter: John, how is the weather today?
John: It's raining.
Segment 2: Peter insults John
Peter: John, you are a bad person.
Segment 3: Blank
ANSWER: Peter and John discussed the weather and Peter insulted John.
{{~/assistant~}}
{{#user~}}
You will read a meeting transcript, then extract the relevant segments to answer the following question:
Question: {{query}}
Here is a meeting transcript:
----
{{transcript}}
----
Based on the above, please answer the following question:
Question: {{query}}
Please extract from the transcript whichever conversation segments are most relevant for the answer, and then answer the question.
Note that conversation segments can be of any length, e.g. including multiple conversation turns.
Please extract at most 3 segments. If you need less than three segments, you can leave the rest blank.
{{~/user}}


{{#assistant~}}
{{gen 'answer'}}
{{~/assistant~}}''')




测试者表示,他们之所以要多次迭代 prompt,是因为 OpenAI API 不允许他们做部分输出补全(即他们不能指定 AI 助手如何开始回答),因此他们很难引导输出。


相反,如果使用一个开源模型,他们就可以更清楚地指导输出,迫使模型使用他们规定的结构。


新一轮测试使用如下 prompt:


qa_guided = guidance ('''{{#system~}}
{{llm.default_system_prompt}}
{{~/system}}

{{#user~}}
You will read a meeting transcript, then extract the relevant segments to answer the following question:
Question: {{query}}
----
{{transcript}}
----
Based on the above, please answer the following question:
Question: {{query}}
Please extract the three segment from the transcript that are the most relevant for the answer, and then answer the question.
Note that conversation segments can be of any length, e.g. including multiple conversation turns. If you need less than three segments, you can leave the rest blank.


As an example of output format, here is a fictitious answer to a question about another meeting transcript:
CONVERSATION SEGMENTS:
Segment 1: Peter and John discuss the weather.
Peter: John, how is the weather today?
John: It's raining.
Segment 2: Peter insults John
Peter: John, you are a bad person.
Segment 3: Blank
ANSWER: Peter and John discussed the weather and Peter insulted John.
{{/user}}


{{#assistant~}}
CONVERSATION SEGMENTS:
Segment 1: {{gen'segment1'}}
Segment 2: {{gen'segment2'}}
Segment 3: {{gen'segment3'}}
ANSWER: {{gen 'answer'}}
{{~/assistant~}}''')


如果用 Vicuna 运行上述 prompt,他们第一次就会得到正确的格式,而且格式总能保持正确:



当然,也可以在 MPT 上运行相同的 prompt:



虽然 MPT 遵循了格式要求,但它没有针对给定的会议资料回答问题,而是从格式示例中提取了片段。这显然是不行的。


接下来比较 ChatGPT 和 Vicuna。


测试者给出的问题是「谁想卖掉公司?」两个模型看起来答得都不错。


以下是 ChatGPT 的回答:



以下是 Vicuna 的回答:



接下来,测试者换了一段材料。新材料是马斯克和记者的一段对话:



测试者提出的问题是:「Elon Musk 有没有侮辱(insult)记者?」


ChatGPT 给出的答案是:



Vicuna 给出的答案是:



Vicuna 给出了正确的格式,甚至提取的片段也是对的。但令人意外的是,它最后还是给出了错误的答案,即「Elon musk does not accuse him of lying or insult him in any way」。


测试者还进行了其他问答测试,得出的结论是:Vicuna 在大多数问题上与 ChatGPT 相当,但比 ChatGPT 更经常答错。


用 bash 完成任务


测试者尝试让几个 LLM 迭代使用 bash shell 来解决一些问题。每当模型发出命令,测试者会运行这些命令并将输出插入到 prompt 中,迭代进行这个过程,直到任务完成。


ChatGPT 的 prompt 如下所示:


terminal = guidance ('''{{#system~}}
{{llm.default_system_prompt}}
{{~/system}}


{{#user~}}
Please complete the following task:
Task: list the files in the current directory
You can give me one bash command to run at a time, using the syntax:
COMMAND: command
I will run the commands on my terminal, and paste the output back to you. Once you are done with the task, please type DONE.
{{/user}}


{{#assistant~}}
COMMAND: ls
{{~/assistant~}}


{{#user~}}
Output: guidance project
{{/user}}


{{#assistant~}}
The files or folders in the current directory are:
- guidance
- project
DONE
{{~/assistant~}}


{{#user~}}
Please complete the following task:
Task: {{task}}
You can give me one bash command to run at a time, using the syntax:
COMMAND: command
I will run the commands on my terminal, and paste the output back to you. Once you are done with the task, please type DONE.
{{/user}}


{{#geneach 'commands' stop=False}}
{{#assistant~}}
{{gen 'this.command'}}
{{~/assistant~}}


{{~#user~}}
Output: {{shell this.command)}}
{{~/user~}}
{{/geneach}}''')


测试者在~/work/project 中创建了一个虚拟存储库,其中包含文件 license.txt,但不是标准的 LICENSE 文件名。


然后测试者尝试在不与 ChatGPT 沟通的情况下,看它是否能完成任务 ——「找出位于~/work/project 中的开源项目正在使用的 license」(Find out what license the open source project located in ~/work/project is using)。



ChatGPT 遵循一个非常自然的顺序,并解决了这个问题。


对于开源模型,测试者编写了一个更简单的(引导式)prompt,其中包含一系列命令输出:


guided_terminal = guidance ('''{{#system~}}
{{llm.default_system_prompt}}
{{~/system}}


{{#user~}}
Please complete the following task:
Task: list the files in the current directory
You can run bash commands using the syntax:
COMMAND: command
OUTPUT: output
Once you are done with the task, use the COMMAND: DONE.
{{/user}}


{{#assistant~}}
COMMAND: ls
OUTPUT: guidance project
COMMAND: DONE 
{{~/assistant~}}


{{#user~}}
Please complete the following task:
Task: {{task}}
You can run bash commands using the syntax:
COMMAND: command
OUTPUT: output
Once you are done with the task, use the COMMAND: DONE.
{{~/user}}


{{#assistant~}}
{{#geneach 'commands' stop=False ~}}
COMMAND: {{gen 'this.command' stop='\\n'}}
OUTPUT: {{shell this.command)}}{{~/geneach}}
{{~/assistant~}}''')


我们来看一下 Vicuna 和 MPT 执行该任务的情况。


Vicuna:



MPT:



在一个有趣的转折中,Vicuna 无法解决这个任务,但 MPT 却成功了。除了保密性之外,开源模型在这里有一个显著的优势:整个 prompt 被作为一个输入传递给一个 LLM 模型(测试者甚至通过不让它生成像 COMMAND 这样的输出结构 token 来加速它)。


相比之下,他们必须为每个命令重新调用 ChatGPT,这更慢,开销也更大。


接下来,他们又尝试了一个不同的命令:「在~/work/guidance 目录下找到当前未被 git 跟踪的所有 jupyter notebook 文件」


以下是 ChatGPT 的回答:



测试者再次遇到一个问题:ChatGPT 没有遵循他们指定的输出结构(这样就使得它无法在无人干预的情况下在程序内使用)。该程序只是执行命令,因此在上面最后一条 ChatGPT 信息之后就停止了。


测试者怀疑空输出会导致 ChatGPT 关闭,因此他们通过在没有输出时更改信息来解决这个特殊问题。然而,他们无法解决「无法强迫 ChatGPT 遵循指定的输出结构」这一普遍问题。


在做了这个小小的修改后,ChatGPT 就能解决这个问题:让我们看看 Vicuna 是怎么做的:



Vicuna 遵循了输出结构,但不幸的是,它运行了错误的命令来完成任务。MPT 反复调用 git status,所以它也失败了。


测试者还对其他各种指令运行了这些程序,发现 ChatGPT 几乎总是能产生正确的指令序列,但有时并不遵循指定的格式(因此需要人工干预)。此处开源模型的效果不是很好(或许可以通过更多的 prompt 工程来改进它们,但它们在大多数较难的指令上都失败了)。


归纳总结


测试者还尝试了一些其他任务,包括文本摘要、问题回答、创意生成和 toy 字符串操作,评估了几种模型的准确性。以下是主要的评估结果:


  • 任务质量:对于每项任务,ChatGPT (3.5) 都比 Vicuna 强,而 MPT 几乎在所有任务上都表现不佳,这甚至让测试团队怀疑自己的使用方法存在问题。值得注意的是,Vicuna 的性能通常接近 ChatGPT。

  • 易用性:ChatGPT 很难遵循指定的输出格式,因此难以在程序中使用它,需要为输出编写正则表达式解析器。相比之下,能够指定输出结构是开源模型的一个显著优势,以至于有时 Vicuna 比 ChatGPT 更易用,即使它在任务性能方面更差一些。

  • 效率:本地部署模型意味着我们可以在单次 LLM 运行中解决任务(guidance 在程序执行时保持 LLM 状态),速度更快,成本更低。当任何子步骤涉及调用其他 API 或函数(例如搜索、终端等)时尤其如此,这总是需要对 OpenAI API 进行新调用。guidance 还通过不让模型生成输出结构标记来加速生成,这有时会产生很大的不同。


总的来说,该测试得出的结论是:MPT 还没有准备好在现实世界中使用,而 Vicuna 对于许多任务来说是 ChatGPT (3.5) 的可行替代品。目前这些发现仅适用于该测试尝试的任务和输入(或 prompt 类型),该测试只是一个初步探索,而不是正式评估。


更多结果参见 notebook:https://github.com/microsoft/guidance/blob/main/notebooks/chatgpt_vs_open_source_on_harder_tasks.ipynb


参考链接:https://medium.com/@marcotcr/exploring-chatgpt-vs-open-source-models-on-slightly-harder-tasks-aa0395c31610

入门ChatGPT羊驼
相关数据
迭代 技术

模型的权重在训练期间的一次更新。迭代包含计算参数在单个批量数据上的梯度损失。

参数技术

在数学和统计学裡,参数(英语:parameter)是使用通用变量来建立函数和变量之间关系(当这种关系很难用方程来阐述时)的一个数量。

准确率技术

分类模型的正确预测所占的比例。在多类别分类中,准确率的定义为:正确的预测数/样本总数。 在二元分类中,准确率的定义为:(真正例数+真负例数)/样本总数

Elon Musk人物

伊隆·马斯克(Elon Musk)是一名美籍和加籍企业家,出生于南非。作为SpaceX、特斯拉和PayPal的创始人而闻名。

所属机构
语言模型技术

统计式的语言模型是借由一个几率分布,而指派几率给字词所组成的字串。语言模型经常使用在许多自然语言处理方面的应用,如语音识别,机器翻译,词性标注,句法分析和资讯检索。

暂无评论
暂无评论~