1 GPT Framework
1.1 Unsupervised pre-training
Given an unsupervised corpus of tokens U = {u1, . . . , un}, we use a standard language modeling objective to maximize the following likelihood:
在給定語料上下文環(huán)境下,目標時最大化下面的語言模型,即在給定前 i-1個詞和參數(shù)θ前提下,使第 i 個詞出現(xiàn)的概率最大。
we use a multi-layer Transformer decoder [34] for the language model
我們使用多層Transormer decoder層來實現(xiàn)GPT,公式如下圖所示。
U是輸入語料,We是全量字典token embedding矩陣,Wp是位置embedding 矩陣,n代表了有n層transformer_block.
p(u)是最后輸出的softmax概率
在這里插入圖片描述
1.2 Unsupervised pre-training
有了上面的預(yù)訓(xùn)練模型后,在進行下游任務(wù)。
在給定數(shù)據(jù)x1,x2 …,xm 和label y時,
① 將數(shù)據(jù) X輸入上面預(yù)訓(xùn)練模
② 取預(yù)訓(xùn)練模型的transformer_block最后一層作為預(yù)訓(xùn)練模型輸出
③ 在預(yù)訓(xùn)練模型輸出結(jié)果上再加一層全連接層,權(quán)重Wy,得到分類模型。
④ 最大化分類模型文章來源:http://www.zghlxwxcb.cn/news/detail-553269.html
We additionally found that including language modeling as an auxiliary objective to the fine-tuning helped learning by improving generalization of the supervised model, and accelerating convergence.
怎加語言模型作為微調(diào)模型的附屬任務(wù),有利于改善模型泛化能力和加快收斂。
整個微調(diào)任務(wù),只增加了參數(shù)Wy,沒有增加任何其他參數(shù)。文章來源地址http://www.zghlxwxcb.cn/news/detail-553269.html
到了這里,關(guān)于GPT(Generative Pre-Training)論文解讀及實現(xiàn)(一)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!