介紹
RoBERTa作爲BERT的改進版本,本文主要介紹RoBERTa和BERT的區別,論文具體見《RoBERTa: A Robustly Optimized BERT Pretraining Approach》
RoBERTa VS BERT
Our modifications are simple, they include: (1) training the model longer, with bigger batches, over more data; (2) removing the next sentence prediction objective; (3) training on longer sequences; and (4) dynamically changing the masking pattern applied to the training data.
訓練數據和參數上
RoBERTa引入了更多的訓練數據,除了BERT所使用的Book-Corpus和Wikipedia(16G), 增加了160G的其他數據包括(CC-NEWS, OPENWEBTEXT, STORIES), 預訓練數據相比BERT增加了10倍,隨之訓練時間也更長。
Past work in Neural Machine Translation has shown that training with very large mini-batches can both improve optimization speed and end-task performance when the learning rate is increased appropriately
同時借鑑機器翻譯,增大mini-batch的大小,提升優化速度和性能
動態掩碼 Dynamic Masking
回顧BERT使用的是靜態掩碼,即在訓練前就對訓練數據的句子隨機sample好了要mask的token,訓練的時候不變。RoBERTa的做法是將訓練數據複製10份,每份採用不同的隨機挑選token進行mask,訓練40個epoch,即訓練的時候相同的mask會出現4次
Model Input Format and Next Sentence Prediction
實驗表明去除nsp任務效果更好
Text Encoding
採用更大的byte-level BPE(Byte-Pair Encoding)詞典,從BERT原始的30k增大到50k
總結
RoBERTa的貢獻主要在於,只要訓練的好,效果還有提升空間。相比BERT,主要有以下幾個改進點:更多的預訓練數據,更大的mini-batch, 更長的預訓練時間,靜態編碼改成動態,取消NSP損失,更大的BPE詞典。最終達到了超越BERT的性能。