Cover the lengths your real inputs and outputs need; truncating examples can cut off the answer and teach the model to stop early.
Memory and compute grow with sequence length (attention cost, activation memory), so choose the smallest length that covers most examples and handle outliers by filtering or splitting.
Use packing or length-grouped batching to reduce padding waste, and make sure the length matches the context you will use at inference.
Loading…