Describe the path of an input sequence through a vanilla encoder-decoder Transformer to the output sequence.
Asked at
AI answer
The input text is tokenized, the tokens are converted to IDs, and the IDs are converted to vector embeddings; positional information is added to them. The encoder processes the entire input sequence through layers of self-attention and feed-forward networks to produce contextual representations.
The decoder receives the target tokens generated so far (during training, the target sequence shifted to the right), along with their embeddings and positional information. In each layer, its masked self-attention prevents it from looking at future tokens, while cross-attention accesses the encoder outputs. A linear layer and softmax then produce a probability distribution over the next token. At inference time, tokens are generated autoregressively until EOS appears or the length limit is reached.
Also asked at Цифровые технологии и платформы
Similar questions
- Explain a decoder-only Transformer as a pipeline, from input tokens to the first output token.
- What are the encoder and decoder in the Transformer architecture, and how do they differ?
- Give examples of real-world models based on encoder, decoder, and encoder-decoder architectures.
- How does attention in the encoder differ from attention in the decoder?
- How is text converted into input for a transformer?