mlsanityData to 7 Oct 2026

In-context Pretraining: Language Modeling Beyond Document Boundaries

arXiv 2310.10638 ↗First posted 16 Oct 2023cs.CL cs.AI cs.LGcited by 76

Not on the map. Why?

Abstract (arXiv)

Large language models (LMs) are currently trained to predict tokens given document prefixes, enabling them to directly perform long-form generation and prompting-style tasks which can be reduced to document completion. Existing pretraining pipelines train LMs by concatenating random sets of short documents to create input contexts but the prior documents provide no signal for predicting the next document. We instead present In-Context Pretraining, a new approach where language models are pretrained on a sequence of related documents, thereby explicitly encouraging them to read and reason across document boundaries. We can do In-Context Pretraining by simply changing the document ordering so that each context contains related documents, and directly applying existing pretraining pipelines. However, this document sorting problem is challenging. There are billions of documents and we would like the sort to maximize contextual similarity for every document without repeating any data. To do this, we introduce approximate algorithms for finding related documents with efficient nearest neighbor search and constructing coherent input contexts with a graph traversal algorithm. Our experiments show In-Context Pretraining offers a simple and scalable approach to significantly enhance LMs'performance: we see notable improvements in tasks that require more complex contextual reasoning, including in-context learning (+8%), reading comprehension (+15%), faithfulness to previous contexts (+16%), long-context reasoning (+5%), and retrieval augmentation (+9%).

Key facts. Cited by 76 papers in the map (data through 7 Oct 2026). Builds on 50 of its 63 references that are in the map. First posted on arXiv 16 Oct 2023.

Builds on

50 of 63 references.

References · 50

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2022Training language models to follow instructions with human feedbackcited by 15,712
  3. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  4. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  5. 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,115
  6. 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,686
  7. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
  8. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
  9. 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,895
  10. 2017Billion-scale similarity search with GPUscited by 2,477
  11. 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
  12. 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,140
38 more
  1. 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
  2. 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
  3. 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,371
  4. 2021Unsupervised Dense Information Retrieval with Contrastive Learningcited by 1,203
  5. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
  6. 2019DROP: A Reading Comprehension Benchmark Requiring Discrete Reasoning Over Paragraphscited by 883
  7. 2022Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Taskscited by 858
  8. 2017RACE: Large-scale ReAding Comprehension Dataset From Examinationscited by 851
  9. 2023Large Language Models Can Be Easily Distracted by Irrelevant Contextcited by 820
  10. 2023REPLUG: Retrieval-Augmented Black-Box Language Modelscited by 786
  11. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
  12. 2019CCNet: Extracting High Quality Monolingual Datasets from Web Crawl Datacited by 544
  13. 2021MetaICL: Learning to Learn In Contextcited by 450
  14. 2020TweetEval: Unified Benchmark and Comparative Evaluation for Tweet Classificationcited by 414
  15. 2023How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resourcescited by 405
  16. 2021Entity-Based Knowledge Conflicts in Question Answeringcited by 349
  17. 2022One Embedder, Any Task: Instruction-Finetuned Text Embeddingscited by 329
  18. 2023Trusting Your Evidence: Hallucinate Less with Context-aware Decodingcited by 319
  19. 2023SemDeDup: Data-efficient learning at web-scale through semantic deduplicationcited by 295
  20. 2023RECOMP: Improving Retrieval-Augmented LMs with Compression and Selective Augmentationcited by 253
  21. 2022LinkBERT: Pretraining Language Models with Document Linkscited by 209
  22. 2023Inverse Scaling: When Bigger Isn't Bettercited by 205
  23. 2023RA-DIT: Retrieval-Augmented Dual Instruction Tuningcited by 194
  24. 2022SCROLLS: Standardized CompaRison Over Long Language Sequencescited by 170
  25. 2021Meta-learning via Language Model In-context Tuningcited by 163
  26. 2022Retrieval-Augmented Multimodal Language Modelingcited by 125
  27. 2022Training Language Models with Memory Augmentationcited by 112
  28. 2020Pre-training via Paraphrasingcited by 92
  29. 2020The Turking Test: Can Language Models Understand Instructions?cited by 82
  30. 2023Context-faithful Prompting for Large Language Modelscited by 76
  31. 2023Resolving Knowledge Conflicts in Large Language Modelscited by 49
  32. 2023Knowledge Card: Filling LLMs' Knowledge Gaps with Plug-in Specialized Language Modelscited by 46
  33. 2023Pre-Training to Learn in Contextcited by 41
  34. 2022Nonparametric Masked Language Modelingcited by 39
  35. 2021Dict-BERT: Enhancing Language Model Pre-training with Dictionarycited by 38
  36. 2021The Inductive Bias of In-Context Learning: Rethinking Pretraining Example Designcited by 33
  37. 2022Data-Efficient Finetuning Using Cross-Task Nearest Neighborscited by 26
  38. 2020Machine Reading Comprehension: The Role of Contextualized Language Models and Beyondcited by 21

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 4; 2024: 37; 2025: 26; 2026: 9.

76 papers.

Sort:

By area:

  1. 2024MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategiescited by 694
  2. 2024The Faiss librarycited by 370
  3. 2024RAFT: Adapting Language Model to Domain Specific RAGcited by 258
  4. 2024MUSE: Machine Unlearning Six-Way Evaluation for Language Modelscited by 251
  5. 2024VisRAG: Vision-based Retrieval-augmented Generation on Multi-modality Documentscited by 237
  6. 2024Make Your LLM Fully Utilize the Contextcited by 118
  7. 2024Found in the Middle: Calibrating Positional Attention Bias Improves Long Context Utilizationcited by 97
  8. 2024Catastrophic Failure of LLM Unlearning via Quantizationcited by 76
  9. 2024Reliable, Adaptable, and Attributable Language Models with Retrievalcited by 73
  10. 2024Large Scale Transfer Learning for Tabular Data via Language Modelingcited by 73
  11. 2024DevEval: A Manually-Annotated Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 71
  12. 2025CAD-Llama: Leveraging Large Language Models for Computer-Aided Design Parametric 3D Model Generationcited by 65
38 more
  1. 2024Instruction Pre-Training: Language Models are Supervised Multitask Learnerscited by 63
  2. 2025ChunkKV: Semantic-Preserving KV Cache Compression for Efficient Long-Context LLM Inferencecited by 57
  3. 2024UDA: A Benchmark Suite for Retrieval Augmented Generation in Real-world Document Analysiscited by 40
  4. 2024Lory: Fully Differentiable Mixture-of-Experts for Autoregressive Language Model Pre-trainingcited by 37
  5. 2024Fewer Truncations Improve Language Modelingcited by 33
  6. 2024In-Context Fine-Tuning for Time-Series Foundation Modelscited by 31
  7. 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 30
  8. 2024Parallel Structures in Pre-training Data Yield In-Context Learningcited by 26
  9. 2024Dataset Decomposition: Faster LLM Training with Variable Sequence Length Curriculumcited by 25
  10. 2024Analysing The Impact of Sequence Composition on Language Model Pre-Trainingcited by 22
  11. 2024Adaptive Contrastive Decoding in Retrieval-Augmented Generation for Handling Noisy Contextscited by 19
  12. 2023Structured Packing in LLM Training Improves Long Context Utilizationcited by 17
  13. 2024Quest: Query-centric Data Synthesis Approach for Long-context Scaling of Large Language Modelcited by 15
  14. 2024What are the Essential Factors in Crafting Effective Long Context Multi-Hop Instruction Datasets? Insights and Best Practicescited by 14
  15. 2023Large Language Models are Miscalibrated In-Context Learnerscited by 12
  16. 2024Yi-Lightning Technical Reportcited by 11
  17. 2025GRU: Mitigating the Trade-off between Unlearning and Retention for LLMscited by 11
  18. 2024Improving Domain Adaptation through Extended-Text Reading Comprehensioncited by 10
  19. 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
  20. 2024MDCure: A Scalable Pipeline for Multi-Document Instruction-Followingcited by 10
  21. 2024DevEval: Evaluating Code Generation in Practical Software Projectscited by 9
  22. 2024Untie the Knots: An Efficient Data Augmentation Strategy for Long-Context Pre-Training in Language Modelscited by 9
  23. 2024A Survey on Responsible Generative AI: What to Generate and What Notcited by 8
  24. 2023EpiK-Eval: Evaluation for Language Models as Epistemic Modelscited by 6
  25. 2024BaichuanSEED: Sharing the Potential of ExtensivE Data Collection and Deduplication by Introducing a Competitive Large Language Model Baselinecited by 6
  26. 2025SkyLadder: Better and Faster Pretraining via Context Window Schedulingcited by 6
  27. 2025LongMagpie: A Self-synthesis Method for Generating Large-scale Long-context Instructionscited by 6
  28. 2025Harry Potter is Still Here! Probing Knowledge Leakage in Targeted Unlearned Large Language Models via Automated Adversarial Promptingcited by 6
  29. 2025Not All Tokens Are Meant to Be Forgottencited by 6
  30. 2025Improving Fisher Information Estimation and Efficiency for LoRA-based LLM Unlearningcited by 6
  31. 2023Beyond Output Matching: Bidirectional Alignment for Enhanced In-Context Learningcited by 5
  32. 2025DICE: Dynamic In-Context Example Selection in LLM Agents via Efficient Knowledge Transfercited by 5
  33. 2025EntropyLong: Effective Long-Context Training via Predictive Uncertaintycited by 5
  34. 2024Investigating the Effectiveness of HyperTuning via Gistingcited by 4
  35. 2024Automatically Generating Numerous Context-Driven SFT Data for LLMs across Diverse Granularitycited by 4
  36. 2025A Survey of LLM × DATAcited by 4
  37. 2025Continuously Steering LLMs Sensitivity to Contextual Knowledge with Proxy Modelscited by 4
  38. 2025Synthetic bootstrapped pretrainingcited by 4

50 most cited of 76 All 76 (JSON)