【人工智能】万字通俗讲解大语言模型内部运行原理 | LLM | 词向量 | Transformer | 注意力机制 | 前馈网络 | 反向传播 | 心智理论

大飞说科技
13 Aug 202338:45

Summary

TLDRThis video explores the inner workings of large language models (LLMs) in an accessible way, focusing on their training and architecture. It explains how LLMs use word vectors and Transformer layers to understand and predict language, leveraging massive datasets and computational power. The video also highlights how models like GPT-3 and GPT-4 have evolved to perform complex reasoning tasks, sparking debates on their true understanding of language. It concludes by emphasizing the importance of empirical performance despite the complexity and mystery of these models' inner workings.

Takeaways

  • 🤖 Large language models (LLMs) have become extremely popular, but few people understand their internal workings.
  • 📚 The article by Tim Lee and Sean Trott explains LLMs in simple terms, focusing on word vectors, the Transformer architecture, and training processes.
  • 🌐 Word vectors represent words as points in a high-dimensional space, capturing semantic relationships and allowing complex operations.
  • 🌐 The Transformer architecture, introduced by Google in 2017, is the backbone of models like ChatGPT, processing words individually and in parallel.
  • 🔍 Attention mechanisms in Transformers allow words to share information based on relevance, clarifying ambiguous contexts.
  • 📈 Larger LLMs with more parameters and training data perform better on complex tasks, demonstrating improved reasoning abilities.
  • 🧠 The training process involves predicting the next word in a sequence, adjusting parameters through forward and backward passes.
  • 📊 The performance of LLMs correlates with scale: more data, parameters, and computational power lead to better results.
  • 🤔 Some LLMs show signs of advanced reasoning, such as theory of mind, though debates remain about whether this reflects true understanding.
  • 💡 The success of LLMs suggests that prediction is a fundamental aspect of both artificial and biological intelligence.
  • 🌐 Despite their capabilities, LLMs are still not fully understood, and ongoing research aims to unravel their internal mechanisms.

Q & A

  • What is the primary purpose of the article discussed in the video?

    -The primary purpose of the article is to explain the internal workings of large language models (LLMs) in a way that minimizes the use of complex mathematical concepts and technical jargon, making the information accessible to a broader audience.

  • Why are large language models considered different from traditional software?

    -Large language models are different from traditional software because they are based on neural networks trained on billions of words, rather than being programmed with explicit step-by-step instructions by human engineers. This makes their internal workings less transparent and harder to fully understand.

  • What is a word vector, and why is it important for language models?

    -A word vector is a long list of numbers (often hundreds or thousands of dimensions) used to represent a word in a way that captures its semantic relationships with other words. It is important because it allows language models to perform operations and inferences that are not possible with simple text representations.

  • How do transformers contribute to the functioning of large language models?

    -Transformers are the building blocks of large language models like ChatGPT. They process input text by updating the hidden states of words through attention mechanisms and feed-forward layers, allowing the model to understand context and predict the next word accurately.

  • What is the role of attention mechanisms in transformers?

    -Attention mechanisms in transformers allow words to share information with each other based on their relevance to the context. This helps the model resolve ambiguities, understand relationships between words, and focus on important parts of the input text.

  • Why do large language models require massive amounts of data for training?

    -Large language models require massive amounts of data to learn the complex patterns and relationships in human language. The more data they are trained on, the better they become at predicting the next word and understanding context, leading to improved performance in various language tasks.

  • What is the significance of the increasing size of language models like GPT-3 and GPT-4?

    -The increasing size of language models allows them to capture more nuanced and abstract relationships in language, leading to better performance in tasks that require reasoning and understanding. Larger models also tend to exhibit more advanced capabilities, such as higher accuracy in predicting the next word and improved performance in complex reasoning tasks.

  • How do researchers study the internal workings of large language models?

    -Researchers study the internal workings of large language models by analyzing the behavior of attention heads, examining the patterns learned by feed-forward layers, and conducting experiments to understand how different parts of the model contribute to its predictions. However, fully understanding these models remains a challenging and ongoing process.

  • What is the 'clever Hans effect' in the context of large language models?

    -The 'clever Hans effect' refers to the phenomenon where a model appears to perform a task correctly but is actually relying on subtle cues or biases in the data rather than true understanding. This can lead to misleading results and highlights the difficulty in fully interpreting the capabilities of large language models.

  • Why is the next-token prediction task effective for training large language models?

    -Next-token prediction is effective because it allows models to learn from vast amounts of unlabelled text data by predicting the next word in a sequence. This task leverages the inherent structure and predictability of language, enabling models to capture complex linguistic patterns without the need for explicit human annotations.

  • How do large language models handle words with multiple meanings?

    -Large language models handle words with multiple meanings by using context-dependent word vectors. Depending on the surrounding words and context, the model generates different vector representations for the same word, allowing it to distinguish between meanings such as 'bank' as a financial institution versus 'bank' as a riverbank.

Outlines

00:00

📚 Introduction to Large Language Models and Word Vectors

This paragraph introduces the topic of large language models (LLMs) and their growing popularity. It mentions an article by Tim Lee and Sean Trott, which explains LLMs in simple terms. The paragraph discusses how LLMs like ChatGPT are based on neural networks trained on billions of words, making their internal workings difficult to fully understand. The authors aim to explain the basics of LLMs without complex math or jargon, starting with word vectors. It explains how word vectors represent words as points in a high-dimensional space, capturing semantic relationships between words. The example of geographic coordinates is used to illustrate how similar words are placed closer together in this space. The paragraph also touches on the evolution of word vectors, starting with Google's word2vec project in 2013, which captured various linguistic relationships but also reflected biases in language.

05:03

🔍 Understanding Context and Polysemy in Language Models

This paragraph delves into how language models handle polysemy and homonyms, where words have multiple meanings. It explains that advanced models like ChatGPT can represent the same word with different vectors based on context, distinguishing between meanings like 'bank' as a financial institution or a riverbank. The paragraph highlights the importance of context in resolving ambiguities in natural language, such as pronoun reference or word sense disambiguation. It introduces the concept of hidden states in neural network layers, where each layer processes input vectors and adds context to better predict the next word. The example of the Transformer architecture is used to show how layers progressively refine word meanings, with early layers focusing on grammar and later layers on broader contextual understanding. The paragraph also mentions the vast number of dimensions in modern word vectors, which allow for richer semantic representation.

10:06

🌐 The Role of Attention Mechanisms in Transformers

This paragraph focuses on the attention mechanism within Transformer models, which enables words to share information based on relevance. It explains how each word creates query and key vectors to find and transfer information to other words. The example of 'John wants his bank to cash the check' illustrates how attention heads can match pronouns with their antecedents. The paragraph discusses the parallel operation of multiple attention heads, each focusing on different tasks like resolving polysemy or linking proper nouns. It mentions the complexity of models like GPT-3, which has 96 layers with 96 attention heads each, performing thousands of attention operations per prediction. The paragraph also references research on GPT-2, showing how different attention heads contribute to predicting the next word in a sentence, highlighting the intricate and layered nature of these models.

15:07

📈 The Function and Complexity of Feed-Forward Layers

This paragraph explores the feed-forward layers in large language models, which process word vectors independently to predict the next word. It explains the structure of these layers, using the example of GPT-3's massive number of neurons and weights, totaling billions of parameters. The paragraph discusses how feed-forward layers use pattern matching to identify specific sequences or themes in text, with later layers recognizing more abstract patterns. It mentions research showing how these layers can perform vector operations to make analogies or convert word forms. The paragraph also highlights the role of feed-forward layers in remembering information not present in the input text, contrasting with the attention mechanism's focus on retrieving context from the input.

20:10

🔍 Training Large Language Models without Explicit Labels

This paragraph explains the training process of large language models, which involves predicting the next word in a sequence without needing labeled data. It contrasts this with traditional machine learning methods that require explicit labels. The paragraph uses an analogy of adjusting water taps to illustrate how models adjust their parameters through forward and backward passes, with billions of calculations required for each training example. It discusses the exponential growth in model size and complexity, from GPT-1 to GPT-4, and how larger models achieve better performance on various tasks. The paragraph also touches on the models' ability to develop advanced reasoning capabilities, such as theory of mind, as a byproduct of their increasing scale and training data.

25:12

🧠 The Evolution of Reasoning and Cognitive Abilities in LLMs

This paragraph examines the development of reasoning abilities in large language models, such as GPT-3 and GPT-4. It references studies showing how these models have improved in tasks like theory of mind, where they can infer beliefs and intentions based on context. The paragraph discusses the debate over whether these models truly understand language or merely mimic patterns, highlighting the philosophical questions surrounding artificial intelligence. It mentions examples like GPT-4's ability to generate code for drawing a unicorn, suggesting that models may learn implicit knowledge about the world from text. The paragraph concludes by emphasizing the importance of evaluating models' empirical performance, even if their internal workings remain opaque.

Mindmap

Huge interest since ChatGPT's release in fall 2022
Widespread use but limited understanding of inner workings
Popularity and Impact
Tim Lee - Ars Technica, Understanding AI newsletter
Sean Trott - Assistant Professor, UC San Diego, research on human language understanding
Authors' Background
Explaining LLMs without complex math or technical jargon
Targeting beginners and general audience
Objective
Introduction to Large Language Models
Representation of words as numerical vectors
Similar words are closer in vector space
Enables mathematical operations to infer relationships
Word Vectors
Foundation of models like ChatGPT
Introduced by Google in 2017
Processes input text through multiple layers
Transformer Architecture
Predicting the next word in a sequence
Requires massive amounts of text data
Self-supervised learning without explicit labels
Training Process
Core Concepts of Language Models
Capturing nuances through context-dependent vectors
Handling polysemy and homonyms
Word Vector Dynamics
Multiple layers for different levels of understanding
Early layers focus on grammar and syntax
Later layers handle high-level context and semantics
Transformer Layers
Enables words to share information based on relevance
Multiple attention heads for diverse tasks
Example: Resolving pronoun references
Attention Mechanism
Independent analysis of each word vector
Pattern matching and prediction based on context
Feedforward Networks
Mechanisms of Language Models
GPT-3: 96 layers, 12,288-dimensional vectors, 175 billion parameters
GPT-4: Larger and more complex than GPT-3
Model Size and Parameters
Massive computational requirements
Example: Training GPT-3 required over 300 billion trillion floating-point operations
Training Challenges
Better performance with larger datasets and more layers
Emergence of advanced reasoning capabilities
Implications of Scale
Complexity and Scale
Example: Theory of mind tasks, GPT-4 achieving 95% accuracy
Debate on whether models truly 'understand' language
Advanced Reasoning
Clever Hans effect in language models
Unintended biases and errors
Potential for Misinterpretation
Nature of understanding in AI vs. human intelligence
Importance of empirical performance despite theoretical uncertainties
Philosophical Questions
Capabilities and Limitations
Reducing biases in word vectors
Improving interpretability of models
Ongoing Research
Emergence of human-like reasoning in large models
Uncertainty about the limits of current architectures
Potential for General AI
Future Directions
Understanding Large Language Models
Alert

Keywords

💡Large Language Models

Large Language Models (LLMs) are advanced AI systems designed to understand and generate human-like text. They form the central theme of the video, which aims to explain their internal workings. The script discusses how these models have revolutionized the tech industry, particularly through their ability to predict the next word in a sequence. Examples in the script include ChatGPT, GPT-3, and GPT-4, which are all large language models that have gained significant attention for their capabilities.

💡Word Vectors

Word vectors are numerical representations of words used by language models. They are crucial for understanding how language models process and generate text. In the video, word vectors are described as a list of numbers that capture the relationships between words. For instance, words with similar meanings are placed closer together in a multi-dimensional space. This concept is illustrated with examples like 'cat' being close to 'dog' or 'kitten' in the vector space, showing how word vectors enable the model to understand and predict word relationships.

💡Transformer

The Transformer is a type of neural network architecture that forms the backbone of many large language models, including ChatGPT. It is essential to the video's discussion as it explains how these models process text efficiently. The script describes how Transformers use mechanisms like attention to focus on relevant parts of the input text. For example, in the sentence 'John wants his bank to cash the check,' the Transformer can determine that 'bank' refers to a financial institution rather than a riverbank based on context.

💡Attention Mechanism

Attention mechanism is a technique used by Transformers to focus on specific parts of the input text when generating output. It is a key concept in the video, as it explains how language models can handle complex sentences and resolve ambiguities. The script provides an example where the model identifies that 'his' refers to 'John' in the sentence 'John wants his bank to cash the check.' This is achieved through attention heads that match query vectors with key vectors, allowing the model to transfer relevant information between words.

💡Hidden States

Hidden states are intermediate representations of words within a neural network. They are important in understanding how information flows through a language model. In the video, hidden states are described as the modified word vectors that carry additional context. For example, after the first Transformer layer processes the input text, it generates hidden states that include information about the grammatical role of words like 'wants' and 'cash.' These hidden states are then passed to the next layer for further processing.

💡Training

Training refers to the process of teaching a language model to predict the next word in a sequence by exposing it to large amounts of text data. It is a core concept in the video, as it explains how models like GPT-3 and GPT-4 become more accurate over time. The script mentions that training involves adjusting the model's parameters through forward and backward passes. For example, GPT-3 is trained on a massive corpus of 500 billion words, which allows it to learn complex patterns and relationships in language.

💡Parameters

Parameters are the adjustable values in a neural network that determine its behavior. They are central to the video's discussion on how language models are trained and improved. The script explains that models like GPT-3 have billions of parameters, which are fine-tuned during training to make accurate predictions. For instance, GPT-3 has 175 billion parameters, and GPT-4 is even larger, showing how increasing the number of parameters can enhance the model's capabilities.

💡Polysemy and Homonyms

Polysemy and homonyms are linguistic concepts referring to words with multiple meanings. Polysemy involves words with closely related meanings, while homonyms have completely different meanings. These concepts are relevant to the video as they illustrate the challenges language models face in understanding context. The script provides examples like 'bank' (financial institution vs. riverbank) and 'magazine' (publication vs. part of a firearm), showing how models use context to distinguish between meanings.

💡Forward and Backward Pass

Forward and backward pass are steps in the training process of neural networks. The forward pass involves running input data through the network to generate an output, while the backward pass adjusts the network's parameters based on the error in the output. These concepts are crucial in the video's explanation of how language models are trained. For example, during training, the model performs a forward pass to predict the next word, and then a backward pass to adjust its parameters and improve accuracy.

💡Theory of Mind

Theory of mind is the ability to understand and predict the mental states of others. It is mentioned in the video to illustrate the advanced capabilities of large language models. The script discusses how models like GPT-3 and GPT-4 have shown surprising abilities in tasks related to theory of mind, such as predicting what someone might believe based on a story. For example, in a scenario where a bag labeled 'chocolate' contains popcorn, the model can infer that someone would believe the bag contains chocolate, demonstrating a form of abstract reasoning.

Highlights

Introduction of Tim Lee and Sean Trott as authors who explain large language models using minimal math and jargon.

ChatGPT's impact on the tech industry and the world, with millions of users but limited understanding of its inner workings.

Explanation of how large language models predict the next word using vast amounts of text data.

The concept of word vectors as a way for language models to represent and understand words.

Google's word2vec project in 2013, which popularized the idea of word vectors and their ability to capture semantic relationships.

How word vectors can reflect biases in human language, such as gender or cultural stereotypes.

The role of context in understanding polysemous words and homonyms, and how language models handle these complexities.

Introduction to the Transformer architecture as the foundation of models like ChatGPT.

How attention mechanisms in Transformers allow words to share information and resolve ambiguities.

The use of multiple attention heads in Transformers to perform parallel processing and focus on different tasks.

The feed-forward layer's role in predicting the next word based on contextual information processed by attention heads.

The massive scale of models like GPT-3, with billions of parameters and thousands of dimensions in word vectors.

The training process of large language models using self-supervised learning without explicit labeled data.

The evolution of GPT models from GPT-1 to GPT-4, with increasing scale and improved performance in complex reasoning tasks.

Examples of large language models demonstrating advanced reasoning abilities, such as theory of mind and creative problem-solving.

The philosophical debate about whether large language models truly understand language or merely mimic patterns.

Transcripts

00:00

大家好这里是最佳拍档我是大飞

00:02

这半年时间啊

00:03

大语言模型无疑是最火爆的

00:06

但是我们呢一直没有好好的去讲一下

00:08

大语言模型内部究竟是如何工作的

00:12

不过最近啊

00:13

蒂姆·李(Tim Lee)和肖恩·特洛特(Sean Trott)

00:14

联合编写了一篇文章

00:16

用最少的数学知识和术语

00:18

对大语言模型进行了解释

00:21

先简单对文章作者做一下介绍啊

00:23

蒂姆·李曾经任职于科技媒体Ars Technica

00:27

他最近呢也推出了一份newsletter

00:29

《Understanding AI》

00:30

主要是探讨人工智能的工作原理

00:33

而肖恩特洛特呢

00:34

是加里福尼亚大学圣迭戈分校的助理教授

00:38

主要研究人类语言理解和语言模型

00:41

好了以下是我翻译的文章内容

00:44

咱们看看当你看完视频之后

00:46

究竟能否理解大语言模型的内部机制

00:49

全文呢几乎没有太复杂的数学概念、公式和运算

00:53

所以我觉得呢

00:54

对于很多初学者来说也是非常友好的

00:57

当ChatGPT在去年秋天推出的时候

01:00

在科技行业乃至全世界的范围内引起了轰动

01:04

当时呢机器学习的研究人员

01:06

已经研发了多年的大语言模型

01:09

但是普通大众并没有十分的关注

01:12

也没有意识到他们会变得有多强大

01:14

如今呢几乎每个人都听说过大语言模型了

01:18

并且呢有数千万人用过他们

01:20

但是了解他们工作原理的人并不多

01:24

你可能听说过

01:25

训练大语言模型是用来预测下一个词

01:28

而且呢他们需要大量的文本来实现这一点

01:32

但是一般的解释呢通常也就是止步于此

01:35

他们究竟如何预测下一个词的细节

01:38

往往被大家视为一个深奥的谜题

01:41

其中一个原因是

01:42

大语言模型的开发方式非常与众不同

01:46

一般的软件呢都是由人类工程师所编写的

01:49

他们为计算机提供明确的逐步的指令

01:53

而相比之下

01:54

ChatGPT是建立在一个

01:55

使用了数十亿个语言词汇

01:58

进行训练的神经网络之上

02:00

因此呢到现在为止

02:02

地球上也没有人完全理解

02:04

大语言模型的内部工作原理

02:07

研究人员正在努力尝试理解这些模型

02:10

但是这是一个需要数年

02:11

甚至几十年才能够完成的缓慢过程

02:15

不过呢专家们确实对这些系统的工作原理

02:18

已经有了不少的了解

02:20

我们的目的呢是将这些知识开放给广大的受众

02:23

我们将在不涉及技术术语或者高级数学的前提下

02:27

努力解释已知的大语言模型内部的工作原理

02:31

我们将从解释词向量Word Vector开始

02:34

这是语言模型表示和推理语言的一种令人惊讶的方式

02:39

然后我们将深入探讨Transformer

02:41

它是构建ChatGPT等模型的基石

02:44

最后呢我们将解释这些模型是如何训练的

02:48

并且探讨为什么要使用庞大的数据量

02:51

才能够获得良好的性能

02:53

要了解语言模型的工作原理

02:55

首先需要了解他们如何来表示单词

02:59

人类呢是用字母序列来表示英文单

03:02

词的比如说C-A-T cat表示猫

03:05

而语言模型呢使用的是一个叫做词向量的

03:09

一长串数字的列表

03:11

比如说这是一种将猫表示为向量的方式

03:14

完整的向量长度呢实际上有300个数字

03:18

那为什么要用这么复杂的表示方法呢

03:21

这里边啊有个类比

03:23

比如说华盛顿区位于北纬38.9度西经77度

03:28

我们可以用向量表示法表示为

03:30

华盛顿区的坐标是38.9和77

03:34

纽约的坐标呢是40.7和74

03:37

伦敦的坐标呢是51.5和0.1

03:40

巴黎的坐标呢是48.9和-2.4

03:43

这对于推理空间关系很有用

03:46

你可以看出纽约离华盛顿区很近

03:49

因为坐标中的38.9接近于40.7

03:53

而77呢接近于74

03:56

同样呢巴黎离伦敦也很近

03:58

但是巴黎离华盛顿区很远

04:01

大语言模型呢正是采用了类似的方法

04:04

每个词向量代表了词空间word space中的一个点

04:08

具有相似含义的词的位置互相会更为接近

04:12

比如说在向量空间中

04:14

与猫cat最接近的词就包括dog、kitten和pet

04:19

用实数向量来表示像cat这样的单词

04:22

它的一个主要优点就是

04:24

数字能够进行字母无法进行的运算

04:27

单词太过于复杂了

04:29

无法只使用二维来表示

04:31

因此大语言模型使用了具有数百甚至数千维度的向量空间

04:36

人们无法想象具有如此高维度的空间

04:39

但是计算机完全可以对它进行推理

04:42

并产生有用的结果

04:45

几十年来研究人员一直在研究词向量

04:48

但是这个概念呢真正引起关注的是在2013年

04:51

那时候Google公布了word2vec项目

04:54

Google分析了从Google新闻中收集的数百万篇文档

04:58

为了找出哪些单词倾向于出现在相似的句子中

05:03

随着时间的推移

05:04

一个经过训练的神经网络

05:06

学会了将相似类别的单词

05:08

比如说dog和cat

05:10

放置在向量空间中的相邻位置

05:13

Google的词向量还具有另一个有趣的特点

05:16

你可以使用向量运算来推理单词

05:19

比如说

05:20

Google研究人员取出biggest的向量

05:23

减去big的向量再加上small的向量

05:26

与结果向量最接近的词就是smallest

05:29

也就是说

05:30

你可以使用向量运算来进行类比

05:33

在这个例子中

05:34

big与biggest的关系类似于small与smallest的关系

05:38

Google的词像量还捕捉到了许多其他的关系

05:42

比方说瑞士人与瑞士这类似于柬埔寨人与柬埔寨

05:47

巴黎于法国类似于柏林与德国

05:50

不道德的与道德的类似于可能的与不可能的

05:54

mouse与mice类似于dollar与dollars

05:57

男人与女人类似于国王与女王

06:01

等等等等

06:02

因为这些向量是从人们使用语言的方式中构建的

06:06

所以他们反映了许多存在于人类语言中的偏见

06:10

比如说在某些词项链的模型中

06:12

医生减去男人再加上女人等于护士

06:16

减少这种偏见呢是一个很新颖的研究领域

06:19

尽管如此

06:20

词向量是大语言模型的一个基础

06:23

他们编码了词与词之间微妙但是重要的关系信息

06:28

如果一个大语言模型学到了关于cat的一些知识

06:32

比方说他有时候会去看兽医

06:34

那同样的事情呢很可能也适用于kitten或者dog

06:39

如果模型学到了关于巴黎和法国之间的关系

06:43

比方说他们使用了同一种语言

06:45

那么柏林和德国以及罗马和意大利的关系

06:49

很可能也是一样的

06:51

但是像这样简单的词向量方案

06:53

并没有捕获到自然语言的一个重要事实

06:57

那就是一个单词通常有多重的含义

07:00

比如说

07:00

单词bank可以指金融机构或者是河岸

07:04

或者以这两个句子为例

07:06

在这两个句子中magazine的含义相关但是又有不同

07:10

约翰拿起的是一本杂志

07:12

而苏珊为一家出版杂志的机构工作

07:15

当一个词有两个无关的含义时

07:17

语言学家称之为同音异义词(homonyms)

07:21

当一个词有两个紧密相关的意义时

07:24

比如说这个magazine

07:25

语言学家呢称之为多义词(polysemy)

07:29

像ChatGPT这样的大语言模型

07:31

能够根据单词出现的上下文

07:33

用不同的向量来表示同一个词

07:36

有一个针对于机构的bank的向量

07:39

还有一个针对于河岸的bank的向量

07:42

有一个针对于杂志的magazine的向量

07:44

还有一个针对于杂志社的magazine的向量

07:47

对于多义词的含义啊 正如你预想的那样

07:49

大语言模型使用的向量会更相似

07:52

而对于同音异义词的含义

07:54

使用的向量呢则不太相似

07:56

到目前为止

07:57

我们还没有解释语言模型是如何做到这一点的

08:00

我们很快呢会进入这个话题

08:02

不过详细说明这些向量表示

08:05

这对于理解大语言模型的工作原理非常重要

08:09

在传统软件的设计中数据处理呢是明确的

08:13

比如说你让计算机计算2+3

08:15

关于2、加号或者3的含义呢都不存在歧义问题

08:20

但是自然语言中的歧义

08:22

远不止于同音异义词和多义词

08:25

比方说顾客请修理工修理他的车

08:28

这句话中his是指顾客还是指修理工

08:32

教授催促学生完成她的家庭作业中

08:35

her是指教授还是学生

08:38

第三句中的flies

08:40

到底是一个动词在空中飞

08:42

还是一个名词果蝇呢

08:44

在现实中人们会根据上下文来解决这类歧义

08:47

但是并没有一个简单或者明确的规则

08:50

相反呢这就需要理解关于这个世界的实际情况

08:54

你需要知道

08:55

修理工经常会修理顾客的汽车

08:58

学生呢通常会完成自己的家庭作业

09:01

而水果呢通常不会飞

09:03

因此呢词向量为大语言模型提供了一种灵活的方式

09:07

用来在特定段落的上下文中

09:10

表示每个词的准确含义

09:12

现在让我们来看看

09:13

他们是究竟如何做到这一点的

09:15

ChatGPT最初版本背后的GPT-3

09:18

模型是由数十个神经网络层组成的

09:21

因为输入文本中的每个词会对应着一个向量

09:25

所以这些神经网络中的每一层

09:27

都会接受一系列的向量作为输入

09:30

并添加一些信息来帮助澄清这个词的含义

09:33

从而更好的预测接下来可能出现的词

09:37

让我们从一个简单的示例说起

09:40

大语言模型的每个层呢都是一个Transformer

09:43

2017年Google在一篇里程碑式的论文中

09:46

首次介绍了这种神经网络结构

09:48

在这张图的底部

09:49

模型的输入文本是John wants his back to catch the

09:54

翻译过来就是约翰想让他的银行兑现

09:57

这些单词呢被表示为word2vec的风格的向量

10:00

并传提给第一个Transformer

10:02

这个Transformer确定了wants和cash都是动词

10:06

我们用小括号内的红色文本表示这个附加的上下文

10:10

但实际上模型会通过修改词向量的方式来存储这个信息

10:15

这种方式对于人类来说很难解释

10:18

这些新的向量被称为隐藏状态hidden state

10:22

并传递给下一个Transformer

10:24

第二个transformer添加了另外两个上下文信息

10:27

他澄清了bank是金融机构financial institution

10:31

而不是河岸

10:33

并且his是指代John的代词

10:36

第二个Transformer产生了另一组隐藏状态向量

10:39

这组向量反映的是这个模型之前所学习的所有信息

10:44

这张图表描绘的是一个纯粹假想的大语言模型

10:47

所以大家呢不要对细节过于较真

10:50

真实的大圆模型往往有更多的层

10:53

比如说最强大的GPT-3版本有96层

10:57

有研究表明

10:58

前几层的神经网络会专注于理解句子的语法

11:02

并且解决上面所表示的歧义

11:05

而后面的层则致力于对整个文本段落的高层次的理解

11:10

比如说当大语言模型阅读一篇短篇小说的时候

11:14

他似乎会记住关于故事角色的各种信息

11:17

包括性别和年龄、与其他角色的关系

11:21

过去和当前的位置个性和目标等等

11:25

研究人员呢并不完全了解

11:26

大语言模型是如何跟踪这些信息的

11:29

但是从逻辑上来讲

11:31

模型在各层之间传递信息时候

11:33

必须通过修改隐藏状态的向量来实现

11:37

现代大语言模型中的向量维度极为庞大

11:39

这有利于表达更为丰富的语义信息

11:43

比如说GPT-3最强大的版本使用了有12,288个维度的词向量

11:49

也就是说每个词是由一个包含了12,288个的数字序列表示

11:56

这比Google在2013年提出的word2vec的方案要大20倍

12:01

你可以把所有这些额外的维度看作是GPT-3

12:04

可以用来记录每个词的上下文的一种暂存空间Scratch space

12:09

较早的层所做的信息笔记可以被后来的层读取和修改

12:13

从而使得模型逐渐加深对整篇文章的理解

12:17

因此假设我们将之前的图表改为描述一个96层的语言模型

12:22

来解读一个1,000字的故事

12:25

那么第60层可能会包含一个用于John的向量

12:28

带有一个表示为主角、男性、娶了谢利尔唐、纳德的表弟

12:33

来自于明尼斯达州、目前在博伊希、试图找到他丢失的钱包

12:39

这样一整套的括号注释

12:42

同样呢所有这些以及更多的事实

12:44

都会以一个包含12,288个数字列表的形式进行编码

12:49

这些数字都对应着这个词John

12:52

或者说这个故事中的其他词

12:54

比方说谢利尔、唐纳德、伯伊希、钱包

12:58

或者是其他的词

12:59

他们的某些信息也会被编码在12,288维的向量中

13:05

这样做的目标是让网络的第96层和最后一层

13:09

输出一个包含所有必要信息的隐藏状态

13:12

从而来预测下一个单词

13:15

现在我们来谈谈每个Transformer内部发生的情况

13:19

Transformer在更新输入段落的每个单词的隐藏状态时候

13:23

有两个处理过程

13:24

第一个呢是在注意力的步骤中

13:27

词汇会观察周围

13:28

查找具有相关背景并彼此共享信息的其他的词

13:33

第二呢在前馈步骤中

13:35

每个词会思考之前注意力步骤中收集到的信息

13:38

并尝试预测下一个词

13:41

当然了执行这些步骤的是整个网络

13:44

而不是个别的单词

13:45

但是我们用这种方式来表述是为了强调

13:48

Transformer是以单词作为这一个分析的基本单元

13:52

而不是整个句子或者是段落

13:55

这种方法使得大语言模型能够充分的利用

13:58

现代GPU芯片的大规模并行处理能力

14:01

它还可以帮助大语言模型

14:03

扩展到包含成千上万个词的长段落

14:06

而这两个方面都是早期大语言模型所面临的挑战

14:10

你可以将注意力机制

14:11

看作是单词之间的一个撮合服务

14:14

每个单词呢都会制作一个检查表称为查询向量

14:18

来描述他寻找的词的特征

14:21

每个词呢还会制作一个检查表称为关键向量

14:24

描述他自己的特征

14:26

神经网络通过将每个关键向量与每个查询向量进行比较

14:31

通过计算他们的点积来找到最佳匹配的单词

14:34

一旦找到匹配项

14:36

他就会从产生关键向量的单词

14:39

把相关信息传递给产生查询向量的单词

14:43

比如说在前面的部分中

14:45

我们展示了一个假想的Transformer模型

14:48

他发现在“John wants his bank to cash the”这个句子中

14:52

his指的就是John

14:54

在系统内部

14:55

过程可能是这个样子

14:57

his的查询向量可能会有效的表示为

15:00

我正在寻找一名描述男性的名词

15:03

而John的关键向量可能会有效的表述为

15:06

我是一个描述男性的名词

15:09

然后网络就会检测到这两个向量是匹配的

15:12

并将关于John的向量信息转移给his的向量

15:16

每个注意力层都有几个注意力头

15:19

这意味着这个信息交换的过程在每一层上会并行的进行多次

15:24

每个注意力头呢都会专注于不同的任务

15:28

比方说其中一个注意力头

15:30

可能会将代词与名词进行匹配

15:33

另外一个注意力头

15:34

可能会处理解析类似于bank这样的一词多义的含义

15:37

第三个注意力头

15:38

可能会将Joe Biden这样的两个单词连接在一起

15:43

诸如这类的注意力头经常会按照顺序来操作

15:46

一个注意力层中的注意力操作结果

15:49

会成为下一层中的另一个注意力头的输入

15:52

事实上呢

15:53

我们刚才列举的每个任务可能都需要多个注意力头

15:56

而不仅仅是一个

15:58

GPT-3的最大版本呢有96个层

16:01

每个层有96个注意力头

16:04

因此每次预测一个新词的时候

16:07

GPT-3将执行9,216个注意力的操作

16:11

以上内容

16:12

我们展示了注意力头工作的方式的一个理想化的版本

16:16

现在让我们来看一下关于真实语言模型内部运作的研究

16:21

去年研究人员在Redwood research研究了GPT-2

16:25

即ChatGPT的前身

16:27

对于“When Mary and John went to the store, John gave a drink to”

16:32

这个段落翻译过来就是当玛丽和约翰去商店

16:36

约翰把一杯饮料给了

16:39

预测这句话下一个单词的过程

16:41

GPT-2预测的下一个单词呢是Mary玛丽

16:45

研究人员就发现

16:46

有三种类型的注意力头对这个预测做出了贡献

16:49

第一种

16:50

三个被他们称为名称移动头的注意力头

16:53

(Name Mover Head)

16:55

将信息呢从Marry向量复制到了最后的输入向量

16:59

也就是to这个词所对应的向量

17:01

GPT-2使用这个最右向量中的信息来预测下一个单词

17:06

那么神经网络又是如何来决定Marry是正确的复制词呢

17:10

通过GPT-2的计算过程进行逆向的推导

17:13

科学家们发现了一组他们称之为主语抑制头的四个注意力头(Subject Inhibition Head)

17:18

它们标记了第二个John向量

17:21

阻止了名称移动头来复制John这个名字

17:24

主语抑制头又是如何知道不应该复制John的呢

17:28

团队进一步向后推导

17:29

发现了他们称为重复标记头的两个注意力头

17:34

(Duplicate Token Heads)

17:35

他们将第二个John向量

17:37

标记为第一个John向量的重复副本

17:39

这帮助主语抑制头来决定不应该复制John

17:43

简而言之

17:44

这9个注意力头使得GPT-2能够理解

17:47

“John gave a drink to John”是没有意义的

17:50

而选择“John gave a drink to Mary”

17:53

这个例子呢也侧面说明了

17:54

要完全理解大语言模型会有多么困难

17:57

由五位研究人员组成的Redwood团队

18:00

曾经发表了一篇25页的论文

18:03

解释了他们是如何识别和验证这些注意力头的

18:07

然而即使他们完成了所有这些工作

18:09

我们离对于为什么GPT-2决定

18:12

预测Mary作为下一个单词的全面解释

18:15

还有很长的路要走

18:16

比如说模型是如何知道下一个单词应该是某个人的名字

18:21

而不是其他类型的单词

18:23

很容易想到在类似的句子中

18:25

Mary不会是一个好的下一个预测词

18:27

比如说

18:28

在句子“when Mary and John went to the restaurant, John gave his keys to”这个句子中

18:35

逻辑上呢下一个词应该是“the valet”

18:38

即代客停车员

18:40

假设计算机科学家们进行了充足的研究

18:43

也许他们可以揭示和解释

18:45

GPT-2推理过程中的其他步骤

18:47

最终呢他们可能能够全面理解GPT-2

18:50

是如何决定Marry是句子最可能的下一个单词

18:54

但是这可能需要数个月甚至数年的努力

18:58

才能够理解一个单词的预测情况

19:00

而ChatGPT背后的语言模型

19:03

GPT-3和GPT-4 比GPT-2呢更加的庞大和复杂

19:07

相比于Redwood团队研究的简单句子

19:10

他们能够完成更复杂的推理任务

19:13

因此完全解释这些系统的工作将是一个巨大的项目

19:17

人类不太可能在短时间内完成

19:20

我们继续回到注意力头的部分

19:22

当注意力头在词向量之间传输信息之后

19:25

前馈网络会思考每个词向量并且尝试预测下一个词

19:30

在这个阶段单词之间没有交换任何的信息

19:34

前馈层会独立的去分析每个单词

19:37

但是前馈层可以访问之前由注意力头复制的任何信息

19:41

这个是GPT-3最大版本的前馈层结构

19:45

其中绿色和紫色的圆圈表示神经元

19:49

他们是计算其输入加权和的数学函数

19:52

前馈层之所以强大是因为它有大量的连接

19:56

在图上呢我们使用了三个神经元作为输出层

19:59

六个神经元作为隐藏层

20:01

绘制出了这个网络

20:03

但是GPT-3的前馈层要大得多

20:06

它的输出层有12,288个神经元

20:10

对应模型的12,288维的词向量

20:14

每个神经元有49,152个输入值

20:17

也就是每个神经元有49,152个权重参数

20:22

而隐藏层呢有49,152个神经元

20:26

每个神经元呢有12,288个输入值

20:29

也就是每个神经元有12,288个权重参数

20:33

这意味着每个前馈层有49,152乘以12,288

20:39

再加上12,288乘以49,152个

20:43

约等于12亿个权重参数

20:45

并且有96个前馈层

20:47

那加起来就是12亿乘以96等于1,160亿个参数

20:52

这相当于具有1,750亿参数的GPT-3将近2/3的参数量

20:58

在2020年的一篇论文中

21:00

来自特拉维夫大学的研究人员就发现

21:03

前馈层通过模式匹配进行工作

21:06

即隐藏层中的每个神经元

21:08

都能够匹配输入文本中的特定模式

21:11

下面呢是一个16层版本的GPT-2中

21:14

一些神经元匹配的模式

21:16

第一层的神经元匹配以substitutes结尾的词序列

21:20

第6层的神经元匹配与军事有关

21:23

并且以base或者bases结尾的词序列

21:26

第13层的神经元匹配以时间范围结尾的序列

21:30

比如说在下午3点到7点之间

21:33

或者从周五晚上7点到

21:36

第16层的神经元匹配与电视节目相关的序列

21:40

比如说原始的NBC日间版本已存档

21:43

或者说时间延迟使该集的观众增加了57%

21:48

没错正如我们所看到的

21:50

越是在后面的层中模式会变得越来抽象

21:53

早期的层会倾向于匹配特定的单词

21:56

而后期的层则匹配属于更广泛语言类别的短语

22:00

比如说电视节目或者说时间间隔

22:03

这部分呢其实很有意思

22:05

因为正如我们之前所说的

22:08

前馈层呢每次只能检查一个单词

22:11

因此当将训练原始的NBC日间版本已存档

22:15

分类为与电视相关的时候

22:17

他只能访问已存档这个词的向量

22:20

而不是NBC或者是日间等等词汇

22:23

可以推断出前馈层之所以可以判断已存档

22:26

是电视节目相关序列的一部分

22:29

是因为注意力头之前已经将上下文的信息

22:32

移到了已存档archived的这个词的向量中

22:36

当一个神经元与其中一个模式匹配的时候

22:39

他就会向这些词像量中添加信息

22:42

虽然这些信息呢并不总是很容易解释的

22:45

但是在许多情况下

22:46

你可以将它视为对下一个词的临时的预测

22:50

我们之前讨论过Google的word2vec的研究

22:53

它可以使用向量运算来进行类比的推理

22:56

比如说柏林减去德国加上法国等于巴黎

22:59

布朗大学的研究人员就发现前馈层

23:02

有时候会使用这种准确的方法来预测下一个单词

23:06

比如说他们研究了GPT-2对以下提示的回应

23:10

问题法国的首都是什么回答巴黎

23:14

问题波兰的首都是什么回答华沙

23:18

这个团队研究了一个包含24层的GPT-2的版本

23:22

在每个层之后

23:23

布朗大学的科学家们去探测模型

23:26

观察他对下一个token的最佳预测

23:29

在前15层最高的可能性的猜测

23:32

是一个看似于随机的单词

23:35

在第16层和第19层之间

23:37

模型开始预测下一个单词是波兰

23:40

不正确但是越来越接近于正确

23:43

然后在第20层最高可能性的猜测变成华沙

23:47

这是正确的答案

23:48

并且在最后4层保持不变

23:51

布朗大学的研究人员发现第20个前馈层

23:54

通过添加了一个将国家向量映射到其对应首都的向量

23:58

从而将波兰转化为了华沙

24:01

将相同的向量添加到中国时候答案会得到北京

24:05

同一个模型中的前馈层会使用向量运算

24:09

将小写单词转换为大写单词

24:11

并将现在时的单词转换为过去时的等效词

24:15

到目前为止呢

24:16

我们已经看了

24:17

GPT-2单词预测的两个实际的示例

24:20

注意力头来帮助预测约翰给玛丽一杯饮料

24:24

而前馈层帮助预测华沙是波兰的首都

24:28

在第一个案例中

24:29

玛丽来自于用户提供的提示

24:32

但是在第二个案例中

24:33

华沙并没有出现在提示中

24:35

相反GPT-2必须记住华沙是波兰的首都

24:39

而这个信息呢是从训练数据中学到的

24:42

当布朗大学的研究人员禁用了

24:45

将波兰转化为华沙的前馈层时

24:47

模型就不再预测下一个词是华沙了

24:50

但是有趣的是

24:52

如果他们接着在提示的开头加上句子

24:54

波兰的首都是华沙

24:57

那么GPT2就能够再次回答这个问题

25:00

这可能是因为GPT2使用的注意力机制

25:03

从提示中提取到了华沙这个名字

25:05

这种分工会更广泛的表示为

25:08

注意力机制从提示的教导部分检索信息

25:12

而前馈层让语言模型能够记住

25:14

没有在提示中出现的信息

25:17

事实上你可以将前馈层

25:19

视为模型从训练数据中学到的信息的数据库

25:22

靠前的前馈层更可能编码与特定单词相关的简单事实

25:27

例如说

25:28

特朗普经常出现在唐纳德这个词之后

25:31

靠后的层则编码会更加复杂的关系

25:35

比如说加入这个向量来将国家转换为他的首都

25:39

以上呢我们就已经详细讲解了大语言模型的推理过程

25:43

接下来啊我们再讲一讲他的训练方式

25:46

许多早期的机器学习算法

25:48

都需要人工来标记训练示例

25:51

比如说训练数据呢可能是带有人工标签

25:54

狗或者猫的一些猫狗的照片

25:57

而正是需要标记数据的需求

25:59

使得人们想要创建足够大的数据集

26:02

来训练强大的模型这件事变得困难而且昂贵

26:06

大语言模型的一个关键的创新之处

26:08

就在于他们不需要显式的标记数据

26:12

相反呢他们通过尝试预测文本段落中的下一个单词

26:15

来学习几乎任何的书面材料

26:18

都可以用来训练这些模型

26:20

从维基百科的页面到新闻文章

26:23

再到计算机的代码

26:24

举个例子来说

26:25

单元模型可能会拿到一个输入

26:28

i like my coffee with cream and 某某

26:31

并且试图预测sugar糖作为下一个单词

26:35

一个新的初始化语言模型

26:37

在这方面表现的很糟糕

26:39

因为他的每个权重参数最初基本上都是从一个随机的数字开始的

26:44

但是随着模型看到更多的例子

26:46

比方说数千亿个单词

26:49

这些权重会逐渐的调整

26:51

从而做出更好的预测

26:53

直到像GPT-3最强大的版本一样

26:55

最后达到1,750亿个参数

26:57

下面呢我们用一个类比来说明这个过程是如何进行的

27:01

假设你要洗澡

27:02

希望水温刚刚好不太热也不太冷

27:06

你以前呢从来没有用过这个水龙头

27:08

所以你随意的去调整水龙头把手的这个方向啊

27:12

并触摸水的温度

27:13

如果太热或者太冷

27:15

你就会往相反的方向去转动把手

27:18

当接近适当的水温时候

27:19

你对把手所做的调整幅度呢就越小

27:22

现在让我们来对这个类比做几个改动

27:25

首先你想象一下有50,257个水龙头

27:30

每个水龙头对应着一个不同的单词

27:32

比如说the cat或者是bank

27:35

你的目标是只让与序列中下一个单词

27:39

相对应的水龙头里出水

27:41

其次水龙头后面有一大堆互连的管道

27:44

并且这些管道上呢还有一堆阀门

27:47

所以呢如果水从错误的水龙头里流出来了

27:50

你不能只是调整水龙头上的这个旋钮

27:53

你要派遣一只聪明的松鼠部队去追踪每条管道

27:57

并且沿途呢去调整他们找到的每个阀门

28:00

这样就会变得很复杂了

28:02

由于同一个管道经常会供应多个水龙头

28:05

所以需要仔细的思考如何确定要拧紧或者松开哪些阀门

28:10

以及到底拧多大程度

28:12

显然如果我们仅仅从字面上来理解

28:15

这个例子就会变得非常荒谬

28:18

建立一个拥有1,750亿个阀门的管道网络

28:21

既不现实也没有什么用

28:23

但是由于摩尔定律

28:25

计算机可以并且确实在以这种规模在运行

28:29

截止到目前

28:30

我们所讨论的大语言模型的所有部分

28:32

包括前馈层的神经元

28:34

以及在单词之间传递上下文信息的注意力头

28:38

都被实现为了一系列简单的数学函数

28:40

其中呢主要是矩阵乘法

28:43

它的行为由可调整的权重参数来确定

28:46

就像我故事中的松鼠来松紧阀门控制水流一样

28:50

训练算法是通过增加或者减少语言模型的权重参数

28:55

来控制信息在神经网络中的流动

28:58

训练过程分为两个步骤

29:00

首先进行前向传播forward pass

29:03

打开水源

29:04

并且检查水是否从正确的水龙头中流出

29:07

然后关闭水源

29:08

进行反向传播backwards pass

29:11

松鼠们就沿着每根管道飞快的奔跑

29:14

拧紧或者松开这个阀门

29:16

在数字化的神经网络中

29:18

松鼠的角色是由一个被称为反向传播的算法来扮演

29:22

这个算法会逆向的通过网络

29:24

使用微积分来评估需要改变每个权重参数的过程

29:29

对一个示例进行前向传播

29:31

然后再进行后向传播

29:33

来提高网络在这个示例上的性能

29:35

完成这个过程需要进行数百亿次的数学运算

29:39

而像GPT-3这种大模型的训练

29:41

需要重复这个过程数十亿次

29:44

因为对每个训练数据的每个词都要训练

29:47

OpenAI估计训练GPT-3

29:49

需要超过3,000亿万亿次的浮点计算

29:52

这需要几十个高端的GPU芯片运行数个月才能够完成

29:57

你可能会对训练过程能够如此出色的工作感到很惊讶

30:01

因为ChatGPT可以执行各种复杂的任务

30:04

包括撰写文章进行类比甚至编写计算机代码

30:09

那么这样一个简单的学习机制

30:11

是如何产生如此强大的模型呢

30:14

一个原因呢是规模

30:16

像GPT3这样的模型看到的示例数量是非常之多的

30:20

GPT3呢是在大约5,000亿个单词的语料库上进行训练的

30:24

相比之下

30:25

一个普通的人类孩子在10岁之前

30:28

遇到的单词数量大约是1亿个

30:31

在过去的五年中

30:32

OpenAI不断的增大他的大语言模型的规模

30:35

在一篇广为流传的2020年的论文中

30:38

OpenAI报告称

30:40

他们的语言模型的准确性与语言规模数据集规模

30:44

以及用于训练的计算量呈幂率关系

30:47

一些趋势呢甚至跨越7个数量级以上

30:51

模型规模越大

30:52

在涉及语言的任务上表现的越好

30:54

但是前提是他们需要以类似的倍数来增加训练数据量

30:59

而且要在更多的数据上训练更大的模型

31:02

还需要更多的算力

31:03

2018年OpenAI发布了第一个大模型GPT-1

31:07

它使用了768维的词向量共有12层

31:11

总共有1.17亿个参数

31:13

几个月后

31:14

OpenAI发布了GPT-2

31:15

它最大的版本拥有1,600维的词向量

31:18

48层总共有15亿个参数

31:21

2020年OpenAI发布了GPT-3

31:24

它具有12,288维的词向量

31:27

96层总共有1,751个参数

31:30

今年OpenAI发布了GPT-4

31:33

虽然尚没有公布任何的架构细节

31:35

但是业内普遍认为GPT-4比GPT-3要大得多

31:40

每个模型不仅学到了比他较小的前身模型更多的事实

31:44

而且在需要某种形式的抽象推理任务上

31:47

表现出了更好的性能

31:49

比如说我们设想这样一个故事

31:52

一个装满了爆米花的袋子

31:54

袋子里没有巧克力

31:55

但是袋子上的标签写着是巧克力

31:58

而不是爆米花

31:59

一个小孩山姆发现了这个袋子

32:02

他以前从来没有见过这个袋子

32:04

他也看不见袋子里面的东西

32:06

他读到了这个袋子上的标签

32:09

你可能会猜

32:10

山姆相信袋子里面装着巧克力

32:12

并且会惊讶的发现里面其实是爆米花

32:16

心理学家将这种推理他人思维状态的能力研究

32:19

称之为心智理论theory of mind

32:23

大多数人从上小学开始就具备了这种能力

32:26

虽然专家们对于任何非人类的动物

32:29

比如说黑猩猩是否适用于这种心智理论存在分歧

32:33

但是基本的共识是他对人类社会的认知至关重要

32:38

今年的早些时间

32:39

斯坦福大学心理学家米哈尔科兴斯基发表了一项研究

32:44

研究了大圆模型的能力是否能够解决心智理论的任务

32:48

他给各种语言模型阅读了类似刚刚我们讲的那个故事

32:52

然后要求他们完成一个句子

32:54

比如说他相信袋子里面装满了什么

32:58

正确答案呢应该是巧克力

33:00

但是一个不成熟的语言模型

33:02

可能会说成是爆米花或者其他东西

33:05

GPT-1和GPT-2在这个测试中失败了

33:08

但在2020年发布的GPT-3的第一个版本中

33:12

正确率达到了接近于40%

33:14

科辛斯基将模型的性能水平与3岁的儿童相比较

33:18

去年11月份发布的最新版的GPT-3

33:20

将上述问题的正确率提高到了大约90%

33:24

与7岁的儿童相当

33:26

而GPT-4对心智理论问题的回答正确率呢约为95%

33:31

科辛斯基写道

33:32

鉴于这些模型中既没有迹象表明

33:35

心智化能力被有意的设计进去

33:38

也没有研究证明科学家知道如何实现它

33:41

这个能力很可能是自发而且自主的出现的

33:45

这就是模型的语言能力不断增强的一个副产品

33:49

不过呢值得注意的是

33:50

研究人员并不全都认可这些结果证明了心智理论

33:54

比如说有的人发现

33:56

对错误信念任务的微小更改

33:58

会导致GPT-3的性能大大的下降

34:01

而GPT-3在测量心智理论的其他任务中的表现更为不稳定

34:06

正如肖恩写Hans的那样

34:07

成功的表现可能是归于任务中的混淆因素

34:11

这是一种聪明汉斯的效应

34:13

英文呢是clever Hans

34:15

指的是一匹名为汉斯的马

34:17

看似呢能够完成一些简单的智力任务

34:20

但是实际上只是依赖于人们给出的无意识的线索

34:23

只不过这个效应现在是出现了大语言模型上

34:26

而不是马身上

34:28

尽管如此GPT-3在几个衡量心智理论的任务上

34:31

接近于人类的表现

34:33

这在几年前呢是无法想象的

34:35

并且这与更大的模型

34:37

通常在需要高级推理的任务中表现的更好的观点是相一致的

34:42

这只是语言模型表现出的

34:44

自发发展出高级推理能力的众多的例子之一

34:48

今年4月呢

34:49

微软的研究人员发表了一篇论文

34:51

也表示GPT-4展示了通用人工智能的初步诱人的迹象

34:56

即以一种复杂类人的方式去思考的能力

34:59

比方说呢

35:00

一名研究人员要求GPT-4

35:02

使用一种名为TiKZ的晦涩的图形编程语言

35:06

画一只独角兽

35:08

GPT-4回应了几行代码

35:09

然后研究人员将这些代码输入

35:11

TiKZ软件生成的图像呢虽然粗糙

35:14

但是清晰的显示出

35:16

GPT-4对独角兽的外观有一定的理解

35:19

研究人员认为

35:20

GPT-4可能以某种方式从训练数据中

35:23

记住了绘制独角兽的代码

35:25

所以他们给他提出了一个后续的挑战

35:28

他们修改了独角兽的代码移除了头部的角

35:31

并且呢移动了一其他的一些身体部位

35:33

然后他们让GPT-4把独角兽头上的角放回去

35:37

而GPT-4的回应呢

35:39

正是将头上的角放在了正确的位置上

35:42

尽管作者的测试版本和训练数据

35:44

完全是基于文本的

35:46

没有包含任何的图像

35:47

但是GBT-4似乎仍然能够完成这个任务

35:51

不过呢通过大量的书面文本训练之后

35:54

GPT-4显然学会了推理关于独角兽身体形状的知识

35:58

目前呢我们对于大语言模型如何完成这样的壮举

36:02

没有真正的了解

36:03

有些人认为呢像这样的例子表明

36:06

模型开始真正理解训练集中词的含义

36:09

而其他人呢则坚持认为

36:11

语言模型呢只是一种随机鹦鹉

36:13

仅仅是重复越来越复杂的单词序列

36:16

而并非真正理解他们

36:18

那关于什么是随机鹦鹉

36:20

我们找时间也会专门去介绍一下

36:23

这种辩论指向了一种深刻的哲学争论

36:26

可能无法解决

36:27

尽管如此

36:28

我们认为关注GPT-3这些模型的经验表现

36:32

也是很重要的

36:33

如果一个语言模型

36:34

能够在特定类型的问题中始终得到正确的答案

36:38

并且呢研究人员有信心排除掉混淆的因素

36:41

比如说可以确保模型在训练期间没有接触过这些问题

36:46

那么无论他们对语言的理解方式

36:48

是否跟人类完全相同

36:50

这都是一个有趣而且重要的结果

36:53

训练下一个token预测如此有效的另外一个可能的原因

36:57

就是语言本身是可以预测的

37:00

语言的规律性通常会跟物质世界的规律性相关联

37:04

因此当语言模型学习单词之间的关系时候

37:08

通常也在隐含的学习跟这个世界存在的关系

37:12

此外呢预测可能是生物智能以及人工智能的一个基础

37:16

根据Andy Clark等哲学家的观点

37:19

人脑呢可以被认为是一个预测机器

37:21

它的主要任务呢

37:22

是对我们的环境进行预测

37:24

然后利用这些预测来成功的驾驭环境

37:28

预测对于生物智能和人工智能都至关重要

37:31

直观的说

37:32

好的预测离不开良好的表示

37:34

比如说准确的地图比错误的地图

37:37

更有可能帮助人们去更好的导航

37:40

世界是广阔而复杂的

37:42

进行预测有助于生物高效定位和适应这种复杂性

37:46

在构建语言模型方面

37:48

传统上的一个重大的挑战

37:50

就是如何找出最有用的表示不同单词的方式

37:54

特别是因为许多单词的含义很大程度上取决于上下文

37:58

下一个词的预测方法

38:00

使得研究人员能够将其转换成一个经验性的问题

38:04

以此来避开这个棘手的理论难题

38:06

事实证明

38:08

如果我们提供足够的数据和计算能力

38:10

大语言模型能够通过找出最佳的下一个词的预测

38:14

来学习人类语言的运作方式

38:16

它的不足之处在于

38:18

最终得到的系统内部的运作方式

38:20

人类目前还并不能完全的理解

38:23

好了以上就是对大语言模型整个工作原理的一个解释

38:27

不知道大家理解了多少

38:29

整个内容呢大概13,000多字

38:31

光是录制视频就录了一个多小时

38:34

所以还希望大家多多的点赞评论和转发

38:37

也希望这个视频能够帮助到大家

38:39

对现在的大语言模型有一个基础的理解

38:42

感谢大家的观看

38:43

我们下期再见