티스토리 뷰
- Transformer 구조라는 건 encoder - decoder 로 이루어진 seq to seq model 이고 거기에 attention mechanism 이 핵심 요소이다.
- BERT 는 transformer 의 encoder blocks 만 있는 모델
- GPT2 는 transformer 의 decoder blocks 만 있는 모델
- BART 는 bert encoder + gpt2 decoder 이라는 것.
그럼 결국 transformer 아닌가..? => architecture 이랑 pre-training 에서 조금씩 차이가 있다고 함
BERT 는 그니까 self attention + feed forward layer 로 이루어진 encoder block 의 stack 으로 이루져 있고
GPT2 는 masked self attention + feed forward layer 로 이루어진 decoder block 의 stack 으로 이루어져
이 둘의 차이는
1) encoder mode vs. decoder model
2) self-attention vs. masked self-attention 이냐 (masked language model ≠ masked self-attention. Masked self-attention 은 auto regressive model 에 쓰임.)
=> 특히 2번째 차이 때문에 bert 는 left and right context 를 사용할 수 있다는 거고 gpt2 는 left context 만 사용할 수 있다. 그리고 bert 는 이 bi-directionality 때문에 language generation 에 사용할 수 없고, gpt 는 거기에 적합한 모델인 것!
(BERT가 사용하는) self-attention과 (GPT-2가 사용하는) masked self-attention이 확연히 다르다는 것은 중요합니다. 일반 self-attention block은 자신보다 오른쪽에 있는 token을 계산 과정에서 볼 수 있도록 합니다. masked self-attention의 경우에는, 이런 상황을 막습니다.

참고 링크
https://chloamme.github.io/2021/12/08/illustrated-gpt2-korean.html gpt2 디코더 이해하는데 쉬움
https://jonathan-hui.medium.com/nlp-bert-transformer-7f0ac397f524#b726
'NLP > 이것저것' 카테고리의 다른 글
Framenet , Propbank, Verbnet (0) | 2023.10.04 |
---|---|
Dependency parsing (0) | 2022.06.08 |
N-gram language model (0) | 2021.12.20 |
Naïve Bayes Classifier (0) | 2021.12.06 |
Accumulated gradients (0) | 2021.08.03 |
- Total
- Today
- Yesterday
- 워터마킹
- Neural Language Model
- Statistical Language Model
- nlp
- Contextual Embedding
- language model
- Attention Mechanism
- Elmo
- cs224n
- LM
- Pre-trained LM
- GPTZero
- neurone
- 언어모델
- Bert
- weight vector
- word embedding
- 벡터
- 뉴럴넷
- neural network
- 뉴런
- transformer
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |