<S>
, <E>
)을 제안해서 simple한 task뿐만 아니라, 다양한 자연어 처리에서의 task를 처리할 수 있는 특징이 있다.
Motivation
If we use bi-directional language model?
Masked Language Model(MLM)
[MASK]
Next Sentence Prediction(NSP)
Problem
Solution
[MASK]
[MASK]
masked language modeling을 통해 word별로 예측을 해야하는 task이외에 GPT에서도 있었던, 문장 level에서의 task에 대응하기 위한 pre-train 기법을 제안했으며 이 기법이 Next Sentence Prediction이다.
아래의 예를 들면, default로 bert model을 학습할 때, 주어진 하나의 글에서 두개의 문장을 뽑느다.
두 문장을 연속적으로 이어주고, 문장 사이에는 seperate token, 문장을 끝날때에도 seperate token을 준다.
동시에 다수의 문장 level에서의 예측 task를 수행하는 [CLS] token을 문장의 앞에 추가한다.
GPT에서 extract token이 문장 마지막에 등장하고, 이를 통해 다수 문장에서의 예측 task를 진행할 수 있는 것을 비슷하게 적용
입력데이터만으로 예측을 학습시키기 위해 연속적으로 주어진 문장이 인접한, 연속적으로 이 순서대로 나와야하는 문장인지, 전혀 연속적으로 나올 수 없는 문장인지를 예측하는 Next Sentence인지에 아닌지에 대한 binary classification task를 추가했다.
이 경우, 주어진 글에서 default로 2개의 문장을 뽑고, [mask]치환과 [CLS] token추가를 하여 transformer encoding을 하고, [mask] token을 예측하게 된다.
[CLS] token은 output layer를 하나더 주어 binary classification을 진행하고 ground truth는 실제 인접하는 text인지 아닌지를 확인한다.
모델 구조 자체는 transformer에서 제안된 block을 그대로 사용했으며, 두가지 버전으로 학습된 모델을 제안했다.
Input Representation
Pre-training Tasks
(a) Sentence Pair Classification Tasks :
두개 문장을 하나의 sequence로 그렇지만 seperate token으로 구별을 지은 후, bert를 통해 encoding을 하고 나서, 각각의 word들에 대한 encoding vector를 얻었다면 CLS token에 해당하는 encoding vector를 output layer의 입력으로 주어서 다 수 문장에 대한 예측 task를 수행할 수 있다.
MNLI, QQP, QNLU, STS-B, MRPC, RTE, SWAG
(b) Single Sentence Classification Tasks :
입력으로 줄 문장이 한번에 하나씩 밖에 없기에 문장을 하나만 주고, 첫 번째 [CLS] token encoding output을 최종 output layer에 넣어 classification을 수행하게 된다.
SST=2 CoLA
(c) Question Answering Tasks:
SQuAD v1.1
(d) Single Sentence Tagging Tasks:
각각의 CLS token을 포함해서 첫 번째, 두번째 단어에 대한 encoding vector를 동일한 어떤 공통의 output layer에 통과해서 최종 각 word별 classification이나 prediction을 수행하게 된다.
CoNLL-2003 NER
Training-data size
Training special tokens during training
Batch size
Task-specific fine-tuning
기계 독해에 기반한, 질문에서 필요한 정보 추출을 통해 응답을 해준다.
기본적으로 bert의 입력으로서 주어진 지문과 답을 필요로하는 질문을 두개의 서로 다른 문장인 것 처럼 seperate token을 통해 concat을 해서 하나의 sequence로 만들어서 bert를 통해 encoding을 진행한다.
각각의 지문상에서의 단어 별 word encoding vector가 나올 것이고 벡터들에서 정답에 해당할 법한 위치(지문 상에서 특정한 문구로 정답이 주어짐)를 기본적으로 예측하도록 모델 학습을 수행하게 된다.
구체적으로는 지문에서 답에 해당하는 문구가 시작하는 위치를 예측하기 위해 각 word별로 최종 encoding vector가 output으로 나왔을 때, 이를 공통된 output layer를 통해서 scalar값을 뽑도록 하여 결과값을 얻도록 한다.
각각 word가 2차원 vector로 최종 encoding vector로 나온 경우 각 word encoding vector에 적용해야되는 output layer는 단순히 2차원 vector를 단일한 차원의 혹은 scalar값으로 변경해주는 fully connect layer가 된다.
fully connected layer의 parameter가 randomailazation에서 부터 fine-tuning되는 대상에 해당하는 parameter가 된다.
scalar값을 각 word별로 얻은 후 에는 word상에서 여러 word들 중에 답에 해당하는 문구가 어느 단어에서 시작하는지를 먼저 예측.
끝나는 시점을 예측해야 하는데, 이 경우 starting position을 예측하도록 하는 output layer에 해당하는 FCN을 하나 두는 동시에 또 다른 FCN을 두번 째 version으로 만들고, 그것을 통과해서 각 word encoding vector가 scalar값이 나오도록하고 softmax를 통과하도록 한 후, endding word에 대한 position을 예측 하도록 진행한다.
주어진 문장이 있을 때, 다음에 나타날 법한 적절한 문장을 고르는 것.
모델 구조에서의 특별한 개선이 아니라, 기존 GPT-2보다 더 많은 데이터, 더 많은 parameter, 더 큰 batch size를 적용한 것.
Is having better NLP models as easy as having larger models?
Obstacles
Solutions
• GPT-1
https://blog.openai.com/language-unsupervised/
• BERT : Pre-training of deep bidirectional transformers for language understanding, NAACL’19
https://arxiv.org/abs/1810.04805
• SQuAD: Stanford Question Answering Dataset
https://rajpurkar.github.io/SQuAD-explorer/
• SWAG: A Large-scale Adversarial Dataset for Grounded Commonsense Inference
https://leaderboard.allenai.org/swag/submissions/public
• How to Build OpenAI’s GPT-2: “ The AI That Was Too Dangerous to Release”
https://blog.floydhub.com/gpt2/
• GPT-2
https://openai.com/blog/better-language-models/
https://cdn.openai.com/better-languagemodels/language_models_are_unsupervised_multitask_learners.pdf
• Language Models are Few-shot Learners, NeurIPS’20
https://arxiv.org/abs/2005.14165
• Illustrated Transformer
http://jalammar.github.io/illustrated-transformer/
• ALBERT: A Lite BERT for Self-supervised Learning of Language Representations, ICLR’20
https://arxiv.org/abs/1909.11942
• ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators, ICLR’20
https://arxiv.org/abs/2003.10555
• DistillBERT, a distilled version of BERT: smaller, faster, cheaper and lighter
https://arxiv.org/abs/1910.01108
• TinyBERT: Distilling BERT for Natural Language Understanding, Findings of EMNLP’20
https://arxiv.org/abs/1909.10351
• ERNIE: Enhanced Language Representation with Informative Entities
https://arxiv.org/abs/1905.07129
• KagNet: Knowledge-Aware Graph Networks for Commonsense Reasoning
https://arxiv.org/abs/1909.02151