【論文筆記】GPT-1:Improving Language Understanding by Generative Pre-Training

Abstract

核心思想: generative pre-training + discriminative fine-tuning

1 Introduction

爲了獲取更多annotation,利用linguistic info從unlabeled data中學習,這很有價值,減輕了對NLP中監督學習的依賴,畢竟許多domains缺乏annotated resources,並且用無監督學習學習到好的表示可以爲監督學習提供一個很大的改進——pre-trained word embeddings有着光明前景,能廣泛使用。

但是從unlabeled text中學習有2個挑戰,這些不確定性使得開發有效的半監督學習approaches變得困難:

  1. 不清楚要使用哪種optimization objectives在學習到用於遷移的表示中最有用;
  2. 哪種方式來transfer這些learned representations to the target task還沒達成共識,具體方式有:

    a combination of making task-specific changes to the model architecture
    using intricate learning schemes
    adding auxiliary(輔助的) learning objectives

這篇論文中,使用了半監督的方法:使用a combination of unsupervised pre-training and supervised fine-tuning.
目標是: learn a universal representation,它只需要一點adaptation就可以遷移到許多task上.
訓練數據: a large corpus of unlabeled text + several datasets with manually annotated training examples(target tasks),兩者不需要in the same domain
訓練程序:1. 使用未標記數據上的語言模型對象去學習神經網絡模型的初始參數;2. 使用相應的監督目標對這些參數進行調整,以適應目標任務。
模型結構:Transformer.
遷移過程中:使用從traversal-style approaches方法派生的特定於任務的輸入自適應方法,該方法將結構化文本輸入處理爲單個連續序列。

2 相關工作

Semi-supervised learning: 在:sequence labeling, text classification上都有使用。但是以前的方式能捕獲word-level or phrase-level statistic,以前的研究者還學到了word embeddings,現在的approaches要捕獲higher-level semantics,比如 character-level, phrase-level or sentence-level embeddings.

Unsupervised pre-training:Unsupervised pre-training is a special case of semi-supervised learning where the goal is to 找到一個好的初始點 instead of modifying the supervised learning objective. 曾經pre-traning方法是一 regularization scheme,使得在深度NN中得到更好的泛化。現在被用於許多task:image classification, speech recognition, entity disambiguation and MT.
還有一些Unsupervised pre-training方式如ELMo是在訓練一個supervised model鍾把pre-trained得到的hidden representations作爲一個auxiliary features 用於target task,這就會涉及到新參數需要change。

Auxiliary training objectives:Adding auxiliary unsupervised training objectives is an alternative form of semi-supervised learning. 早期工作用到了許多輔助NLPtasks比如:POS tagging, chunking, named entity recognition, language modeling來提高semantic role labeling. 現在,會添加auxiliary language modeling objective到目標任務中。

3 Framework

3.1 Unsupervised pre-training 無監督預訓練

使用語言模型最大化下面的式子,k是上下文窗口大小,θ是語言模型參數,我們使用一個神經網絡來模擬條件概率P。
使用multi-layer Transformer decoder作爲語言模型。這是transformer的一個變體。將transformer decoder中Encoder-Decoder Attention層去掉作爲模型的主體,然後將decoder的輸出經過一個softmax層,來產生目標詞的輸出分佈。
Unsupervised pre-training

3.2 Supervised fine-tuning 有監督微調

在這一步我們調整我們預訓練語言模型的參數θ以適應特殊的任務。
在這裏插入圖片描述
此外我們發現將一些語言模型的損失加和特殊任務的損失一起進去微調有兩點好處:

  • 提升監督模型的泛化性
  • 加速收斂

總之,在fine-tuning期間需要添加的參數只要Wy,然後需要embeddings for 定界符(delimiter)tokens.(如下圖)

3.3 Task-specific input transformations

其他任務需要structured inputs, 比如:1. ordered sentence pairs, 2. triplets of documents, questions and answers.
在這裏插入圖片描述
論文使用traversal-style approach 遍歷式方法),在這裏我們將結構化輸入轉換成預訓練語言模型能夠處理的有序序列(見下圖)All transformations include adding randomly initialized start and end tokens (< s>, < e>).在這裏插入圖片描述
Textual entailment :連接premise p和 hypothesis h,中間用delimiter token($)來連接

Similarity:對於相似度任務來說,兩個被比較的句子沒有固有的順序。爲了反映這一點,我們修改輸入序列以包含兩個可能的句子順序(中間有一個分隔符),並分別處理每個序列,以生成兩個序列表示hlm ,在送入線性輸出層之前按元素寬度(element-wise)添加。

QA and Commonsense Reasoning:我們得到一個上下文文檔Z、一個問題Q和一組可能的答案{Ak}。We concatenate the document context and question with each possible answer, adding a delimiter token in between to get [z; q; $; ak]. Each of these sequences are processed independently with our model and then normalized via a softmax layer to produce an output distribution over possible answers.

理解(參考)

  • GPT模型其實質是一個語言模型,它的主體使用的是Transform的decoder部分,因爲decoder在逐詞翻譯的時候會mask掉當前位置以後的詞,所以它也是一個天生的語言模型。
  • GPT堆疊了20層的decoder,而不包括encoder部分。因此在decoder中沒有encoder-decoder attention的子層,但是仍然有self-attention layer子層,在該層會mask將來位置的詞,這樣可以使用它去做語言模型的任務:預測下一個詞:
    詞

4 實驗

4.1 Setup

datasets要text with long range dependencies ,這樣work best with this approach.
it contains long stretches of contiguous text, which allows the generative model to learn to condition on long-range information.

4.2 Supervised fine-tuning

在QA上的:
RACE 數據集,This corpus has been shown to contain more reasoning type questions that other datasets like CNN [19] or SQuaD [47], providing the perfect evaluation for our model which is trained to handle long-range contexts.
在這裏插入圖片描述

5 Analysis

轉移層數的影響(Impact of number of layers transferred):This indicates that each layer in the pre-trained model contains useful functionality for solving target tasks.
在這裏插入圖片描述

Zero-shot Behaviors:一個假設是,底層生成模型學習執行我們評估的許多任務,以提高其語言建模能力,並且transformer的更結構化的注意力記憶與LSTM相比有助於傳遞。

Ablation studies

  1. 在fine-tuning期間沒使用auxiliary LM objective:auxiliary objective有助於NLI, QQP,並且大數據集能從中受益
  2. Transformer與單層2048個unit的LSTM相比:提高了5.6 score
  3. 沒有pre-trained,transformer直接訓練在有監督的target tasks上:缺少預訓練直接降低了14.8%
    在這裏插入圖片描述
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章