Teacher forcing
Teacher forcing is a sequence-model training technique that supplies the ground-truth preceding output as input when predicting the next output.
Inside Deep Learning: Math, Algorithms, Models
A training approach for sequence decoders that feeds the true previous token as the next input instead of the model's own prediction.
- How it is used
- Trains Seq2Seq decoders by supplying the correct previous token during decoding.
- How deep it goes
- Explains the input swap, its training benefit, and the training-versus-evaluation control flow in code.
- Examples
- Uses a decoder-step figure and a forward-pass code path that selects the next decoder input.
- What you can do after
- Apply it to train sequence decoders that learn faster while still supporting autoregressive prediction later.
Read how Inside Deep Learning: Math, Algorithms, Models explains teacher forcing →
Graph Neural Networks in Action
Teacher forcing is a sequential-model training technique that supplies the ground-truth previous output as input when predicting the next step.
- How it is used
- Trains sequential graph decoders while controlling whether each step receives ground-truth data or its preceding prediction.
- How deep it goes
- Explains the input-switching behavior and shows its decoder implementation, but does not discuss scheduling strategies or quantitative trade-offs.
- Examples
- Demonstrates teacher forcing with pose-graph frames and contrasts training-time ground-truth inputs with multi-step prediction using teacher_forcing=False.
- What you can do after
- Apply it via a PyTorch decoder’s teacher_forcing flag to train with real frames and forecast future graphs autoregressively.
Read how Graph Neural Networks in Action explains teacher forcing →
Related concepts
- recurrent neural networkuses · A recurrent neural network is a neural network that processes sequences by updating an internal state across successive inputs, allowing earlier inputs to influence later computations.
- labeluses · A label is a value or annotation associated with an item that identifies its target category, outcome, or reference answer for learning or evaluation.
- tokenuses · A token is a discrete unit of text, such as a word, word fragment, character, or symbol, represented and processed as an element by a language model.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

