A padding token is a placeholder inserted after shorter sequences so a batch reaches a shared length without adding sequence content. Models can identify these positions and ignore them during processing. section 14.5.3 section 15.4.3
A padded review
The token sequence c("the", "movie", "was", "awful", "[PAD]", "[PAD]", "[PAD]", "[PAD]") keeps a short review aligned with longer sequences while preserving its actual words.
Padding tokens support several connected preprocessing steps:
- Pack sequences to a fixed length, appending padding after the meaningful tokens and trimming sequences that exceed the limit. section 15.4.3
- Return a padding mask alongside token IDs so downstream models can distinguish real tokens from padding positions. section 15.4.3



