GPT-1

2018年大型语言模型

GPT-1,全稱基於轉換器的生成式預訓練模型1Generative Pre-trained Transformer 1)是繼2017年Google推出Transformer架構後,OpenAI推出的第一個大型語言模型[3]。2018年,OpenAI發布了一篇名為《通過生成式預訓練提高語言理解能力》(Improving Language Understanding by Generative Pre-Training)的論文,其中介紹了該初期模型以及基於轉換器的生成式預訓練模型的總體概念[4]

生成型預訓練變換模型 1
Generative Pre-trained Transformer 1(GPT-1)
原作者OpenAI
首次發布2018年2月,​6年前​(2018-02
當前版本
  • 110M (2018年6月11日)[1]
編輯維基數據鏈接
源代碼庫 編輯維基數據鏈接
由…取代GPT-2
類型
許可協議MIT[2]
網站openai.com/blog/gpt-2-1-5b-release/
原始GPT架構

在此之前,表現最佳的神經網絡自然語言處理模型主要採用依靠大量手動標記數據的監督學習。這種依賴於監督學習的方法限制了它們在未經精細標註的數據集上的應用,並使訓練超大模型相當耗時且開支非常昂貴[5][6];許多語言(例如斯瓦希里語海地克里奧爾語)由於缺乏能創建起語料庫的文本資料,導致模型難以對其進行翻譯和解釋[6]。相比之下,GPT採用了「半監督」方法,包含兩個階段:無監督生成式「預訓練」階段,使用目標函數來設置初始參數;以及有監督的判別式微調英語fine-tuning (machine learning)」階段,將這些參數在目標任務上進行微調[5]

與之前基於注意力增強的循環神經網絡(RNN)技術相比,GPT採用的Transformer架構為模型提供了比循環機制更加結構化的記憶;使其擁有「跨多樣任務的穩健傳輸性能」[5]

選擇BookCorpus的原因 編輯

選擇BookCorpus作為訓練數據集的一部分原因是其中包含了長篇連續文本,有助於模型學習處理長距離信息[7]。該數據集包含來自各種流派的7,000多本未發表的小說。當時其他可用的數據集雖然更大,但缺乏這種長距離結構(在句子級別上被「洗牌」)[5]

研究人與使用ftfy庫清理BookCorpus文本,以標準化標點和空格,並由spaCy進行標記化[5]

架構 編輯

GPT-1採用了十二層的僅解碼變換器,使用了12個掩碼的自注意力頭,每個頭有64個維度狀態(總共768個維度狀態)。GPT-1採用了Adam優化算法英語stochastic gradient descent#Adam,而非簡單的隨機梯度下降英語stochastic gradient descent;學習率在前2000次更新中線性增加到最大值2.5×10−4,然後通過餘弦調度減少到0[5]

儘管微調是針對特定任務進行調整的,但其預訓練過程並沒有調整;為了執行各種任務,只對其底層的與任務無關的模型架構進行了最小的更改[5]。儘管如此,GPT-1仍然在多個語言處理任務中改進了以往的基準,在許多任務上的表現優於面向任務的判別式訓練模型[5]

性能與評估 編輯

在自然語言推理(又稱文字蘊涵)任務中,GPT-1在QNLI(維基百科條目)和MultiNLI(轉錄的演講、流行小說和政府報告等來源)兩個數據集上分別比以往最佳結果提升了5.8%和1.5%。該任務評估的是其解釋一對句子,並將它們之間的關係分類為「蘊涵」、「矛盾」或「中立」的能力[5][8]。在與問題回答和常識推理英語commonsense reasoning相關的兩個任務上,GPT-1也優於以前的模型,分別在RACE(中學和高中考試題目的數據集)上提升了5.7%[9],在Story Cloze Test上提升了8.9%[10]

在語義相似性(又稱釋義檢測)任務方面,GPT-1預測兩個句子是否語義對等的能力比以往最佳結果提高了4.2%,該任務使用了Quora問題對(Quora Question Pairs,QQP)數據集[5]

在使用語言可接受性語料庫(Corpus of Linguistic Acceptability,CoLA)進行文本分類任務時,GPT-1獲得了45.4分,而以前最好的得分是35.0[5]。在GLUE(一種多任務測試)上,GPT-1取得了72.8的總體得分,優於以前的最好成績68.9分[11]

參考資料 編輯

  1. ^ https://huggingface.co/transformers/pretrained_models.html.
  2. ^ gpt-2. GitHub. [2023-03-13]. (原始內容存檔於2023-03-11). 
  3. ^ Vaswani, Ashish; Shazeer, Noam; Parmar, Niki; Uszkoreit, Jakob; Jones, Llion; Gomez, Aidan N.; Kaiser, Lukasz; Polosukhin, Illia. Attention Is All You Need. 2017-06-12. arXiv:1706.03762  [cs.CL]. 
  4. ^ Archived copy. [2023-04-29]. (原始內容存檔於2023-04-15). 
  5. ^ 5.00 5.01 5.02 5.03 5.04 5.05 5.06 5.07 5.08 5.09 5.10 Radford, Alec; Narasimhan, Karthik; Salimans, Tim; Sutskever, Ilya. Improving Language Understanding by Generative Pre-Training (PDF). OpenAI: 12. 2018-06-11 [2021-01-23]. (原始內容存檔 (PDF)於2021-01-26). 
  6. ^ 6.0 6.1 Tsvetkov, Yulia. Opportunities and Challenges in Working with Low-Resource Languages (PDF). Carnegie Mellon University. 2017-06-22 [2021-01-23]. (原始內容存檔 (PDF)於2020-03-31). 
  7. ^ Zhu, Yukun; Kiros, Ryan; Zemel, Richard; Salakhutdinov, Ruslan; Urtasun, Raquel; Torralba, Antonio; Fidler, Sanja. Aligning Books and Movies: Towards Story-like Visual Explanations by Watching Movies and Reading Books. 2015-06-22. arXiv:1506.06724  [cs.CV]. # of books: 11,038 / # of sentences: 74,004,228 / # of words: 984,846,357 / mean # of words per sentence: 13 / median # of words per sentence: 11 
  8. ^ Williams, Adina; Nangia, Nikita; Bowman, Samuel. A Broad-Coverage Challenge Corpus for Sentence Understanding through Inference (PDF). Association for Computational Linguistics. 2018-06-01 [2021-01-23]. (原始內容存檔 (PDF)於2020-02-11). At 433k examples, this resource is one of the largest corpora available for natural language inference (a.k.a. recognizing textual entailment), [...] offering data from ten distinct genres of written and spoken English [...] while supplying an explicit setting for evaluating cross-genre domain adaptation. 
  9. ^ Lai, Guokun; Xie, Qizhe; Hanxiao, Liu; Yang, Yiming; Hovy, Eduard. RACE: Large-scale ReAding Comprehension Dataset From Examinations. 2017-04-15. arXiv:1704.04683  [cs.CL]. 
  10. ^ Mostafazadeh, Nasrin; Roth, Michael; Louis, Annie; Chambers, Nathanael; Allen, James F. LSDSem 2017 Shared Task: The Story Cloze Test (PDF). Association for Computational Linguistics. 2017-04-03 [2021-01-23]. (原始內容存檔 (PDF)於2020-11-22). The LSDSem』17 shared task is the Story Cloze Test, a new evaluation for story understanding and script learning. This test provides a system with a four-sentence story and two possible endings, and the system must choose the correct ending to the story. Successful narrative understanding (getting closer to human performance of 100%) requires systems to link various levels of semantics to commonsense knowledge. 
  11. ^ Wang, Alex; Singh, Amanpreet; Michael, Julian; Hill, Felix; Levy, Omar; Bowman, Samuel R. GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding. 2018-04-20. arXiv:1804.07461  [cs.CL].