Natural Language Processing · Advanced level

Advanced level · Module 4 of 10 · 15 guided hours

Sequence-to-Sequence Architectures

Encoder-decoder models that turn one sequence into another, built on a synthetic, CPU-friendly task (normalising written dates and amounts), with teacher forcing, greedy and beam search decoding.

Learning objectives

  • Explain the encoder-decoder architecture
  • Implement and train a seq2seq model with teacher forcing
  • Decode with greedy and beam search and evaluate outputs

Topics

  • sequence-to-sequence tasks
  • encoder and decoder
  • synthetic data generation
  • teacher forcing
  • greedy and beam search
  • exact-match and character error evaluation

Lessons

  1. Lesson 1 Encoder-Decoder Models

    Learners study how an encoder compresses an input sequence into a state that a decoder uses to generate an output sequence, and why this design suits translation, summarisation and normalisation.

    encoderdecodercontext vector<sos> and <eos> tokensvariable-length output

  2. Lesson 2 Training with Teacher Forcing

    Learners implement a GRU encoder-decoder in PyTorch and train it with teacher forcing, observing the gap between training and free-running generation.

    nn.GRU encoder and decoderteacher forcingteacher forcing ratioexposure biassequence loss with padding ignored

  3. Lesson 3 Decoding Strategies and Error Analysis

    Learners compare greedy decoding and beam search, measure character error rates and analyse which input formats the model fails on.

    greedy decodingbeam searchbeam widthcharacter error rateerror analysis by format

Practical activity

Build, train and evaluate a GRU seq2seq model for date and amount normalisation with greedy and beam decoding and a grouped error analysis.

Expected outcomes

  • Working knowledge of encoder-decoder models
  • Systematic evaluation of generated sequences

Assessment

Notebook review (70%) and error analysis (30%).

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.