Encoder

Also known as: Source Encoder

In an encoder–decoder system, the encoder reads the source sequence (for example the English sentence in translation) and builds representations of it.

In early neural MT the encoder was usually an RNN that walked the source left to right and ended with one final hidden state. Soft attention already needed every source state; modern encoder–decoder Transformers produce a vector (or stack of vectors) for every source position via bidirectional self-attention.

The encoder’s job is understanding the input; it does not emit the target tokens. That generation is left to the decoder. Encoder-only stacks (BERT-style) reuse the same idea for classification and span tasks without a generative decoder.

← Back to AI Glossary