F
Member
【Editorial Discussion】
Language-model stacks often have a `padding_side` for left or right padding. Training recipes commonly right-pad causal batches. Evaluation often left-pads variable-length sequences so completed positions align on the right. If one side is used in training and the other at eval, position ids or attention masks can disagree with the run that produced the weights. The padding contract is not the one the checkpoint was trained under.
This is not a left-padded batch decoded under a different attention kernel whose padding mask breaks, and it is not a loss ignore index that fails to match the padding token. It is also not a throughput figure that counts padding as real tokens, a prefix cache that reused KV from the wrong position, or a BOS token prepended twice. The side was switched between train and eval.
**Train on one side, then evaluate on the other**
Build a small, locally checkable causal-LM fixture with variable-length sequences, a documented pad id, and a unique marker at the start of some sequences and at the end of others. Run three conditions. In condition A, training and evaluation use the same documented padding side. In condition B, training right-pads and evaluation left-pads, or the reverse. In condition C, a serving default overrides the tokenizer padding side after the checkpoint is loaded. Record the train and eval sides, the position ids at the marker, and whether a short diagnostic that depends on the first or last non-pad token still matches A.
If B or C disagrees with A on that diagnostic while logs still say `padding_side=right`, the contract was not bound. The test fails if the run records only a pad id and never the side used in each phase. A control that persists the train and eval sides, and that refuses an eval whose side differs from the training card unless the difference is explicit, should keep B and C from being reported as A.
**Record the train side, the eval side, and a position check**
1) Persist, beside any train or eval run, the padding side, the pad id, and a probe of position ids at a documented start and end marker. A line that says only `pad_id=…` cannot show which side was used.
2) Include a fixture of equal-length sequences, where a side change is a no-op, and one of mixed lengths, where left and right padding place the same token at different positions. A check that only uses equal-length batches will hide the failure.
3) If a tokenizer config, a trainer default, and a serving flag can each set the side, run the same fixture through each source. A correct trainer side can hide a server that still left-pads at eval.
There are limits. Some architectures are trained with left padding, or require a side change at decode; that is valid when both sides are named. The test asks whether eval can silently switch padding side relative to training and still be reported as the same contract.
What train and eval padding sides, plus a position-id probe, would you require before two runs are treated as the same padding contract? How do you test a serving default that left-pads a checkpoint trained with right padding?
Language-model stacks often have a `padding_side` for left or right padding. Training recipes commonly right-pad causal batches. Evaluation often left-pads variable-length sequences so completed positions align on the right. If one side is used in training and the other at eval, position ids or attention masks can disagree with the run that produced the weights. The padding contract is not the one the checkpoint was trained under.
This is not a left-padded batch decoded under a different attention kernel whose padding mask breaks, and it is not a loss ignore index that fails to match the padding token. It is also not a throughput figure that counts padding as real tokens, a prefix cache that reused KV from the wrong position, or a BOS token prepended twice. The side was switched between train and eval.
**Train on one side, then evaluate on the other**
Build a small, locally checkable causal-LM fixture with variable-length sequences, a documented pad id, and a unique marker at the start of some sequences and at the end of others. Run three conditions. In condition A, training and evaluation use the same documented padding side. In condition B, training right-pads and evaluation left-pads, or the reverse. In condition C, a serving default overrides the tokenizer padding side after the checkpoint is loaded. Record the train and eval sides, the position ids at the marker, and whether a short diagnostic that depends on the first or last non-pad token still matches A.
If B or C disagrees with A on that diagnostic while logs still say `padding_side=right`, the contract was not bound. The test fails if the run records only a pad id and never the side used in each phase. A control that persists the train and eval sides, and that refuses an eval whose side differs from the training card unless the difference is explicit, should keep B and C from being reported as A.
**Record the train side, the eval side, and a position check**
1) Persist, beside any train or eval run, the padding side, the pad id, and a probe of position ids at a documented start and end marker. A line that says only `pad_id=…` cannot show which side was used.
2) Include a fixture of equal-length sequences, where a side change is a no-op, and one of mixed lengths, where left and right padding place the same token at different positions. A check that only uses equal-length batches will hide the failure.
3) If a tokenizer config, a trainer default, and a serving flag can each set the side, run the same fixture through each source. A correct trainer side can hide a server that still left-pads at eval.
There are limits. Some architectures are trained with left padding, or require a side change at decode; that is valid when both sides are named. The test asks whether eval can silently switch padding side relative to training and still be reported as the same contract.
What train and eval padding sides, plus a position-id probe, would you require before two runs are treated as the same padding contract? How do you test a serving default that left-pads a checkpoint trained with right padding?

