Chat-GPT原理

Chat-GPT原理核心:基于Transformer 架构

​ 以下是参考文献的部分截图原文说明:

​ Transformers are based on the “attention mechanism,” which allows the model to pay more attention to some inputs than others, regardless of where they show up in the input sequence. For example, let’s consider the following sentence:

在这里插入图片描述

​ In this scenario, when the model is predicting the verb “bought,” it needs to match the past tense of the verb “went.” In order to do that, it has to pay a lot of attention to the token “went.” In fact, it may pay more attention to the token “went” than to the token “and,” despite the fact that “went” appears much earlier in the input sequence.

​ 原文简单总结:Transformer 架构它允许模型在处理输入序列时,能够同时关注输入序列中各个位置的信息,从而更好地捕捉长距离依赖关系。

Transformer 架构:

​ 特点包括自注意力机制和位置编码,它们使得模型能够有效地捕捉输入序列的长程依赖关系。下面是 Transformer 架构的一些关键组成部分:

自注意力机制(Self-attention):

​ 自注意力机制允许模型在处理序列数据时将不同位置的信息进行交互。通过对每个单词或标记计算注意力权重,模型可以根据输入序列中其他位置的信息来调整每个位置的表示。这使得模型能够捕获远距离的依赖关系,从而更好地理解整个序列。

位置编码(Positional encoding):

​ 由于自注意力机制并不会考虑输入序列中词语的位置信息,因此需要引入位置编码来表示词语在序列中的相对位置。常用的位置编码方法包括正弦和余弦函数的组合,这样可以为不同位置的词语赋予不同的位置编码向量。

编码器-解码器结构(Encoder-Decoder architecture):

​ Transformer 模型通常由编码器和解码器组成,适用于序列到序列的任务,如机器翻译。编码器用于处理输入序列,解码器用于生成输出序列。

多头注意力(Multi-head attention):

​ 为了增加模型对不同表示空间的关注,Transformer 使用多个注意力头来并行计算注意力权重,然后将它们的结果进行拼接和线性变换。

前馈神经网络(Feed-forward neural network):

​ 每个编码器和解码器层都包含一个前馈神经网络,它将每个位置的表示映射为另一个表示,通过多层前馈神经网络可以增加模型的表示能力。

除此之外,Transformer架构还使用了残差连接(residual connections)和层归一化(layer normalization)等技术来加速训练过程和提高模型性能。此外,Transformer架构还支持并行计算,使得模型能够更高效地处理大规模数据。

原文链接建议多读读:How GPT Models Work. Learn the core concepts behind OpenAI’s… | by Beatriz Stollnitz | Towards Data Science

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值