羊驼系列大模型和ChatGPT差多少?详细测评后,我沉默了
编辑:张倩、小舟
chatgpt中文版 http://chatgpt.guige.xyz
总的来讲,该测试得出的结论是:MPT 还没有准备好在现实世界中使用,而 Vicuna 对许多任务来讲是 ChatGPT (3.5) 的可行替换品。
前段时间,谷歌的一份泄密文件引发了广泛关注。在这份文件中,一名谷歌内部的研究人员表达了一个重要观点:谷歌没有护城河,OpenAI 也没有。
这位研究人员表示,虽然表面看起来 OpenAI 和谷歌在 AI 大模型上你追我赶,但真实的赢家未必会从这两家中产生,由于一个第三方气力正在悄悄突起。
这个气力名叫「开源」。围绕 Meta 的 LLaMA 等开源模型,全部社区正在迅速构建与 OpenAI、谷歌大模型能力类似的模型,而且开源模型的迭代速度更快,可定制性更强,更有私密性……「当不要钱的、不受限制的替换品质量相当时,人们不会为受限制的模型付费。」作者写道。
这些观点在社交媒体上引发了很大争议,其中一个比较大的争议是:那些开源模型会不会真的能到达和 OpenAI ChatGPT 或谷歌 Bard 等商业闭源大模型类似的水平?现阶段两个阵营还有多大差距?
为了探索这个问题,一名名叫 Marco Tulio Ribeiro 的 Medium 博主在一些复杂任务上对部份模型(Vicuna⑴3B、MPT⑺b-Chat VS. ChatGPT 3.5)进行了测试。
其中,Vicuna⑴3B 是加州大学伯克利分校、卡内基梅隆大学、斯坦福大学、加州大学圣迭戈分校的研究者们提出的一个开源模型,这个模型基于 LLaMA 13B 参数量的版本构建而成,在一项由 GPT⑷ 打分的测试中表现十分亮眼(参见《300 美元复刻 ChatGPT 九成功力,GPT⑷ 亲身监考,130 亿参数开源模型「小羊驼」来了》)。
MPT⑺B 是 MosaicML 发布的大型语言模型,遵守 meta 的 LLaMA 模型的训练方案。MosaicML 表示,MPT⑺B 与 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)
明显,正确答案应当是 [⑶, 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,⑹] 而不是 [19.5,⑹.5]。
由于 Vicuna 和 MPT 实在不会解二元一次方程,测试者就找了一些更简单的题让他们做,比如 x⑴0=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~}}
'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~}}
'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,其中包括一系列命令输出:
answer_vicuna = find_roots (llm=vicuna, equation=equation)
0
我们来看一下 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
© THE END
转载请联系本公众号取得授权
投稿或寻求报导:content@jiqizhixin.com
桂¥哥¥网¥络www.guIgeGe.cn
本文来源于chatgptplus账号购买平台,转载请注明出处:https://chatgpt.guigege.cn/jiaocheng/29780.html 咨询请加VX:muhuanidc