Skip to content
StackDecode
AI & ML Atlas
Deep LearningarchitectureAnimated walkthrough

Seq2Seq Models

Map one sequence to another sequence, such as a sentence to its translation.

The idea

An encoder RNN reads the source and compresses it into a context vector; a decoder RNN generates the target from it. Squeezing a long sentence into a single vector was a bottleneck, which is exactly what the attention mechanism fixed by letting the decoder look at all encoder states.

Watch it run

The pipeline lights up one step at a time. Use the controls to pause or step through it.

  1. 1Read the input sequence with the encoder.
  2. 2Pass its final state as the decoder's start state.
  3. 3Generate the output one token at a time.
  4. 4Train with teacher forcing: feed the true previous token during training.
1/4

Step by step

  1. 1Read the input sequence with the encoder.
  2. 2Pass its final state as the decoder's start state.
  3. 3Generate the output one token at a time.
  4. 4Train with teacher forcing: feed the true previous token during training.

Where it is used

Early neural machine translation and chatbots.

Watch out for

Information bottleneck for long inputs, and exposure bias from teacher forcing.

Related