liveBook · Manning

Decode

As explained in Transformers in Action

The component of a sequence model that generates an output sequence from encoded representations and contextual information.

A decoder generates an output sequence from information prepared by an encoder. In translation, the encoder processes a source sentence into context; the decoder uses that context to produce a sentence in the target language. section 2.3

The way context reaches the decoder differs between architectures:

  • In an RNN, the encoder produces a context vector. The decoder generates words one at a time, updating its recurrent state to remember earlier output. section 1.1.1
  • In a transformer, the decoder uses encoded features and attention-derived context. Stacked attention and fully connected layers replace the RNN’s recurrent architecture. section 1.1.2 section 2.2

English-to-French translation

For “I don’t speak French,” the decoder’s job is to generate “Je ne parle pas français” using information obtained from the English input. section 1.1.1 section 1.1.2

Figure 2.5 The encoder of the transformer architecture is depicted on the left side of the figure, and the decoder is depicted on the right side.
figure

The architecture diagram places the transformer encoder and decoder side by side, showing where output generation fits in the overall model. section 2.2

How Transformers in Action covers it

How deep it goes
Explains decoder roles across RNNs and transformers at the component level, without supplying a standalone decoder implementation.
Examples
Uses an English-to-French sentence translation to contrast recurrent and transformer decoding.
What it assumes
Introduces encoder and decoder roles through sentences and translation rather than assuming prior knowledge of transformer components.
What you can do after
Evaluate/understand how RNN and transformer decoders turn encoded input information into a translated sequence.
How it connects
Connects decoders to encoders, context vectors, recurrent states, attention mechanisms, and sequence-to-sequence prediction.

Also explained in

Compare how 15 books explain decode →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Transformers in Action. The section links point to the parts of the book it draws on.