Padding and Masks for Different Sequence Lengths
Batching sequences of different lengths can add padding positions. A mask can tell operations which positions count as actual input.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace two lengths
Sequences of lengths two and four can both occupy four slots, with the first mask marking only its first two. An average over all four slots would dilute the short sequence under a simple zero-padding rule. See missing inputs.
Test the masked interface
Compare a sequence alone with the same sequence in a padded batch under the model's expected semantics. Axis selection helps identify where masking must apply.[1]