F
Member
【Editorial Discussion】
Packing several short examples into one training sequence saves padding, but it also creates a boundary question. Excluding a token from the loss is not the same as preventing attention to that token. If a task assumes independent records while the packed implementation allows later examples to attend to earlier ones, training can provide information that will not exist when those examples are served independently.
Cross-record attention is not universally a bug. Some language-model training deliberately concatenates documents. The engineering issue is whether the implemented objective matches the declared one. For supervised fine-tuning on independent records, a separator or end-of-sequence token alone is not evidence of enforced attention isolation.
**A controlled boundary probe**
Construct two toy records, A and B, with a target in B whose inputs should be entirely local to B. Put a randomly chosen marker in A. In evaluation mode, with dropout disabled, run the packed sequence twice while changing only that marker. Compare the logits at B's supervised positions. Under true record isolation, they should agree within the numerical tolerance appropriate to that implementation.
Keep A's token length fixed during this intervention. Otherwise B's positions shift and positional encoding becomes a competing explanation. Use a fresh forward pass rather than a reused inference cache. Repeat with B alone, with the same intended local positions and labels. This separates cross-record influence from a changed positional setup.
**Debug the first divergence**
- Inspect attention visibility independently of label masking. Ignored labels remove direct loss terms; their token representations may still be available as context. If a packed kernel uses sequence-boundary metadata instead of a dense mask, inspect that actual metadata and exercise the kernel used for training.
- Check shifted labels at the join. Confirm which token predicts the first supervised token in B and whether a boundary token accidentally acquires a target from the next record. Compare the number and identity of supervised positions before comparing a scalar loss.
- Match loss reduction. A packed token-average and an average of per-example averages can differ without any attention leak. Compute per-token losses and reconstruct the intended reduction before treating a scalar mismatch as evidence of broken isolation.
The probe has limits: unchanged logits on one toy pair do not establish isolation for every input, and a model insensitive to the chosen marker can conceal a permissive mask. Combine multiple adversarially informative markers with direct boundary inspection. Small differences may also come from kernel arithmetic rather than information transfer.
What minimal packed-versus-unpacked test do you keep before a fine-tuning run? How do you distinguish an attention-boundary defect from label shifting, position resets, or a legitimate change in example weighting?
Packing several short examples into one training sequence saves padding, but it also creates a boundary question. Excluding a token from the loss is not the same as preventing attention to that token. If a task assumes independent records while the packed implementation allows later examples to attend to earlier ones, training can provide information that will not exist when those examples are served independently.
Cross-record attention is not universally a bug. Some language-model training deliberately concatenates documents. The engineering issue is whether the implemented objective matches the declared one. For supervised fine-tuning on independent records, a separator or end-of-sequence token alone is not evidence of enforced attention isolation.
**A controlled boundary probe**
Construct two toy records, A and B, with a target in B whose inputs should be entirely local to B. Put a randomly chosen marker in A. In evaluation mode, with dropout disabled, run the packed sequence twice while changing only that marker. Compare the logits at B's supervised positions. Under true record isolation, they should agree within the numerical tolerance appropriate to that implementation.
Keep A's token length fixed during this intervention. Otherwise B's positions shift and positional encoding becomes a competing explanation. Use a fresh forward pass rather than a reused inference cache. Repeat with B alone, with the same intended local positions and labels. This separates cross-record influence from a changed positional setup.
**Debug the first divergence**
- Inspect attention visibility independently of label masking. Ignored labels remove direct loss terms; their token representations may still be available as context. If a packed kernel uses sequence-boundary metadata instead of a dense mask, inspect that actual metadata and exercise the kernel used for training.
- Check shifted labels at the join. Confirm which token predicts the first supervised token in B and whether a boundary token accidentally acquires a target from the next record. Compare the number and identity of supervised positions before comparing a scalar loss.
- Match loss reduction. A packed token-average and an average of per-example averages can differ without any attention leak. Compute per-token losses and reconstruct the intended reduction before treating a scalar mismatch as evidence of broken isolation.
The probe has limits: unchanged logits on one toy pair do not establish isolation for every input, and a model insensitive to the chosen marker can conceal a permissive mask. Combine multiple adversarially informative markers with direct boundary inspection. Small differences may also come from kernel arithmetic rather than information transfer.
What minimal packed-versus-unpacked test do you keep before a fine-tuning run? How do you distinguish an attention-boundary defect from label shifting, position resets, or a legitimate change in example weighting?

