티스토리 뷰
Embed, encode, attend, predict: The new deep learning formula for state-of-the-art NLP models · Explosion
Over the last six months, a powerful new neural network playbook has come together for Natural Language Processing. The new approach can be summarised as a simple four-step formula: embed, encode, attend, predict. This post explains the components of this
explosion.ai
Embedding과 Encoding의 개념이 혼동되어서 찾아보던 중, 위 포스트를 통해 이해한 내용을 기록한다.
핵심 먼저 말하자면,
- Embedding: 토크나이징된 단어 토큰들을 벡터들로 변환하는 과정
- Encoding: Embedding된 벡터들을 Sentence Matrix로 변환하는 과정 (주로 Bi-LSTM 이용)
- 보통 Encoder에서 Embedding과 Encoding을 모두 수행한다.
텍스트가 들어오면 토크나이징을 통해 단어 토큰들로 변환한다.
단어 토큰들은 Embedding을 통해 일련의 단어 벡터들로 변환된다. 각각은 dense vector다.
일련의 단어 벡터들은 흔히 Bi-LSTM과 같은 모델을 이용해 순방향 마지막 값과 역방향 마지막 값을 concat하는 방식으로, 즉 Encoding을 통해 Sentence Matrix로 변환된다.
Sentence Matrix와 컨텍스트 벡터 간의 Attention 연산을 통해 단일 벡터를 얻는다. (두 Sentence Matrix끼리 Attention 연산을 하는 방법도 있다)
이 단일 벡터는 Feed forward 네트워크로 전달되어 Prediction을 수행한다.
'AI > NLP' 카테고리의 다른 글
언어 모델 디코딩 전략(Decoding Strategies) 소개 (0) | 2022.10.11 |
---|---|
Huggingface에 모델 포팅하기 (0) | 2022.07.29 |
[SentenceTransformer] special token 추가하기 (0) | 2022.05.24 |
FAISS 설명 및 사용법 (0) | 2022.04.28 |
BERT의 출력 (sequence_output, pooled_output) (0) | 2022.04.28 |