본문 바로가기
Deep Learning/Natural Language Processing

MASS: Masked Sequence to Sequence Pre-training for Language Generation 리뷰

by hyez 2022. 2. 22.

Abstract

  • BERT에 영감을 받아 encoder-decoder 기반 언어 생성을 위한 MAsked Sequence to Sequence pre-training (MASS)을 제안
  • random하게 input sentence에 연속적인 mask를 부여한 뒤 decoder가 predict하는 방식으로 encoder와 decoder를 jointly Pre-training시켜 Language Generation Task에 적합한 Model을 개발
  • neural machine transla-tion, text summarization and conversational response generation을 포함한 zero/low-resource 데이터 셋에 대한 generation 작업
    • 특히, dataset이 적은 Language Generation task에서 비약적인 성능 향상

1. Introduction

  • Pre-train은 풍부한 데이터, Fine-tuning은 상대적으로 적은 양의 데이터
  • 최근 등장한 pre-training language model : ELMo Open AI GPT, BERT
  • 특히 BERT는 MLM과 NSP를 통해 양방향 encoder를 사전교육하여 NLU task에서 SOTA를 달성
    • NLU tasks : 감정분석, NLI, NER, SQuAD question answering

NLU와 는 달리 language generation은 일부 입력에 조건화된 자연어 문장을 생성하는 것을 목표로 한다.

  • Neural Machine Translation(NMT), text summarization, conversational response generation

언어 생성 작업은 일반적으로 데이터가 많이 필요한데(data-hungry), 많은 작업이 training data가 low or zero-resource이다.

  • 이러한 자연어 생성 작업에 BERT를 적용하는 것은 불가능
    • BERT는 하나의 encoder 또는 decoder에 의해 처리되는 language understanding을 위해 설계되었기 때문.
  • 따라서, language generation task를 위한 사전 훈련 방법을 설계하는 방법이 중요
    • 일반적으로 encoder-decoder 기반 seq2seq을 learning framework로 채택

요약 저자원의 언어 생성을 위해 pre-training 방법을 쓰고 싶은데 BERT를 바로 쓸 수 없으니 문제

MAsked Sequence to Sequence learning (MASS) for language generation (BERT에서 영감)

  • seq2seq learning framework 기반
  • encoder - 마스킹된 연속적인 토큰(이하 조각, fragment)을 입력으로 하는 문장
  • decoder - 인코더 표현에 따라 마스킹된 조각을 예측
  • BERT와 차이점 : encoder decoder를 jointly pre-train in two steps
    1. 디코더가 masked tokens를 예측하며, encoder는 unmasked tokens의 의미를 이해
    2. source에서 unmasked decoder token을 masking → MASS는 다음 token 예측을 위해 previous token이 아닌 source 표현에 더 많이 의존 하도록 강제
    3. ⇒ facilitating the joint training between encoder and decoder.

2. Related work

2.1. Sequence to Sequence Learning

  • Language generation task에서 paired 데이터가 부족
  • Unpaired 데이터에 pre-training을 하고 scale이 작은 paired 데이터에 fine-tining

2.2. Pre-training for NLP task

  • feature-based approach
    • 특정 task를 수행하는 network에 pre-trained language representation을 추가적인 feature로 제공
    • 즉, 두 개의 network를 붙여서 사용
    • e.g. ELMo
  • fine-tuning approach
    • task-specific한 parameter를 최대한 줄이고, pre-trained된 parameter들을 downstream task 학습을 통해 조금만 바꿔주는(fine-tuning) 방식
    • e.g. BERT, OpenAI GPT

⇒ 기존의 모델들은 encoder – decoder의 한 부분만을 pre-training

  • XML과 같은 encoder-decoder를 둘 다 학습하는 방법도 있었지만 이는 encoder와 decoder를 분리하여 pre training되며 encoder-decoder attention mechanism pre-train X
  • → seq2seq 기반 language generation task에서 sub-optimal !

MASS는 unlabeled 을 사용하여 encoder와 decoder를 모두 공동으로 pretrain하도록 설계되어 language generation task에 용이하게 사용할 수 있다.

3. MASS

3.1. Sequence to Sequence Learning

  • seq2seq 주요 접근법은 encoder-decoder framework라는 것.
    • encoder: source sequence를 읽고 representation을 생성
    • decoder: source 표현과 이전 tokens가 주어진 경우 각 대상 토큰의 조건부 확률을 추정
  • attention mechanism: 현재 토큰을 예측할 때 초점을 맞출 source representation을 찾음

3.2. Masked Sequence to Sequence Pre-training

: unsupervised prediction task

Figure 1. The encoder-decoder framework for our proposed MASS. The token “ _” represents the mask symbol [M].

BERT와 GPT

  • masking 길이 hyperparameter $k$를 통해 BERT와 GPT는 MASS의 특별한 경우로 표현할 수 있음

Figure 2. The model structure of MASS when k = 1 and k = m . Masked language modeling in BERT can be viewed as the case k = 1 and standard language modeling can be viewed as the case k = m .

3.3. Discussions

  1. MASK token만 predict하게 함으로써 encoder는 unmasked token들에 대한 context를 학습, decoder가 encoder로부터 좋은 정보 추출 (encoder가 context vector를 제대로 생성해내도록 한다.)
  2. MASK token을 연속적으로 배치함으로써 decoder가 단순 word들이 아닌 subsentence 생성 (better language modeling capability)
  3. Decoder의 input으로 source sentence의 unmasked token들이 들어오지 못하게 함으로써 decoder의 input token들에서 정보를 활용하기보다 encoder에서 넘어온 context vector의 정보를 활용하도록.

Experiments and Results

4.1 MASS Pre-training

Model Configuration

  • 6개의 encoder, decoder layer를 가진 Transformer를 Base Model로 선택
  • NMT를 위해 source language와 target language에 대해 각각 monolingual data로 pre-train을 진행했다. English-French, English-German, English-Romanian의 3가지 pair 를 사용
  • 각 pair에 대해서 별개로 학습을 진행했으며, 이 때 source language와 target language를 구분하기 위해 새로운 language embedding을 encoder input과 decoder input에 추가
  • Text Summarization, Conversational Response Generation task → English

Datasets

  • WMT News Crawl Dataset
    • English, French, German, Romanian
    • Romanian: low-resource language
  • BPE

Pre-Training Details

  • BERT와 동일한 masking rule
  • hyperparameter $k$는 전체 sentence 길이 ~~ $m$의 50%

4.2. Fine-Tuning on NMT

Experimental Setting

  • Unsupervised NMT- back-translation
    • bilingual data가 없기 때문에 soruce language data로 가상의 bilingual data를 생성 해내는 것(back-translation)이다.

Results on Unsupervised NMT

  • RNN 계열(1,2행) / Transformer without pre-train(3,4행) / Transformer with pre-train(5행)
    • SOTA
    • unsupervised NMT 어렵기에, 절대적인 Score는 낮지만 기존 sota model XLM을 능가했다는 점에서 의미

Compared with Other Pre-training Methods

BERT와 동일한 방식으로 Pre-train을 진행한 BERT+LM, denoising autoencoder Pre-train 방식을 적용한 DAE를 모두 능가

Experiments on Low-Resource NMT

Figure 3.The BLEU score comparisons between MASS and the baseline on low-resource NMT wit h different scales of paired data.

  • Pre-train은 20000 step 진행했으며, bilingual dataset의 sample 크기가 10K, 100K, 1M 인 경우에 대해서 각각의 언어에 대해 별개로 성능을 측정
  • baseline model: without pretrain
  • 모든 경우에서 MASS가 baseline model을 압도, 특히 sample의 크기가 작을 수록(fine-tuning을 적게 수행할수록) 성능의 차이가 컸다.

4.3. Fine-Tuning on Text Summarization

4.4. Fine-Tuning on Conversational Response Generation

4.5. Analysis of MASS

Study of Different k

Figure 5. The performances of MASS with different masked lengths k, in both pre-training and fine-tuning stages, which include: the PPL of the pre-trained model on English (Figure a) and French (Figure b) sentences from WMT newstest2013 on English-French translation; the BLEU score of unsupervised English-French translation on WMT newstest2013 (Figure c); the ROUGE score (F1 score in RG-2) on the validation set of text summarization (Figure d); the PPL on the validation set of conversational response generation (Figure e).

  • hyperparameter $k$의 값 변화에 따른 Score 측정
  • (a), (b) : English, French Pre-training 후 PPL Score (without fine-tining)
    • max score: $k$가 $m$의 50%~70%
  • (c) : English-French NMT BLEU Score
  • (d) : Text Summarization ROUGUE score
  • (e) : Conversational Response Generation PPL Score
    • max score: $k$가 $m$의 50%
  • $k$가 $m$의 50%라는 수치는 직관적으로 이해했을 때에도 가장 적합
    • $k$값 감소 → masking 감소 → encoder input 변형 감소 → decoder input 감소
    • ⇒ encoder 의존도 증가
    • $k$ 값 증가 → masking 증가 → encoder input 변형 증가 → decoder input 증가
    • ⇒ decoder 의존도 증가
    • language generation task에서 encoder와 decoder에 편향되면 x ⇒ 50%가 좋음
  • $k=1$(BERT의 MLM), $k=m$ (GPT) 둘 다 language generation task에서 낮은 성능

댓글