2019-02-19 GPT-2.0 Language Mode
这两天能一本正经胡说的语言模型GPT-2.0大火,官方OPENAI以模型太强大担心被坏人使用为由,也只公布了117M的模型,是不到号称的15亿参数的十分之一,同时牵起了OPENAI VS CLOSEAI的口水战,看热闹的总是不会闲事大,2019春节刚过,AI领域就一片喧哗,注定今年AI将继续高歌猛进,希望自己能在其中,跟上大部队。
好了,废话不多说,看完热闹,就迫不及待下载了GPT-2.0公布的117M模型跑跑。同时把官方发布的paper Language Models are Unsupervised Multitask Learners拜读了一下,但论文中对如何训练模型介绍得相对较少,重点是在炫各种实验数据。以下是论文摘要:
1. 训练数据:为了获取多样、体量庞大且又有质量的数据作为训练样本,作者 only scraped web pages which have been curated/filtered by humans,但人工筛选是非常expensive,所以作者scraped all outbound links from Reddit, a social media platform, which received at least 3 karma.最终得到over 8 million documents for a total of 40 GB of text的数据作为训练样本
2. 输入模型表示方法:作者没有采用word-level or character-level,而是采用了Byte Pair Encoding (BPE),作者 prevent BPE from merging across character categories for any byte sequence. And add an exception for spaces which significantly improves the compression efficiency while adding only minimal fragmentation of words across multiple vocab tokens. 因为这种方法可以对任何一个Unicode string计算概率,所以该语言模型对任何数据集都不用做预处理。
3.模型:论文写得比较简单,首先指出采用了Transformer,然后是基于OPENAI GPT model稍做修改,下图是OPENAI GPT model模型:
截图来自论文Improving Language Understanding by Generative Pre-Training在这基础上做的少量修改包括:
(1) 将layer normalization移到每个sub-block入口 ;
(2)在每个self-attention block后加normaliztion;
(3)修改residual layers的weights(initialization by a factor of 1/√N where N is the number of residual layers);
(4)词汇量增加到50257;
(5)上下文大小从512增加到1024tokens;
(6)batchsize增加到512
4.实验:这是这篇论文重点展示的部分,分别在以下实验中展示了GPT 2.0 模型的强大
(1) zero-shot domain transfer
(2) Children’s Book Test : examine the performance of LMs on different categories of words: named entities, nouns, verbs, and prepositions.
(3)LAMBADA: tests the ability of systems to model long-range dependencies in text.
(4)Winograd Schema Challenge: measure the capability of a system to perform commonsense reasoning by measuring its ability to resolve ambiguities in text.
(5) Reading Comprehension:CoQA tests reading comprehension capabilities and also the ability of models to answer questions that depend on conversation history.
(6)Summarization: test GPT-2’s ability to perform summarization on the CNN and Daily Mail dataset.
(7)Translation: 完成english-french任务
(8) Question Answering:evaluate how often it generates the correct answer to factoid-style questions
最后推荐一篇张俊林博士新鲜出炉的剖析文章:效果惊人的GPT 2.0模型:它告诉了我们什么