Papers › Analysing The Impact of Sequence Composition on Language Model Pre-Training

Analysing The Impact of Sequence Composition on Language Model Pre-Training

21 Feb 2024arXiv:2402.13991archive 2025-07-28

Yu Zhao, Yuanbin Qu, Konrad Staniszewski, Szymon Tworkowski, Wei Liu, Piotr Miłoś, Yuxiang Wu, Pasquale Minervini

Most language model pre-training frameworks concatenate multiple documents into fixed-length sequences and use causal masking to compute the likelihood of each token given its context; this strategy is widely adopted due to its simplicity and efficiency. However, to this day, the influence of the pre-training sequence composition strategy on the generalisation properties of the model remains under-explored. In this work, we find that applying causal masking can lead to the inclusion of distracting information from previous documents during pre-training, which negatively impacts the performance of the models on language modelling and downstream tasks. In intra-document causal masking, the likelihood of each token is only conditioned on the previous tokens in the same document, eliminating potential distracting information from previous documents and significantly improving performance. Furthermore, we find that concatenating related documents can reduce some potential distractions during pre-training, and our proposed efficient retrieval-based sequence construction method, BM25Chunk, can improve in-context learning (+11.6\%), knowledge memorisation (+9.8\%), and context utilisation (+7.2\%) abilities of language models without sacrificing efficiency.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2402.13991")

Code

Syntology Ran 21 of 21 code samples harvested from 1 repository linked to this paper; 0 have no recorded run. Of those that ran: 3 ran · our draft was wrong; 2 ran · fixture could not drive it; 16 ran with no contract checked.

By repository: official repository: 21 samples from 1 repository, 21 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

yuzhaouoe/pretraining-data-packing officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

21 samples harvested; 21 ran; 0 honoured the contract we drafted; 0 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

3ran · our draft was wrong
2ran · fixture could not drive it
16ran

Licence: 0 of the 21 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from yuzhaouoe/pretraining-data-packing. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

repeat_kv yuzhaouoe/pretraining-data-packing/llama_modeling.py official repository ran · fixture could not drive it fingerprinted MIT (permissive) · 30d7eec482ebf6b1 · report
apply_rotary_pos_emb yuzhaouoe/pretraining-data-packing/llama_modeling.py official repository ran · fixture could not drive it MIT (permissive) · f725bc2d76076485 · report
data_collator yuzhaouoe/pretraining-data-packing/packing_dataset.py official repository ran MIT (permissive) · 874a9519ebeb3c53 · report
estimate_total_batch_num yuzhaouoe/pretraining-data-packing/save_offline_dataset.py official repository ran MIT (permissive) · eb90b0d7f1e2c692 · report
eval_generation_em yuzhaouoe/pretraining-data-packing/evaluation/eval_utils.py official repository ran MIT (permissive) · d9243c078ceacce8 · report
exact_match_score yuzhaouoe/pretraining-data-packing/evaluation/eval_utils.py official repository ran fingerprinted MIT (permissive) · efa3643614e9c5f5 · report
get_batch_dir_and_path yuzhaouoe/pretraining-data-packing/analysis/burstiness.py official repository ran MIT (permissive) · bb142953e9e84a14 · report
get_fragment_lens yuzhaouoe/pretraining-data-packing/packing_dataset.py official repository ran fingerprinted MIT (permissive) · 1bc433883369de22 · report
get_offset_path yuzhaouoe/pretraining-data-packing/utils.py official repository ran fingerprinted MIT (permissive) · da105da73281cce5 · report
get_worker_id_and_iter_indices yuzhaouoe/pretraining-data-packing/packing_dataset.py official repository ran MIT (permissive) · 2a6a0d112f2ef000 · report
load_json yuzhaouoe/pretraining-data-packing/evaluation/fewshot.py official repository ran · our draft was wrong MIT (permissive) · 813da56adc0dd787 · report
load_jsonl yuzhaouoe/pretraining-data-packing/evaluation/fewshot.py official repository ran MIT (permissive) · ad0a5228eb3d81f4 · report
load_offset yuzhaouoe/pretraining-data-packing/utils.py official repository ran MIT (permissive) · 11cde6e6bca04ca4 · report
load_pickle yuzhaouoe/pretraining-data-packing/utils.py official repository ran MIT (permissive) · b678e0cd3681e4cd · report
metric_max_over_ground_truths yuzhaouoe/pretraining-data-packing/evaluation/eval_utils.py official repository ran · our draft was wrong MIT (permissive) · 6829ceb72569fa12 · report
normalise_pred yuzhaouoe/pretraining-data-packing/evaluation/fewshot.py official repository ran fingerprinted MIT (permissive) · 9afac6122e0fd74e · report
process_batch_attn yuzhaouoe/pretraining-data-packing/analysis/distraction.py official repository ran MIT (permissive) · 137756758ba95a6a · report
rotate_half yuzhaouoe/pretraining-data-packing/llama_modeling.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · b99eea6376d1e212 · report
save_data_collator yuzhaouoe/pretraining-data-packing/save_offline_dataset.py official repository ran MIT (permissive) · efbd9b87adf49321 · report
tokenize_one_item yuzhaouoe/pretraining-data-packing/analysis/distraction.py official repository ran MIT (permissive) · b494dc24033bda53 · report
zipfian_fit yuzhaouoe/pretraining-data-packing/analysis/burstiness.py official repository ran MIT (permissive) · 92ed24e518eb48dc · report

Tasks

In-Context LearningLanguage ModelingLanguage ModellingRetrieval

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections