Teacher forcing : Why move the answer to one right during training
Check self-return monitoring from the encoder decoder input to the label.
Learning objectives and first steps2 objectives 2 first fixes
Try to do it after reading
- Check self-return monitoring from the encoder decoder input to the label.
- Check the input, label and evaluation conditions in the example
Suggested first
- Text Tasks and Language Expressions
- Conditional probability and vector calculations
Each step predicts the next word
Sequence-to-sequence models map one input sequence to another, e.g. translate the Chinese sentence into English. The decoder generates the target sequentially, and the prediction of the current position can rely on the input content and the previous word, but cannot see the ungenerated word directly. The use of real historical objectives as a condition for training, commonly referred to as teacher forcing 。
This approach allows for a stable monitoring context for each location and facilitates the calculation of losses in parallel. It does not directly plug the correct answer to the current position into the classifier: the decoder must be staggered from the monitoring label and use a causal mask to block future information. The shift was in the wrong direction, and the training loss could be extraordinary, but the inference was totally unusable.
How do we line up the three target words
Assuming the target is "we / study / models", the mark will also have to be closed. Decoder input is the initial tag, we, study, models, the supervised tag is we, study, models, and the end tag. The first output predicts we based on the starter and source sentence, the second predicts when study based on the real we, and the final learning will stop.
Short sentences in the batch are filled to the same length, but the completed label should not normally contribute words to predict losses. The end mark is different from the completion mark: the former is a true cessation event that the model needs to learn, while the latter is merely a means of mass organization. If an error shielding the end mark, the model may not know when it will end; If a large number of positions are added to the label, the loss can easily be diluted in meaningless positions.
Training conditions are different from generation conditions
Real historical terms cannot be inferred, and only continue to enter the results previously generated. Early errors may change the context in which they follow, and therefore the word-by-word test of the loss cannot be equated with the full generation quality. Simultaneous and freely generated conditions should be checked simultaneously, with clear decoding strategies, maximum length and cessation conditions.
Another common type of error is the mixing of attention with self-observed mask. Source sentences can be seen as a whole in ordinary translation tasks, while target end must follow the generation order; Source padding still needs to be blocked. Different model structures are checked against their specific input protocols, and no mechanical copy of a mask is possible for all attention layers.
Debugs can use two or three very short sentences to allow the model to print input, label and valid position to be merged. If these samples cannot be remembered, the scale of the model will be considered after checking the movement, the vocabulary and the loss. The completion of the compact only proves that the link may work and does not represent the quality of the transposition or translation.
Check understanding
Can end tags be ignored as if they were completed?
Usually not. End mark is a target event requiring learning; The number of places filled is the number of batch calculations. Combining the two would affect cessation and the denominator of loss.
Is it true that the first word in the training was leaking the answer?
This is the normal setting of conditions that appear to be training. The true leakage is to show current projections to current or future targets or to use extrapolated information that is not available at the time of evaluation.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.