Encoder
Part of the Transformer that reads the input text and builds its semantic representation. 'Understands' the text but does not generate it.
What it does
Each layer of the encoder processes the input vectors through self-attention, enriching them with context. The output is a representation that takes into account the relationships between all words.
Where it is used
Encoder vs Decoder
| Encoder | Decoder | |
|---|---|---|
| Task | Understand the input | Generate the output |
| Direction | Sees the whole text at once | Generates word by word |
| Example | BERT | GPT |