Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BERT: Pre-Training of Deep Bidirectional Transformers for Language Understanding #4

Open
shnakazawa opened this issue Nov 21, 2022 · 0 comments
Labels
Natural language processing Papers related to NLP Transformer Papers using transformer

Comments

@shnakazawa
Copy link
Contributor

Devlin, Jacob, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. “BERT: Pre-Training of Deep Bidirectional Transformers for Language Understanding.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1810.04805

  • Google AI Languageのグループによる仕事
  • 2018年以降の自然言語処理分野の急激な拡大の一助となった、非常に重要な論文
  • Transformer (Vaswani et al., arXiv 2017) をうまく使った
  • 高精度&(データ数が少なくて済むので)誰もが使いやすい!

たった4人で世界を変えるような仕事を行ったという事実に震える

Abstract

We introduce a new language representation model called BERT, which stands for Bidirectional Encoder Representations from Transformers. Unlike recent language representation models, BERT is designed to pre-train deep bidirectional representations from unlabeled text by jointly conditioning on both left and right context in all layers. As a result, the pre-trained BERT model can be fine-tuned with just one additional output layer to create state-of-the-art models for a wide range of tasks, such as question answering and language inference, without substantial task-specific architecture modifications.

BERT is conceptually simple and empirically powerful. It obtains new state-of-the-art results on eleven natural language processing tasks, including pushing the GLUE score to 80.5% (7.7% point absolute improvement), MultiNLI accuracy to 86.7% (4.6% absolute improvement), SQuAD v1.1 question answering Test F1 to 93.2 (1.5 point absolute improvement) and SQuAD v2.0 Test F1 to 83.1 (5.1 point absolute improvement).

(DeepL翻訳)

我々は、BERT(Bidirectional Encoder Representations from Transformersの略)と呼ばれる新しい言語表現モデルを紹介する。最近の言語表現モデルとは異なり、BERTは全ての層で左右両方の文脈を共同で条件付けることにより、ラベルのないテキストから深い双方向表現を事前学習するよう設計されている。その結果、事前学習されたBERTモデルは、質問応答や言語推論などの幅広いタスクのための最先端のモデルを作成するために、タスク固有のアーキテクチャを大幅に変更することなく、たった1つの追加出力層で微調整が可能です。

BERTは、概念的にシンプルで、経験的に強力である。GLUEスコアを80.5%(7.7ポイントの絶対値向上)、MultiNLI精度を86.7%(4.6%の絶対値向上)、SQuAD v1.1 質問応答テストF1を93.2(1.5ポイントの絶対値向上)、SQuAD v2.0 テストF1を 83.1(5.1 ポイント絶対値向上)など11個の自然言語処理タスクで最先端の結果を得ました。

コード

https://github.com/google-research/bert

解決した課題/先行研究との比較

  • 2018年以前のDeep Learningモデルでは大量の教師付きデータ (数万~数十万件)。大量の計算資源が必要だった → 一般人には無理。
  • この問題に対し、少ない計算資源でタスク処理を行うモデルの研究が進んできた。
    • ELMo (Peters et al., 2018. Feature-based approach) と GPT-1 (Radford et al., 2018. Fine-tuning approach) が代表例。
    • 本論文はGPT-1と同じく Fine-tuning approachを使用。
      • Transformerをベースに、事前学習 (Pre-training) と Fine-tuningの2ステップを行う。
    • まずある程度のモデルを作る = Pre-training → 個別のタスクに特化させる = Fine-tuning
      • Pre-training: 大量のデータ (ラベル不要)。大量の計算資源が必要→Big techに任せる
      • Fine-tuning: 少データ、少計算資源でOK! (数千件)。誰でも出来る!
    • GPT-1ではPre-trainingの際、Unidirectional language modelを用いていた。
      • Unidirectional language model: (英語や日本語の場合) 左から右に文章が流れる。Token化した文章をモデルが学習する際、あるTokenより左側にあるTokenのみが参照される。
    • Unidirectionalだと一方向の文脈しか考慮できず、Token-levelのタスクには対応できても、Sentence-levelのタスクに対応が難しい。
  • この課題の解決を目指し、TransformerのEncoder部分をベースにBidirectionalなアーキテクチャを採用。
    Image from Gyazo
    • 双方向学習によって各単語は間接的に「自分自身を見る」ことができ、モデルは多層的な文脈の中でターゲット単語を些細に予測することができるようになった。
    • 自然言語の色々なタスクに当てはめて差し支えないぐらい高精度に単語・文章が理解できるようになった = マルチタスクに対する汎用性を獲得できた
  • Big techが準備してくれる事前学習済みモデル上で、少量のデータを用いたFine-tuningを行うことで、誰もが比較的簡単に高性能な言語モデルを使えるようになった!

技術・手法のポイント

  • 事前学習に大きなポイントが2つ
  • MLM (Masked Language Model): 穴埋めクイズ
    • Cloze task (Taylor, 1953) に着想を得た「マスク言語モデル」“masked language model” を事前学習に用いることで、学習データを一方向にしか情報を使えないという制約を回避、双方向に学習データを使えるようにした。
    • これを "bidirectional pre-training for language representations" と表現。
    • 文章の一部を隠すことで、自分自身からラベルを作ることができる、自己教師あり学習。
      • すべての単語に対し、15%の確率でラベル付与&MASKに入れ替える
        → ここでマスク化した部位というタグを付けることで、学習の対象である箇所を明確にする
      • MASKに入れ替えた単語に対して10%の確率で他の単語に入れ替える、10%の確率で元の単語に戻す。
        • → 学習の対象である箇所に対して正解データと誤答データを作る
      • ラベリングされた単語の予測結果と元の単語でLoss Maskを計算。
  • NSP (Next Sentence Prediction): 隣接文クイズ
    • 隣接分を予測させることで text-pair representation の事前学習をおこなった。
    • 学習の際に2文を放り込む。
    • 50%の確率で連続する2文、50%の確率でランダムにつなげた2文として、どちらだったかを予測させる。
    • 事前学習によりタスク固有のアーキテクチャのエンジニアリングを削減。

評価指標

紹介されている以下3つの指標すべてでState-of-the-Art達成

残された課題・議論

  • 本文中では議論なし。
  • BERT改良モデルが本論文の発表後にたくさん出現し、それぞれ特徴がある。下の「派生形」の項目を参照。

重要な引用

  • Vaswani, Ashish, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. “Attention Is All You Need.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1706.03762.
    • Transformer
  • Peters, Matthew E., Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. “Deep Contextualized Word Representations.” In Proceedings of the 2018 Conference of the North AMerican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), 2227–37. New Orleans, Louisiana: Association for Computational Linguistics.
    • ELMo
  • Radford, Alec, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. “Improving Language Understanding by Generative Pre-Training.” https://www.cs.ubc.ca/~amuham01/LING530/papers/radford2018improving.pdf.
    • GPT-1

派生形

  • Lan, Zhenzhong, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2019. “ALBERT: A Lite BERT for Self-Supervised Learning of Language Representations.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1909.11942.
    • ALBERT
    • 軽量化BERT
  • Joshi, Mandar, Danqi Chen, Yinhan Liu, Daniel S. Weld, Luke Zettlemoyer, and Omer Levy. 2020. “SpanBERT: Improving Pre-Training by Representing and Predicting Spans.” Transactions of the Association for Computational Linguistics 8 (December): 64–77.
    • SpanBERT. Maskをスパン単位に
  • Levine, Yoav, Barak Lenz, Opher Lieber, Omri Abend, Kevin Leyton-Brown, Moshe Tennenholtz, and Yoav Shoham. 2020. “PMI-Masking: Principled Masking of Correlated Spans.” arXiv, September. https://openreview.net/forum?id=3Aoft6NWFej.
    • PMI-masking
  • Liu, Yinhan, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. “RoBERTa: A Robustly Optimized BERT Pretraining Approach.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1907.11692.
    • RoBERTa
    • Next Sentence Predicitionをやめた
    • pre-trainingに使うテキストを大規模にした
  • Lan, Zhenzhong, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2019. “ALBERT: A Lite BERT for Self-Supervised Learning of Language Representations.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1909.11942.
  • ALBERT
    • Next Sentence Predicitionを、文ペアの順番を予測する課題に変更
  • Yang, Zhilin, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. “XLNet: Generalized Autoregressive Pretraining for Language Understanding.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1906.08237.
    • XLNet
    • マスクをやめて語順の並び替えを行った言語モデル
  • Raffel, Colin, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2019. “Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer.” arXiv [cs.LG]. arXiv. http://arxiv.org/abs/1910.10683.
    • Text-to-Text Transfer Transformer (T5)
    • テキスト変換にpre-trainingを導入
  • Lewis, Mike, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020. “BART: Denoising Sequence-to-Sequence Pre-Training for Natural Language Generation, Translation, and Comprehension.” In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, 7871–80. Online: Association for Computational Linguistics.
    • BART (Bidirectional and Auto-Regressive Transformers)
  • Sanh, Victor, Lysandre Debut, Julien Chaumond, and Thomas Wolf. 2019. “DistilBERT, a Distilled Version of BERT: Smaller, Faster, Cheaper and Lighter.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1910.01108.
    • DistilBERT
    • 軽量化BERT
    • 大きなモデルを教師とし、小さなモデル(生徒)に知識を移す
  • Reimers, Nils, and Iryna Gurevych. 2019. “Sentence-BERT: Sentence Embeddings Using Siamese BERT-Networks.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1908.10084.
    • Sentence-BERT
  • Sun, Chen, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. 2019. “VideoBERT: A Joint Model for Video and Language Representation Learning.” arXiv [cs.CV]. arXiv. http://arxiv.org/abs/1904.01766.
    • VideoBERT
  • Baevski, Alexei, Steffen Schneider, and Michael Auli. 2019. “Vq-wav2vec: Self-Supervised Learning of Discrete Speech Representations.” arXiv [cs.CL]. arXiv. http://arxiv.org/abs/1910.05453.
    • speech recognition

など。この派生の多さからも、BERTのインパクトがよく分かる。

参考: SlideShare - ゼロから始める転移学習

参考情報

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Natural language processing Papers related to NLP Transformer Papers using transformer
Projects
None yet
Development

No branches or pull requests

1 participant