2018年是旨在解决文本处理问题(或更准确地说,处理自然语言(NLP))的机器学习模型发展的转折点。关于如何呈现单词和句子以最准确地提取它们的语义和它们之间的关系的概念性理解正在迅速发展。此外,NLP社区推广了非常强大的工具,这些工具可以在其模型和管道中免费下载和使用。这个转折点也称为NLP的ImageNet时刻,指的是几年前的时刻,当时类似的发展大大加速了计算机视觉问题领域中机器学习的发展。
![贝尔·乌尔姆菲特·埃尔莫变压器](https://habrastorage.org/webt/uh/cd/qv/uhcdqv--w2t4i8srv9rtzjgk9ac.png)
(ULM-FiT与Korzhik无关,但没有发生更好的事情)
– BERT', , NLP. BERT – , NLP-. , , BERT', . , , , .
![伯特转移学习](https://habrastorage.org/webt/pz/zk/xy/pzzkxyzmqf21r5rik00228zntwm.png)
BERT'. 1: ( ); 2: .
BERT , NLP-, , : Semi-supervised Sequence learning ( – Andrew Dai Quoc Le), ELMo ( – Matthew Peters AI2 UW CSE), ULMFiT ( – fast.ai Jeremy Howard Sebastian Ruder), OpenAI Transformer ( – OpenAI Radford, Narasimhan, Salimans, Sutskever) (Vaswani et al).
, , BERT'. , , .
:
BERT – . :
![伯特分类垃圾邮件](https://habrastorage.org/webt/mx/eo/u_/mxeou__qytr_9_2m6pxjo2icemc.png)
, , (classifier) BERT' . (fine-tuning), Semi-supervised Sequence Learning ULMFiT.
, : , . . («» « »).
![垃圾邮件标记的数据集](https://habrastorage.org/webt/hy/qr/pa/hyqrpadlqytj81eqk3xtkyr3fcu.png)
BERT':
- (sentiment analysis)
- (fact-checking):
- : . : «» (Claim) « » (Not Claim)
- / :
- : (Claim sentence). : «» «»
- Full Fact – , . , , ( , , , )
- :
, BERT', , .
![伯特基地伯特大](https://habrastorage.org/webt/i3/u4/fq/i3u4fq9cclcq0-zeqfk56b5y78i.png)
BERT' :
- BERT BASE () – OpenAI Transformer;
- BERT LARGE () – , (state of the art), .
, BERT – . . , – BERT’ , .
![bert-base-bert-large-encoders](https://habrastorage.org/webt/6k/ce/se/6kcesezyar2zqppjc31sfkcsxak.png)
BERT' ( « » (Transformer Blocks)): 12 24 . (768 1024 ) «» (attention heads)(12 16 ), , (6 , 512 , 8 «» ).
![伯特输入输出](https://habrastorage.org/webt/ed/7k/go/ed7kgoai63syz-koc-_tlqs0gwk.png)
[CLS] , . CLS .
, , BERT , . (self-attention) , .
![伯特编码器输入](https://habrastorage.org/webt/jp/kd/qs/jpkdqszmo06ogw7xbfk1tqmz0kw.png)
, ( , ). .
hidden_size (768 BERT'). , , ( [CLS]).
![伯特输出向量](https://habrastorage.org/webt/at/9b/xe/at9bxefqh-vnkxlc-xkuxlgi13s.png)
. , .
![伯特分类器](https://habrastorage.org/webt/ee/lg/99/eelg99xutp6h7oztqyyz3hv-5e4.png)
(, «», « », « », «» .), .
, , , VGGNet .
![vgg-net-classifier](https://habrastorage.org/webt/sl/37/yf/sl37yfo6xriqw24ule31ukksi8q.png)
. , NLP- , : Word2Vec GloVe. , , , .
, . Word2Vec , ( ), , (.. , «» – «» «» – «»), (, , «» «» , «» «»).
, , , . , Word2Vec GloVe. GloVe «stick» ( – 200):
![手套嵌入](https://habrastorage.org/webt/l1/u-/ad/l1u-admk5irbjkb__sq90albkx0.png)
«stick» GloVe – 200 ( 2 ).
.
![向量框](https://habrastorage.org/webt/gz/ji/ee/gzjieex8v-pmouar89ocbbzan-e.png)
ELMo:
GloVe, «stick» . « », – NLP- ( Peters et. al., 2017, McCann et. al., 2017 Peters et. al., 2018 ELMo). – « «stick» , . , – , , ?». (contextualized word-embeddings).
![Elmo-embeding-robin-williams](https://habrastorage.org/webt/jr/rt/hb/jrrthbwj9xdzd4vgs5ckjgayv0m.png)
.
, , ELMo , . (bi-directional LSTM), .
![词嵌入](https://habrastorage.org/webt/bf/yw/qq/bfywqqcnnk6cw6hr3l3fbl-xq-i.png)
ELMo NLP. ELMo LSTM , , .
ELMo?
ELMo – , (language modeling). , , .
![伯特语言建模](https://habrastorage.org/webt/mq/j1/bo/mqj1bozk08fff_cglqbdcatcuao.png)
ELMo: «Let's stick to», – . . , . , , , , «hang», «out» ( «hang out»), «camera».
, LSTM - ELMo. , .
, ELMo LSTM – , «» , .
![elmo-向前-向后语言模型嵌入](https://habrastorage.org/webt/0w/re/y4/0wrey4vtsshgd7wcgvi_k_cguzk.png)
ELMo
ELMo ( ) ( ).
![电磁嵌入](https://habrastorage.org/webt/d8/dq/ch/d8dqchc0wxmoxmg2e79fnahk3ru.png)
ULM-FiT: NLP
ULM-FiT , – . ULM-FiT .
NLP , , , .
, , , , NLP- LSTM. .
- . ? , (.. , )?
, , NLP-. . : , ( ).
![openai-transformer-1](https://habrastorage.org/webt/3p/-d/q3/3p-dq3wsky9bqnz6mdfv6-y-r2o.png)
OpenAI Transformer
12 . - , . , ( ).
: , . 7 . , .. , – , , .
![openai变压器语言建模](https://habrastorage.org/webt/8d/l0/4k/8dl04ko7gbfw9kiq_jlg5ve281w.png)
OpenAI Transformer 7000
, OpenAI Transformer , . ( «» « »):
![openai变压器句分类](https://habrastorage.org/webt/-l/fo/hr/-lfohrojznururmmrni-ykoqnog.png)
OpenAI , . :
![openai输入转换](https://habrastorage.org/webt/mb/aw/na/mbawnanchccikwp7z4hhe1n0tbi.png)
, ?
BERT:
OpenAI Transformer , . - LSTM . ELMo , OpenAI Transformer . , , ( – « , »)?
« », – .
(masked language model)
« », – .
« !» – . – « , .»
« », – .
![BERT语言建模遮罩lm](https://habrastorage.org/webt/z7/m-/qm/z7m-qmmtz724m8viviqejgzsmjs.png)
BERT «» 15% .
– , BERT , « » (masked language model) ( «-»).
15% , BERT , . .
OpenAI Transformer, , - (, ? , ?).
, BERT , : ( ); , ?
![伯特下句预测](https://habrastorage.org/webt/rz/hr/jf/rzhrjfq5iyequzyykq9tp0urdic.png)
, BERT – . , .. BERT WordPieces, – .
BERT' .
![伯特任务](https://habrastorage.org/webt/03/8i/a7/038ia7qjndp3qhcz8pdkcd_14nw.png)
a) : MNLI, QQP, QNLI, STS-B, MRPC, RTE, SWAG; b) : SST-2, CoLA; c) - : SQuAD v1.1; d) : CoNLL-2003 NER.
BERT
– BERT. ELMo, BERT' . – , , , , (named-entity recognition).
![伯特位嵌入](https://habrastorage.org/webt/ob/pa/a6/obpaa6snqryacqb9vbyaahue7zc.png)
? . 6 ( , 96,4):
![伯特特征提取上下文嵌入](https://habrastorage.org/webt/ir/vr/sv/irvrsv9mefroz7io6ilnjng3fo4.png)
- BERT'
BERT – BERT FineTuning with Cloud TPUs, Google Colab. Cloud TPU, , .. BERT' TPU, CPU GPU.
– BERT':
PyTorch- BERT'. AllenNLP BERT'a .