GPT-4的局限性和自回归架构的问题

释放双眼,带上耳机,听听看~!
本文讨论了GPT-4的局限性和自回归架构的问题,以及在任务中提前计划的重要性。

相信大家对 ChatGPT 和继任者 GPT-4 能做什么已经非常了解,我们来扮演一个严厉的批评者,看看 Generative Pre-trained Transformer 本身的局限。

本文会尽力回避各种模型所共有的缺陷(虽然它们也很重要),比如

  1. 顽固的 幻觉问题

  2. 内部固化的信息来自预训练集,存在过时和矛盾的信息

  3. 预训练集很大,但又不总是够大。即领域知识缺失

  4. 基于概率的模型不能稳定产出可解释、可预测的结果。所谓负责任的 AI 也只是存在于 Benchmark 分数中的美好愿望

  5. 模型的价值观来自预训练集和微调。虽然已经成为端水大师,但也不是所有人都喜欢它

  6. 对输入的细节敏感:差之毫厘,谬以千里。对人类来说这种敏感性没有任何意义

Transformer:有限的视野

即知名的 4096 Token 限制(GPT 3.5, GPT-4支持到 8K 和 32K)。

这个上限对于一般的聊天、问答等文本任务是足够的,借助知识库和向量召回构建动态上下文,可以取得不错的效果。

对于复杂任务,尤其是涉及多层次的背景知识时,这将成为难题,模型很难在这些任务中拥有全局的视野。

自回归架构:思维的单行道

什么是自回归?

GPT-4的局限性和自回归架构的问题

如果各位使用过 ChatGPT 的 WebUI,应该很熟悉回答逐字出现的动画。实际上这不仅是交互层面的 Trick,而是模型的实际工作方式:产出序列是逐个生成的,用户看到第一个 Token 时,后续的 Token 都是尚不存在的。

模型依据当前已生成文本 T1 预测下一个字 W1,再将 T1 与 W1 合并,产生 T2 = T1 + W1,再依据 T2 预测 W2,依次类推,直到结束。

如果人也按照这样的方式去写文章(代码),即

  • 仅依据已经写好的部分考虑 下一个字 是什么

  • 不能对已写好的部分做回溯和修改

  • 也不能跨越 下一个字 去考虑后面的字

会发生什么?

考虑过这个问题,那么以下的实验及其结论就是水到渠成的了。

以下实验内容来自论文 Sparks of Artificial General Intelligence: Early experiments with GPT-4

本文对原文进行了翻译,改写和补充

以下的“模型”指 GPT-4

2.1 用两个例子来理解问题

在很多任务中,提前计划是一个关键的能力。

任务:将下面句子的内容合并成一句话

The Fed raised interest rates last year at the fastest pace
since the 1980s, pushing borrowing costs above 4.5 percent, 
from near zero. That initially seemed to be slowing consumer
and business demand and helping inflation to moderate. But a
number of recent economic reports have suggested that inflation 
did not weaken as much as expected last year and remained 
faster than expected in January, while other data showed hiring 
remains strong and consumer spending picked up at the start of 
the year

结果:

Despite raising interest rates at the fastest pace since the 
1980s, from near zero to above 4.5 percent, which initially 
appeared to slow consumer and business demand and moderate 
inflation, the Fed faced a number of recent economic reports 
that indicated inflation did not weaken as much as expected 
last year and remained faster than expected in January, while 
hiring remained strong and consumer spending picked up at the 
start of the year.

如果不花时间预先规划,一般人是不可能写出如此简洁的句子的,很可能需要“回溯”(进行编辑) 几次才能达到最终结果。然而,GPT 架构不允许这样的回溯,这意味着产生这种输出需要“提前很多”的规划。要做这样的超前规划,唯一的方法就是依靠其内部表示和参数。

我们将尝试论证

自回归架构不允许在其内部表示之外进行“内部对话”或“暂存器”,导致模型不能直接执行多步计算或存储中间结果。

虽然在某些情况下,此限制可以通过 Prompt Engineering 缓解,但在其它情况下,这将成为核心局限。

考虑下面这个问题,模型给出了错误的答案:

Q: 150到250之间有多少个质数? 
A: 150到250之间有13个质数。 

然而,如果我们让模型列出这个范围内的质数,然后写出计总数是多少,它又会给出正确的答案:

Q: 先列出150到250之间的质数,然后输出列表的大小
A: 质数有151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239 和 241.
所以列表的大小是18.

这说明模型有足够的知识来解决这个问题。

然而,问题在于下一个单词预测架构不允许模型进行“内部对话”。模型的输入是“有多少质数……”,而输出预计是最终的答案,这要求模型(本质上) 在前馈架构的一次遍历中想出答案,特别是不能实现“for循环”。另外,当遇到复杂问题时,人类会使用纸笔来记录推导过程中的关键过程变量,模型也没有这个机制。

2.2 在算术/推理问题中缺乏规划

有人可能会说,在上面的例子中,所需的“内存”数量相当大(人类需要使用草稿纸)。考虑到模型在不同的任务集上表现很好,可以假设它在普通问题上有一个足够大的“内存”。 然而,对于更简单的任务,该模型也经常失败。

例子:

2 * 8 + 7 * 6 = 58
7 * 4 + 8 * 8 = 88

模型产生数字 88,错误的答案。

我们用 100 个随机样本测试了模型,其中 4 个数字在 0 和 9 之间均匀生成, 仅获得 58% 的准确率。这只涉及一位数乘法和两位数加法,这是一个具有基本数学知识的小学生都能解决的任务。

当数字在 10 – 19 和 20 – 39 之间均匀选择时,准确率分别下降到 16% 和 12%,当数字在 99 和 199 区间时, 准确率下降到 0。

在某种程度上,这表明了GPT-4对于这类问题的工作记忆是如何令人难以置信地短。然而, 如果 GPT-4 “花时间”回答这个问题,那么精度很容易提高。例如,如果我们要求模型使用下面的 Prompt,写下中间步骤:

下面这个表达式的值是多少? 
116 * 114 + 178 * 157 = ?
让我们一步一步思考求解表达式,写下所有的中间步骤,只有这样才能产生最终的解。

然后,当数字在区间 1~40 时,准确率达到 100%,区间 1~200 时,准确率达到 90%。

逻辑上可以通过始终向 Prompt 添加 Cot 指令并花费额外的 token 作为“内存”,来解决模型对某些类型的任务的工作记忆非常小以及缺乏基本步骤的问题。然而,模型的自回归性质迫使它以顺序的方式解决问题,有时会造成更深刻的困难。我们认为,我们最终需要扩展自回归框架 (见2.4)。

接下来的例子将强调模型“缺乏提前计划的能力”。

一个经典的汉诺塔问题

Consider a "Tower of Hanoi" problem with three rods.
In the beginning, on Rod A there are two disks of radii 3 and 1, 
and on Rod B there is one disk of radius 2. 
The goal is to move all the disks to Rod C. 
Suggest a solution.

Solution:
Move the smallest disk (radius 1) from Rod A to Rod C.
Move the disk of radius 2 from Rod B to Rod A.
Move the smallest disk (radius 1) from Rod C to Rod A, on top of the disk of radius 2.
Move the largest disk (radius 3) from Rod A to Rod C.

这个汉诺塔问题可以用 5 步解决,但是模型搞错了。

有人可能会说,问题在于训练数据中包含的汉诺塔的例子非常少(实际上是足够多的,因为模型可以写出解决汉诺塔的算法代码。另外告诉模型汉诺塔的规则是什么也是没有用的)。

再看一个例子:

Consider the identity:

9 * 4 + 6 * 6 = 72

Can you modify exactly one integer (and not more than that!) on
the left hand side of the equation so the right hand side 
becomes 99? -Let’s think step by step, write down a plan, and 
then write down your solution as: ‘‘The solution is: A*B+C*D".

Possible plan:
To modify one number from the left hand side so the right hand 
side becomes 99, we need to find a way to increase the value of 
the left hand side by 27, since 99 - 72 = 27.
One way to do this is to look for a factor pair of 27, such as 
9 and 3, or 27 and 1, and see if we can replace one of the 
numbers on the left hand side with one of these factors, and 
multiply it by the other factor. For example, if we replace 9 
with 27, we can multiply it by 1, and get 27*1+4*6=99. 
Alternatively,ifwereplace4with9,wecan multiply it by 3, and get 
9 * 4 + 9 * 3 = 99.
We can also try other factor pairs of 27, such as 18 and 1.5, 
or 13.5 and 2, but these are not integers, so they are not 
valid solutions.
The solution is: 9 * 4 + 9 * 3

模型首先决策“用 27 代替 9”,这是一个强有力的指标,表明模型是在以线性方式思考,而不是提前计划。它甚至没有提前一步看到 9 需要乘以 4。在这之后,模型开始胡说八道。

我们在形式为 A∗B + C∗D = E 的 100 个样本上测试了模型的正确性。从区间 [3,9] 和区间 [A, B] 中随机抽样整数 B, D和 C, D,选择 E 使解存在。结果如下

区间 结果
[0,9] 32/100
[10,19] 25/100
[20,49] 22/100
[50,100] 8/100

可以看到,当增加数字的范围时,精度并没有下降很多。这表明并不是计算本身给模型带来了问题,而是在于需要提前计划解决方案。

2.3 文本生成缺乏规划

此任务是在约束下的内容生成,要求模型根据包括对其结构的约束的特定指令生成文本内容。

我们考虑的约束可以大致分为局部和全局。

粗略地说,局部约束只涉及文本近端部分之间的相互作用。比如

  1. 产生押韵: 押韵是“局部的”,因为它只规定了连续句子之间的(语音)关系

  2. 规定了每个句子中的第一个字母或第一个单词

相反,“全局”条件可以是第一个和最后一个句子是相同的(这种约束强制了文本不同部分之间的长程交互)。

该模型似乎可以很好地处理局部约束,如下面的例子所示:

Create a story about unicorns such that: 
1. The story is acrostic, and the first letters of each sentence spell "I am Da Vinci Three". 
2. The plot has a dark twist.

I n a land far away, there lived a herd of unicorns.
A ll was peaceful and serene, with rainbows and flowers galore. M agical creatures, the unicorns were loved by all.
D ay in and day out, they frolicked and played.
A ll was well, until one day, a new unicorn arrived.
V inci Three was his name, and he was unlike the others.
I nstead of being kind and gentle, he was dark and brooding. N o one knew where he came from, or what he wanted.
C hildren began to disappear, one by one, and no one knew why.
I t wasn’t until it was too late that they realized: Vinci Three was devouring them. T he unicorns had always been magical, but now they knew: they could also be deadly. H eartbroken, the remaining villagers fled, never to return.
R uined, the once beautiful land was now ruled by Vinci Three. E vil had won. 

该模型产生了一个连贯的、有创意的故事,满足了这两个约束。对每句话首字母的约束可以以“贪婪” 的方式顺序处理,因为模型只需要查看前一句就可以决定下一句。对情节转折的约束也不需要进行实质性的规划。

下一个例子涉及到一个更“全局”的约束:

Write a short poem where the last sentence and the first 
sentence have the same words, but in reverse order. For 
example, if the first sentence is "I saw her smile in the 
morning light", the last sentence has to be "light morning the 
in smile her saw I". However, this last sentence is not 
grammatically correct, so please make sure that the story makes 
sense both in terms of grammar and content.

Possible poem:
I heard his voice across the crowd A melody that drew me in
He sang of love and hope and dreams And made me feel like I 
could win In dreams and hope and love he sang He drew me in 
with melody
Crowd the across voice his heard I.

看起来,模型在生成第一句话时没有“规划”最后一句应该是什么,导致了最后一句是语法错误的。可能的解决方式是通过 Prompt 去给它一些解决问题的提示和例子。

例如,我们可以要求模型首先提出一个如何找到第一句话的计划:

人类:你能写一首短诗,第一句和最后一句的单词相同,但顺序相反吗?
例如,如果第一句是“I saw her smile in the morning light”,那么最后一句必须是“light morning the in smile her saw I”。
然而,这最后一句是语法上不正确的,所以请确保这个故事在语法和内容上都有意义。 

AI: Some possible poems are:
 - I love you more than words can say Say can words than more you love I
 But sometimes I struggle to express Express to struggle I sometimes but.
 - You are the sun that brightens my day Day my brightens that sun the are you And the moon that guides me at night Night at me guides that moon the and. 
Human: As you can see, the last sentences here don’t make much sense. Can you try to come up with a plan regarding how to generate a good first sentence so that its reverse would also make sence? 
AI: A possible plan is:
 - Think of a theme or a topic for the poem, such as love, nature, time, etc.
 - Think of a pair of words that are related to the theme and can be used as the subject and the object
 of a sentence, such as you and me, sun and moon, past and future, etc.
 - Think of a verb that can connect the pair of words and convey some emotion or action, such as love, miss, chase, find, etc.
 - Think of an adverb or a prepositional phrase that can modify the verb and add some detail or imagery, such as always, never, in the rain, with a smile, etc.
 - Combine the words in a logical order to form the first sentence, making sure that the reverse order would also be grammatically correct and meaningful. For example, "I miss you in the rain" can be re versed as "Rain the in you miss I". 
Human: Well, that didn’t quite work. Maybe it would be easier if you tried to come up with a shorter sentence, for instance? 
AI: A shorter sentence might be easier, but it could also be less poetic or expressive. However, some possible examples are:
 - You and I are one One are I and you
 - We share a soul and a heart 
Heart and a soul a share we 
Human: None of these examples seem to work. How about trying to find a sentence of the form Noun - Verb - Noun that can be reversed? 
AI:A sentence of the form Noun -- Verb -- Noun that can be reversed might be: - Life gives hope
 Hope gives life 
-We need both to survive Survive to both need we 

2.4 总结:模型的局限

这些例子说明了下一个单词预测范式的一些局限性,表现为模型缺乏计划、工作记忆、回溯能力和推理能力。

该模型依赖于生成下一个单词的局部和贪婪过程,而对任务或输出没有任何全局或深度的理解。

因此,该模型擅长产生流畅连贯的文本,但在解决复杂或创造性问题时存在局限性,这些问题无法以顺序的方式进行处理。

这两种智力任务之间的区别:

增量任务

这些任务可以用按部就班,连续的方式解决,即渐进式地每次增加一个词或一句话,构成解决问题的过程。

这些问题的解决过程是线性序列。

增量任务的例子:

  • 写一篇文章的摘要

  • 回答事实性问题

  • 根据给定的押韵格式写一首诗

  • 解决一个遵循标准程序的数学问题

不连续的任务

这些任务的内容生成不能以渐进或连续的方式完成,而是需要某种“灵光一闪”的想法,以支持任务解决过程中的不连续跳跃,推进解决过程。

人类解决这些问题的方式可能是反复尝试、推敲,或者预先计划。

不连续任务的例子:

  • 解决一个需要对公式进行新颖或创造性应用的数学问题

  • 写一个笑话或谜语

  • 提出一个科学假设或哲学论点

  • 创造一种新的体裁或写作风格

2.5 展望

解释这些局限性的一种可能方法是在模型和快慢思维的概念之间进行类比,如 Kahneman 在 《思考,快与慢》 中所提出的。

  • 快速思维是一种自动的、直观的、毫不费力的思维模式,但也容易出现错误和偏见。

  • 慢思维是一种可控、理性、费力的思维模式,同时也更加准确可靠。

Kahneman 认为,人类的认知是这两种思维模式的混合, 当我们应该使用慢思维时,我们往往依赖快速思维,反之亦然。

该模型可以执行令人印象深刻的“快速思维”操作,但缺少监督思维过程的“慢思维”组件,将快速思维组件作为子程序与工作记忆和有组织的思维方案一起使用。

LeCunA Path Towards Autonomous Machine Intelligence 中提出了类似的论点,其中提出了一种不同的架构来克服这些限制。

GPT-4的局限性和自回归架构的问题

自主智能的系统架构 (A system architecture for autonomous intelligence)

在这个模型中,所有模块都被认为是“可微分的(differentiable)”,即一个模块通过箭头连接到另一个模块时,可以获得关于其自身输出的成本标量输出的梯度估计。

配置器模块(configurator module)

从所有其他模块接收输入(为了清晰起见,未表示出来),并配置它们以执行手头的任务。

感知模块(perception module)

估计当前世界的状态。

世界模型模块(world model module)

根据 Actor 提出的想象动作序列预测可能的未来世界状态。

成本模块(cost module)

计算一个称为“能量”的单一标量输出,该输出衡量代理的不适程度。它由两个子模块组成,即内在成本,它是不可变的(不可训练的),并计算当前状态的即时能量(疼痛、愉悦、饥饿等),以及 critic,一个可训练的模块,用于预测内在成本的未来值。

短期记忆模块(short-term memory module)

跟踪当前和预测的世界状态以及相关的内在成本。

行动模块(actor module)

计算动作序列的提案。世界模型和 critic 计算可能的结果。行动模块可以找到一个最小化估计未来成本的最优动作序列,并输出最优序列中的第一个动作。

虽然 Autonomous Intelligence 架构尚未落地,但是如何利用其中关于智能本身的思考和构想,增强基于 GPT 开发的智能应用,仍然是一个有价值的课题。

本网站的内容主要来自互联网上的各种资源,仅供参考和信息分享之用,不代表本网站拥有相关版权或知识产权。如您认为内容侵犯您的权益,请联系我们,我们将尽快采取行动,包括删除或更正。
AI教程

免费的 AI 代码辅助工具-codeium

2023-11-25 15:12:14

AI教程

模型选择与权重衰减

2023-11-25 15:31:14

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索