SlideShare a Scribd company logo
1 of 24
Download to read offline
ALBERT: A LITE BERT FOR SELF-
SUPERVISED LEARNING OF
LANGUAGE REPRESENTATIONS
장영록
Preview – 핵심 내용
• [Challenge] Pre-trained language representation 모델의 크기
를 증가시켜 성능 개선 시 다음의 문제점 발생
• Memory Limitation
• Training Time
• Model Degradation
• [Contribution] BERT에서 다음의 사항을 개선하여 모델 크기를
줄이고 성능 또한 개선
• Factorized Embedding Parameterization
• Cross-layer parameter sharing
• Sentence-order prediction
Preview – 모델 및 성능
Challenge – Memory Limitation
• BERT Paper에서는 Memory 64GB의 TPU 활용
• Titan X GPU (Memory 12GB) 활용 시 OOM 문제로 Maximum
batch size가 아래와 같음
https://github.com/google-
research/bert/blob/master/README.md
Challenge – Training time
• BERT_base
• L=12, H=768, A=12, Total Parameters=110M
• 16 TPU chips 활용 4 days
• 16 GPU V100 활용 5 1/3 days (예측 값)
• BERT_large
• L=24, H=1024, A=16, Total Parameters=340M
• 64 TPU chips 활용 4days
• 64 GPU V100 활용 8 1/2 days (예측 값)
https://timdettmers.com/2018/10/17/tpus-vs-gpus-for-
transformers-bert/
Challenge – Model Degradation (1)
• 일반적으로 Language Representation, Machine Translation 등
의 Task에서는 모델이 클 수록 높은 성능을 보임
BERT Paper에서
의 실험 결과
Challenge – Model Degradation (2)
• Model Degradation – 모델이 크다고 무조건 성능이 높아지지
않음을 실험적으로 보여줌
Layer = 24
Contribution – Factorized Embedding
Parameterization (1)
• Token Embedding Size(E)를 Hidden Layer Embedding Size(H)
보다 작게 설정하여 Parameter 수 줄임
• 기존 BERT, XLNet, RoBert 등 모두 E = H로 모델 구성
• [Intuition] H는 Contextualized Representation이지만 E는 Context
Independent Representation 이므로 E<H 이어도 모델의 성능이 떨어
지지 않을 것임
Contribution – Factorized Embedding
Parameterization (2)
• BERT / Transformer Embedding Size Review
H
H/(head 수) Size
로 Output 생성
후 Concat
Input/output Size = H
(Inner layer size = 4H)
각 Embedding Size가
H와 같음
Contribution – Factorized Embedding
Parameterization (3)
• BERT에서는 Vocabulary Size(V) x H를 활용하여 Token
Embedding
• Factorized Embedding Parameterization – VxE Matrix로 Token
Embedding 후 ExH Matrix를 활용하여 최종 Input 생성
• O(VxH) -> O(VxE+ExH)
• 일반적으로 V(BERT에서 30,000)가 매우 크므로 Parameter Size를 줄일
수 있음
H = 768 / layer = 12
Cross layer parameter
sharing 여부 (뒤에서
설명)
Contribution – Cross-layer Parameter Sharing
(1)
• Layer 간 같은 Parameter를 사용 (Recursive Transformation)
• Attention, FFN 등의 모든 Parameter를 Layer 간 공유
• Layer 수가 늘어나더라도 Parameter 수가 늘어나지 않음
• 유사한 Idea
• Universal Transformer
• https://arxiv.org/abs/1807.03819
• Deep Equilibrium Models
• https://arxiv.org/abs/1909.01377
Contribution – Cross-layer Parameter Sharing
(2)
• Universal Transformer
• [Intuition] RNN이 Sequence Data를 활용하여 Hidden State를
Iterative Update 하는 것처럼 Recurrent Layer를 통해 Output을
Iterative Update(Recursive Transformation)
• RNNs’ inductive bias towards learning iterative
• Machine Translation , bAbI (NLU Task) 등에서 Transformer 보다 높은
성능
Contribution – Cross-layer Parameter Sharing
(3)
Attention만 Sharing 했을
떄는 Not-shared와 성능
차이 크지 않음
FFN을 공유 했을 때, 비교
적 큰 성능 차이 발생
• 각 Layer의 FFN은 공유하지 않을 때 더 높은 성능 보임
Contribution – Cross-layer Parameter Sharing
(4)
• 각 Layer의 Input, Output을 비교해봤을 때 ALBERT의 변동 폭이
BERT 보다 작지만 0으로 수렴하지는 않음
• DQE Paper에 따르면 input, output Embedding이 같아지는
Equilibrium point에 도달하는 Layer가 있다고 했으나 아래처럼 다른
실험 결과 얻음
Contribution – Inter-sentence coherence loss
(1)
• Next Sentence Prediction(NSP) 대신 2개의 Sentence의 order
가 맞는지 여부를 예측하는 방식으로 학습
• Negative Example – 앞,뒤 문장의 순서를 바꾸어서 구성
• [Intuition] Sentence Order를 예측하는 것이 Inter-sentence
coherence를 학습하는데 더 적합
• NSP는 문장의 순서와 상관 없이 유사한 주제를 다루기만 한다면 Next
Sentence로 예측할 수 있음 -> Topic Prediction으로 볼 수 있음
• Sentence Order를 예측하는 경우 같은 Topic이라도 문장 간 순서를 고
려하므로 discourse level coherence를 반영한다고 볼 수 있음!
Contribution – Inter-sentence coherence loss
(2)
• ALBERT base에 Next Sentence Prediction(NSP), Sentence
Order Prediction(SOP) 각각 적용하여 실험
SOP로 학습해도 NSP 어
느 정도 가능
NSP로 학습시 SOP를 거
의 하지 못함
영화 Review -> Postive/negative
classification Task
Experiment
• Book Corpus, Wikipedia – 16GB 사용 (BERT와 같음)
• Batch Size = 4096
• 125,000 Steps 학습
• TPU v3 사용
• Model의 크기에 따라 64 ~ 1024 chips 활용
• Dataset
• GLUE 9 tasks
• SQUAD 1.1, 2.0
• RACE
• 중국 영어 시험 – 100,000개의 Questions
• Candidate Answer 4개 -> Multiple Choice
• 중, 고등학교
Experiment – 모델 및 성능
BERT large
의 70% size
Layer 12, 24일 때 성능 차이
가 없어서 12 선택
Large 보다
성능 낮음
6-Layer로 미
리 학습 후 12
Layer로 추가
Training ->
Converge가
좀 더 잘됬음
Experiment – Layer, Depth에 따른 성능
차이
12 Layer 이상 부터는
큰 차이 없음
성능 저하
Experiment – 같은 시간 동안 학습 시 성
능 차이
34 시간 학습
32 시간 학습
감사합니다.
Appendix
Appendix
Appendix

More Related Content

What's hot

What's hot (20)

Presentation on Text Classification
Presentation on Text ClassificationPresentation on Text Classification
Presentation on Text Classification
 
BERT: Bidirectional Encoder Representations from Transformers
BERT: Bidirectional Encoder Representations from TransformersBERT: Bidirectional Encoder Representations from Transformers
BERT: Bidirectional Encoder Representations from Transformers
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language UnderstandingBERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
 
An introduction to the Transformers architecture and BERT
An introduction to the Transformers architecture and BERTAn introduction to the Transformers architecture and BERT
An introduction to the Transformers architecture and BERT
 
GPT-2: Language Models are Unsupervised Multitask Learners
GPT-2: Language Models are Unsupervised Multitask LearnersGPT-2: Language Models are Unsupervised Multitask Learners
GPT-2: Language Models are Unsupervised Multitask Learners
 
Fine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP models
 
BERT introduction
BERT introductionBERT introduction
BERT introduction
 
A Review of Deep Contextualized Word Representations (Peters+, 2018)
A Review of Deep Contextualized Word Representations (Peters+, 2018)A Review of Deep Contextualized Word Representations (Peters+, 2018)
A Review of Deep Contextualized Word Representations (Peters+, 2018)
 
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
 
NLP_KASHK:Smoothing N-gram Models
NLP_KASHK:Smoothing N-gram ModelsNLP_KASHK:Smoothing N-gram Models
NLP_KASHK:Smoothing N-gram Models
 
Tutorial on word2vec
Tutorial on word2vecTutorial on word2vec
Tutorial on word2vec
 
Thomas Wolf "Transfer learning in NLP"
Thomas Wolf "Transfer learning in NLP"Thomas Wolf "Transfer learning in NLP"
Thomas Wolf "Transfer learning in NLP"
 
KorQuAD v2.0 소개
KorQuAD v2.0 소개KorQuAD v2.0 소개
KorQuAD v2.0 소개
 
Lecture 4: Transformers (Full Stack Deep Learning - Spring 2021)
Lecture 4: Transformers (Full Stack Deep Learning - Spring 2021)Lecture 4: Transformers (Full Stack Deep Learning - Spring 2021)
Lecture 4: Transformers (Full Stack Deep Learning - Spring 2021)
 
Intro to Deep Learning for Question Answering
Intro to Deep Learning for Question AnsweringIntro to Deep Learning for Question Answering
Intro to Deep Learning for Question Answering
 
Nlp research presentation
Nlp research presentationNlp research presentation
Nlp research presentation
 
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language UnderstandingBERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
 
Data Science - Part VIII - Artifical Neural Network
Data Science - Part VIII -  Artifical Neural NetworkData Science - Part VIII -  Artifical Neural Network
Data Science - Part VIII - Artifical Neural Network
 
Introduction to Transformers for NLP - Olga Petrova
Introduction to Transformers for NLP - Olga PetrovaIntroduction to Transformers for NLP - Olga Petrova
Introduction to Transformers for NLP - Olga Petrova
 

Similar to Albert

Similar to Albert (20)

MRC recent trend_ppt
MRC recent trend_pptMRC recent trend_ppt
MRC recent trend_ppt
 
Machine translation survey vol2
Machine translation survey   vol2Machine translation survey   vol2
Machine translation survey vol2
 
Review MLP Mixer
Review MLP MixerReview MLP Mixer
Review MLP Mixer
 
[224] 번역 모델 기반_질의_교정_시스템
[224] 번역 모델 기반_질의_교정_시스템[224] 번역 모델 기반_질의_교정_시스템
[224] 번역 모델 기반_질의_교정_시스템
 
C'est la vie (hello bert!)
C'est la vie (hello bert!)C'est la vie (hello bert!)
C'est la vie (hello bert!)
 
[Paper review] tera pipe: token level pipeline parallelism for training larg...
[Paper review] tera pipe:  token level pipeline parallelism for training larg...[Paper review] tera pipe:  token level pipeline parallelism for training larg...
[Paper review] tera pipe: token level pipeline parallelism for training larg...
 
Senti prompt sentiment knowledge enhanced prompt tuning for aspect-based sent...
Senti prompt sentiment knowledge enhanced prompt tuning for aspect-based sent...Senti prompt sentiment knowledge enhanced prompt tuning for aspect-based sent...
Senti prompt sentiment knowledge enhanced prompt tuning for aspect-based sent...
 
NLU Tech Talk with KorBERT
NLU Tech Talk with KorBERTNLU Tech Talk with KorBERT
NLU Tech Talk with KorBERT
 
[Paper Review] What have we achieved on text summarization?
[Paper Review] What have we achieved on text summarization? [Paper Review] What have we achieved on text summarization?
[Paper Review] What have we achieved on text summarization?
 
deep encoder, shallow decoder reevaluating non-autoregressive machine transl...
deep encoder, shallow decoder  reevaluating non-autoregressive machine transl...deep encoder, shallow decoder  reevaluating non-autoregressive machine transl...
deep encoder, shallow decoder reevaluating non-autoregressive machine transl...
 
[224] backend 개발자의 neural machine translation 개발기 김상경
[224] backend 개발자의 neural machine translation 개발기 김상경[224] backend 개발자의 neural machine translation 개발기 김상경
[224] backend 개발자의 neural machine translation 개발기 김상경
 
Improving Language Understanding by Generative Pre-Training
Improving Language Understanding by Generative Pre-TrainingImproving Language Understanding by Generative Pre-Training
Improving Language Understanding by Generative Pre-Training
 
Papago/N2MT 개발이야기
Papago/N2MT 개발이야기Papago/N2MT 개발이야기
Papago/N2MT 개발이야기
 
문자 단위의 Neural Machine Translation
문자 단위의 Neural Machine Translation문자 단위의 Neural Machine Translation
문자 단위의 Neural Machine Translation
 
Memory & object pooling
Memory & object poolingMemory & object pooling
Memory & object pooling
 
LSTM 네트워크 이해하기
LSTM 네트워크 이해하기LSTM 네트워크 이해하기
LSTM 네트워크 이해하기
 
Wide&Deep Learning for Recommender Systems
Wide&Deep Learning for Recommender SystemsWide&Deep Learning for Recommender Systems
Wide&Deep Learning for Recommender Systems
 
Masked Sequence to Sequence Pre-training for Language Generation
Masked Sequence to Sequence Pre-training for Language GenerationMasked Sequence to Sequence Pre-training for Language Generation
Masked Sequence to Sequence Pre-training for Language Generation
 
Deep neural networks for You-Tube recommendations
Deep neural networks for You-Tube recommendationsDeep neural networks for You-Tube recommendations
Deep neural networks for You-Tube recommendations
 
Java와 go 간의 병렬 프로그램 성능 비교
Java와 go 간의 병렬 프로그램 성능 비교Java와 go 간의 병렬 프로그램 성능 비교
Java와 go 간의 병렬 프로그램 성능 비교
 

Albert

  • 1. ALBERT: A LITE BERT FOR SELF- SUPERVISED LEARNING OF LANGUAGE REPRESENTATIONS 장영록
  • 2. Preview – 핵심 내용 • [Challenge] Pre-trained language representation 모델의 크기 를 증가시켜 성능 개선 시 다음의 문제점 발생 • Memory Limitation • Training Time • Model Degradation • [Contribution] BERT에서 다음의 사항을 개선하여 모델 크기를 줄이고 성능 또한 개선 • Factorized Embedding Parameterization • Cross-layer parameter sharing • Sentence-order prediction
  • 3. Preview – 모델 및 성능
  • 4. Challenge – Memory Limitation • BERT Paper에서는 Memory 64GB의 TPU 활용 • Titan X GPU (Memory 12GB) 활용 시 OOM 문제로 Maximum batch size가 아래와 같음 https://github.com/google- research/bert/blob/master/README.md
  • 5. Challenge – Training time • BERT_base • L=12, H=768, A=12, Total Parameters=110M • 16 TPU chips 활용 4 days • 16 GPU V100 활용 5 1/3 days (예측 값) • BERT_large • L=24, H=1024, A=16, Total Parameters=340M • 64 TPU chips 활용 4days • 64 GPU V100 활용 8 1/2 days (예측 값) https://timdettmers.com/2018/10/17/tpus-vs-gpus-for- transformers-bert/
  • 6. Challenge – Model Degradation (1) • 일반적으로 Language Representation, Machine Translation 등 의 Task에서는 모델이 클 수록 높은 성능을 보임 BERT Paper에서 의 실험 결과
  • 7. Challenge – Model Degradation (2) • Model Degradation – 모델이 크다고 무조건 성능이 높아지지 않음을 실험적으로 보여줌 Layer = 24
  • 8. Contribution – Factorized Embedding Parameterization (1) • Token Embedding Size(E)를 Hidden Layer Embedding Size(H) 보다 작게 설정하여 Parameter 수 줄임 • 기존 BERT, XLNet, RoBert 등 모두 E = H로 모델 구성 • [Intuition] H는 Contextualized Representation이지만 E는 Context Independent Representation 이므로 E<H 이어도 모델의 성능이 떨어 지지 않을 것임
  • 9. Contribution – Factorized Embedding Parameterization (2) • BERT / Transformer Embedding Size Review H H/(head 수) Size 로 Output 생성 후 Concat Input/output Size = H (Inner layer size = 4H) 각 Embedding Size가 H와 같음
  • 10. Contribution – Factorized Embedding Parameterization (3) • BERT에서는 Vocabulary Size(V) x H를 활용하여 Token Embedding • Factorized Embedding Parameterization – VxE Matrix로 Token Embedding 후 ExH Matrix를 활용하여 최종 Input 생성 • O(VxH) -> O(VxE+ExH) • 일반적으로 V(BERT에서 30,000)가 매우 크므로 Parameter Size를 줄일 수 있음 H = 768 / layer = 12 Cross layer parameter sharing 여부 (뒤에서 설명)
  • 11. Contribution – Cross-layer Parameter Sharing (1) • Layer 간 같은 Parameter를 사용 (Recursive Transformation) • Attention, FFN 등의 모든 Parameter를 Layer 간 공유 • Layer 수가 늘어나더라도 Parameter 수가 늘어나지 않음 • 유사한 Idea • Universal Transformer • https://arxiv.org/abs/1807.03819 • Deep Equilibrium Models • https://arxiv.org/abs/1909.01377
  • 12. Contribution – Cross-layer Parameter Sharing (2) • Universal Transformer • [Intuition] RNN이 Sequence Data를 활용하여 Hidden State를 Iterative Update 하는 것처럼 Recurrent Layer를 통해 Output을 Iterative Update(Recursive Transformation) • RNNs’ inductive bias towards learning iterative • Machine Translation , bAbI (NLU Task) 등에서 Transformer 보다 높은 성능
  • 13. Contribution – Cross-layer Parameter Sharing (3) Attention만 Sharing 했을 떄는 Not-shared와 성능 차이 크지 않음 FFN을 공유 했을 때, 비교 적 큰 성능 차이 발생 • 각 Layer의 FFN은 공유하지 않을 때 더 높은 성능 보임
  • 14. Contribution – Cross-layer Parameter Sharing (4) • 각 Layer의 Input, Output을 비교해봤을 때 ALBERT의 변동 폭이 BERT 보다 작지만 0으로 수렴하지는 않음 • DQE Paper에 따르면 input, output Embedding이 같아지는 Equilibrium point에 도달하는 Layer가 있다고 했으나 아래처럼 다른 실험 결과 얻음
  • 15. Contribution – Inter-sentence coherence loss (1) • Next Sentence Prediction(NSP) 대신 2개의 Sentence의 order 가 맞는지 여부를 예측하는 방식으로 학습 • Negative Example – 앞,뒤 문장의 순서를 바꾸어서 구성 • [Intuition] Sentence Order를 예측하는 것이 Inter-sentence coherence를 학습하는데 더 적합 • NSP는 문장의 순서와 상관 없이 유사한 주제를 다루기만 한다면 Next Sentence로 예측할 수 있음 -> Topic Prediction으로 볼 수 있음 • Sentence Order를 예측하는 경우 같은 Topic이라도 문장 간 순서를 고 려하므로 discourse level coherence를 반영한다고 볼 수 있음!
  • 16. Contribution – Inter-sentence coherence loss (2) • ALBERT base에 Next Sentence Prediction(NSP), Sentence Order Prediction(SOP) 각각 적용하여 실험 SOP로 학습해도 NSP 어 느 정도 가능 NSP로 학습시 SOP를 거 의 하지 못함 영화 Review -> Postive/negative classification Task
  • 17. Experiment • Book Corpus, Wikipedia – 16GB 사용 (BERT와 같음) • Batch Size = 4096 • 125,000 Steps 학습 • TPU v3 사용 • Model의 크기에 따라 64 ~ 1024 chips 활용 • Dataset • GLUE 9 tasks • SQUAD 1.1, 2.0 • RACE • 중국 영어 시험 – 100,000개의 Questions • Candidate Answer 4개 -> Multiple Choice • 중, 고등학교
  • 18. Experiment – 모델 및 성능 BERT large 의 70% size Layer 12, 24일 때 성능 차이 가 없어서 12 선택 Large 보다 성능 낮음 6-Layer로 미 리 학습 후 12 Layer로 추가 Training -> Converge가 좀 더 잘됬음
  • 19. Experiment – Layer, Depth에 따른 성능 차이 12 Layer 이상 부터는 큰 차이 없음 성능 저하
  • 20. Experiment – 같은 시간 동안 학습 시 성 능 차이 34 시간 학습 32 시간 학습