bert transformer and brief learning

1. Detailed Transformer

https://zhuanlan.zhihu.com/p/48508221 (very good article)

2.Bert learning

https://zhuanlan.zhihu.com/p/46652512

The main innovation of the model are in the pre-train method, which uses the Masked LM and Next Sentence Prediction two methods to capture the words and sentences levels of representation.

In the follow-up mission for the fine-tuning process:

For the sequence-level classification task, BERT directly take the first [CLS] token of the final hidden state.

Why can directly use [CLS] final hidden layer output, its information can represent the entire sentence it? (doubt)

bert there is a problem, it will be 15% of the randomly mask out the token, the final loss function is calculated only mask out token .

How do Mask is a skill, if the mark has been used [MASK] in place (at the time of actual prediction is not touch this mark) will affect the model, so the random mask when 10% of the words will be replaced with another word, 10 % of the words are not replaced, the remaining 80% was only replaced [MASK]. Why such a specific assignment, the author did not say. . . Note that the Masked LM pre-training phase model is not truly know which mask the word, the model should be concerned with every word.

3. https://www.zhihu.com/question/318355038 why the mask?

Reply:

 

 

 4.Masked language model https://www.cnblogs.com/motohq/articles/11632412.html

 

 

5. But bert specific encoding time is how to do? 

 

 

 就看这个图我就不明白了,BERT是怎么实现并行的呢?看起来也是根据句子从前到后或者从后到前的顺序啊。

在进行self-att时,计算过程中使用的是QVK,这直接是可以预先得到所有的,那么上图中bert的每个trm节点,都可以同时计算,不需要依赖于前一个词的输出。(个人理解)

上图中三个模型的不同:

 

 

 BERT是通过上下文去预测当前词,是连续的,而ELMo是独立的前向和后向。

这个讲https://blog.csdn.net/tiantianhuanle/article/details/88597132openai gpt模型,它是单向预测的:

6.bert的源码阅读

http://fancyerii.github.io/2019/03/09/bert-codes/(待看)

7.预训练过程

使用文档级别的语料库,而不是打乱的句子。

8.Bert原论文里提到:

双向的Trf模型通常被称为Transformer encoder,但是 只左上下文的版本称它为Transformer decoder,因为它可以被用来文本生成。

但是看到现在我还是不明白它为啥要随即设置[MASK]???为啥???

9.这里的BASE和LARGE的区别:

 

 这里之前说:

 

那么正常介绍的tr是6层编码,6层解码,那么BASE就是正常的tr,H为块的隐层数,A是自注意力的个数。(个人理解)

LARGE是12个编码,12个解码。

 

 BASE的结构是和GPT一样的,但是BERT使用双向自注意力,后者使用的是单向,只参考左边的作为上下文。

但是BERT左右上下文是怎么结合的?

https://zhuanlan.zhihu.com/p/69351731 这个文章说明了一下。

#而且这里提到的几个问题都是我想弄明白的点,但是却不知如何提问和如何搜索的!!!太好了。

#损失函数是什么?应该是应用到不同的任务上微调时产生的,和业务有关。

对于文中的第三个问题我还不太明白,可以看一下这个https://nlp.stanford.edu/seminar/details/jdevlin.pdf(待看)

文章里说,Bert可以看作Transformer的encoder部分,那到底是不是呢???如果只是encoder,那我上面就理解错了。

确实是上面理解错了,BERT是tr的encoder的堆叠,L是指有多少个encoder的块,而不包括decoder。

 

10.bert双向体现在哪https://www.zhihu.com/question/314280363

 

 原来真的是这个意思啊。

 

体现在训练策略,也就是遮蔽语言模型上,双向是指的语言模型,OMG。还是不怎么理解。

输入怎么就并行了???

句子中所有单词都是一齐进行计算的,self-att是对整个句子的范围计算。(个人理解)

 

 上图真的非常有意思!

 

11.为什么bert的[cls]可以用来做分类?

https://zhuanlan.zhihu.com/p/74090249

 

 12.

Guess you like

Origin www.cnblogs.com/BlueBlueSea/p/12046146.html