
SG
Sunny Guha
· 1 min read
ResearcharXiv cs.LG
Critical Sequence Length: A Note on How Document Structure Bounds Gradient-Noise Reduction
arXiv:2612.03183v1 Announce Type: new
Abstract: LLM pre-training commonly treats every token in a training sequence as an independent sample of the gradient. Under this assumption, gradient noise scales as 1/(BS) for batch size B and sequence length S, so B is halved whenever S is doubled. We show that this rule breaks down beyond a certain length, and that the point where it breaks down can be measured. Guided by a simple model of how gradient noise arises in next-token training, we split the noise into two parts: a per-token term that averages away as 1/S, and a floor, caused by correlations between tokens of the same document, that does not. The two meet at a critical sequence length S*. Below it, longer sequences reduce gradient noise; above it, they add context but barely reduce the noise. We test this picture on GPT models from 125M to 1B parameters, trained on short web documents (FineWeb-Edu) and on whole books (Project Gutenberg), and find that it fits well, with informative exceptions on books and on artificially chopped data. Three findings stand out. First, S* is set by the data: it depends on the documents and on how they are packed into sequences, and chopping documents into short pieces halves the floor. Second, the critical length measured on the updates that AdamW actually applies is largely stable across model sizes and training time (and, at 1B, across corpora) and grows only with the training length, whereas the raw-gradient version varies widely. Third, validation loss is lowest when training near this length and changes little beyond it, but downstream performance is more fragile: it drops modestly as more documents are packed into each sequence and collapses when documents are chopped into short pieces. Intra-document attention masking keeps the critical length stable under heavy packing and lowers the loss. These results lead to a simple, regime-aware rule for trading batch size against sequence length.
Original source
This story was published by arXiv cs.LG and written by Sunny Guha. SyncAI.news shows a preview; the complete article is on the publisher's site.
Read the full story on arxiv.org


