When we train a model to write a sentence one word at a time, what does it mean to feed it the correct previous words during training, and why might that cause trouble later?

Sequence models and transformers, Sequence-to-sequence models
Level L1 Beginner. Length Short. Nature Th Theoretical.

What's being asked

Whether you understand the plain idea of teacher forcing and can name the mismatch between training and real use.

Key idea

In training, the model is always shown the correct words so far, as if a teacher corrected each step, and it only has to guess the next word. When it writes on its own later, it sees its own words instead, including its own mistakes.

Steps

  1. Think of a student solving a long sum with a teacher beside them. After every line the teacher replaces the student's line with the correct one, so the next line always starts from a correct place.
  2. Training a sentence writer works this way. The target sentence is "I like green tea". To learn the third word, the model is shown "I like" and must guess "green". Even if it would have guessed "hate" as the second word, we still show it the correct "like".
  3. Tiny calculation: a 4-word sentence gives 4 such practice questions, so one sentence teaches the model 4 times and each question has a clear right answer.
  4. The catch: when the model really writes, there is no teacher. It feeds its own words back in. If it makes a mistake early ("I hate"), it is now in a situation it never practised, and later words may go off track.
  5. This gap between training and real use is called exposure bias (the model was not exposed to its own mistakes while training). The harder question `teacher-forcing-exposure-bias` covers it and the usual fixes.

Common mistakes

How long your answer should be

Under 2 minutes, 4–6 sentences.

Read this

Previous in Sequence models and transformers: In a recurrent neural network, what is a "gate", and how does a number between 0 and 1 act like a tap that controls how much information passes through?
Next in Sequence models and transformers: In attention, what do the query, keys and values stand for, and how is the output a weighted average? If the attention weights over three values 10,20,30 are 0.7,0.2,0.1, what is the output?