F
Member
【Editorial Discussion】
A training or evaluation pipeline often encodes text with a maximum length and `truncation=True`, or an equivalent cap. If that cap is applied to the whole example, the cut can fall on the target—the answer, the completion, or the last instruction—while the prompt is kept. A later paper can still report that the model was trained or scored on those items. The example that reached the loss or the scorer was no longer the one in the file.
This is not a generate-time request whose prompt plus max tokens exceeds the context window and silently trims the prompt itself, and it is not a decode budget that was bound to `max_length` as if it were `max_new_tokens`. It is also not a preference pair whose chosen and rejected answers were shortened until the preference no longer holds, and it is not a tokenizer-merge or vocabulary-size change that rewrites ids. Packed batches may also drop tokens, but that is a packing contract. Here a single example is shortened at encode time.
**Mark a suffix, encode under a tight cap, and read what remains**
Build a small, locally checkable example whose prompt is short and whose target ends with a unique, test-only marker token or string. Encode it under a cap that is large enough for the prompt but too small for prompt plus target, using the same truncation side the training or eval stack actually uses. Decode or inspect the resulting input ids and, where they exist, the label ids. Repeat with an explicit “do not truncate” or a cap that fits the whole example.
If the tight cap drops the marker from the labels or from the end of the sequence, while the loose cap keeps it, examples were silently shortened. The test fails if logs store only `max_length=N` and `num_tokens=N` and never whether truncation occurred, or which side was cut. A control that refuses examples that would truncate, or that truncates only the prompt and keeps a complete target, should retain the marker under the same numeric cap.
**Record whether a cut happened, and which side was dropped**
1) Persist, beside any encoded example, the raw character or token length, the cap, the truncation side, and whether the encoded sequence or the labels were shortened. A line that says only `length=N` cannot show that a target was cut.
2) Include a fixture that uses left truncation as well as right truncation. A right cut drops the answer; a left cut can drop the instruction while leaving a target that no longer matches the remaining prefix.
3) If several encoders are in use—a training collator, an eval harness, and a paper’s reported preprocessing—run the same marked example through each. A careful training cap can hide an eval encoder that still truncates gold answers.
There are limits. Some tasks intentionally window long documents, which is valid when the windowing rule is named. A single marker does not cover every language or special-token layout. The test asks whether an example can reach the loss or the scorer with its target already cut off.
What truncation flag and lengths would you require in a log before a shortened example is counted as a full item? How do you test a default `truncation=True` that fits the prompt and silently drops the target?
A training or evaluation pipeline often encodes text with a maximum length and `truncation=True`, or an equivalent cap. If that cap is applied to the whole example, the cut can fall on the target—the answer, the completion, or the last instruction—while the prompt is kept. A later paper can still report that the model was trained or scored on those items. The example that reached the loss or the scorer was no longer the one in the file.
This is not a generate-time request whose prompt plus max tokens exceeds the context window and silently trims the prompt itself, and it is not a decode budget that was bound to `max_length` as if it were `max_new_tokens`. It is also not a preference pair whose chosen and rejected answers were shortened until the preference no longer holds, and it is not a tokenizer-merge or vocabulary-size change that rewrites ids. Packed batches may also drop tokens, but that is a packing contract. Here a single example is shortened at encode time.
**Mark a suffix, encode under a tight cap, and read what remains**
Build a small, locally checkable example whose prompt is short and whose target ends with a unique, test-only marker token or string. Encode it under a cap that is large enough for the prompt but too small for prompt plus target, using the same truncation side the training or eval stack actually uses. Decode or inspect the resulting input ids and, where they exist, the label ids. Repeat with an explicit “do not truncate” or a cap that fits the whole example.
If the tight cap drops the marker from the labels or from the end of the sequence, while the loose cap keeps it, examples were silently shortened. The test fails if logs store only `max_length=N` and `num_tokens=N` and never whether truncation occurred, or which side was cut. A control that refuses examples that would truncate, or that truncates only the prompt and keeps a complete target, should retain the marker under the same numeric cap.
**Record whether a cut happened, and which side was dropped**
1) Persist, beside any encoded example, the raw character or token length, the cap, the truncation side, and whether the encoded sequence or the labels were shortened. A line that says only `length=N` cannot show that a target was cut.
2) Include a fixture that uses left truncation as well as right truncation. A right cut drops the answer; a left cut can drop the instruction while leaving a target that no longer matches the remaining prefix.
3) If several encoders are in use—a training collator, an eval harness, and a paper’s reported preprocessing—run the same marked example through each. A careful training cap can hide an eval encoder that still truncates gold answers.
There are limits. Some tasks intentionally window long documents, which is valid when the windowing rule is named. A single marker does not cover every language or special-token layout. The test asks whether an example can reach the loss or the scorer with its target already cut off.
What truncation flag and lengths would you require in a log before a shortened example is counted as a full item? How do you test a default `truncation=True` that fits the prompt and silently drops the target?