mlsanityData to 14 Oct 2026

OctoLong: Mid-Training On Cross-Repository Code Contexts Enhances Long-Context Modeling

arXiv 2608.05141 ↗First posted 5 Aug 2026cs.AI cs.LG cs.SEcited by 2

On the map: LLM agents and tool use → Software engineering coding agents

Abstract (arXiv)

Context lengths of language models (LMs) have dramatically increased, driven by the demands for in-context learning, self-improvement, and long-horizon agentic workflows. However, existing long-context corpora are dominated by books, academic articles, and code repositories, which are finite and often lack long-distance dependencies. In this work, we introduce OctoLong, a context-engineering pipeline that instruments an AST parser, a language server backend, and a package manager to recursively retrieve code references, enabling the curation of dependency-rich code contexts up to millions of tokens long. We then train OctoLong-Instruct, a suite of capable long-context open LMs, derived from base models ranging in size from 600M to 14B parameters, via context-extension mid-training on a approx 50B-token mixture containing approx 6.2B tokens of OctoLong code contexts, followed by approx 10B tokens of instruction tuning. Our ablations and experimental evaluations against 18 strong long-context open-weight LMs show that supplanting just 12% of conventional context-extension corpora with OctoLong data yields substantial gains in long-range retrieval, long-term state tracking, repository-level code understanding, and downstream agentic tasks, while also enhancing API usage in regular coding scenarios.

Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 121 of its 169 references that are in the map. First posted on arXiv 5 Aug 2026.

Builds on

121 of 169 references.

Closest ancestors · 4

Same direction, newest first

  1. 2026BeyondSWE: Can Current Code Agent Survive Beyond Single-Repo Bug Fixing?3 Mar
  2. 2026ContextBench: A Benchmark for Context Retrieval in Coding Agents5 Feb
  3. 2026Large-Scale Terminal Agentic Trajectory Generation from Dockerized Environments1 Feb
  4. 2026daVinci-Dev: Agent-native Mid-training for Software Engineering26 Jan

Other references · 117

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2024The Llama 3 Herd of Modelscited by 14,715
  3. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
  4. 2020Longformer: The Long-Document Transformercited by 3,413
  5. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
  6. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,004
  7. 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,917
  8. 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,346
  9. 2024Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Dualitycited by 1,336
  10. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  11. 2024The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scalecited by 1,160
  12. 2024Tulu 3: Pushing Frontiers in Open Language Model Post-Trainingcited by 1,053
38 more
  1. 2024SnapKV: LLM Knows What You are Looking for Before Generationcited by 880
  2. 2023Enhancing Chat Language Models by Scaling High-quality Instructional Conversationscited by 839
  3. 2024LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memorycited by 707
  4. 2024WildChat: 1M ChatGPT Interaction Logs in the Wildcited by 629
  5. 2026Terminal-Bench: Benchmarking Agents on Hard, Realistic Tasks in Command Line Interfacescited by 585
  6. 2025Beyond the 80/20 Rule: High-Entropy Minority Tokens Drive Effective Reinforcement Learning for LLM Reasoningcited by 559
  7. 2018A Discourse-Aware Attention Model for Abstractive Summarization of Long Documentscited by 478
  8. 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
  9. 2019Multi-News: a Large-Scale Multi-Document Summarization Dataset and Abstractive Hierarchical Modelcited by 431
  10. 2025Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attentioncited by 407
  11. 2023Understanding the Effects of RLHF on LLM Generalisation and Diversitycited by 396
  12. 2024LongBench v2: Towards Deeper Understanding and Reasoning on Realistic Long-context Multitaskscited by 379
  13. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
  14. 2022The Stack: 3 TB of permissively licensed source codecited by 359
  15. 2024SWIFT:A Scalable lightWeight Infrastructure for Fine-Tuningcited by 355
  16. 2024Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothingcited by 346
  17. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 256
  18. 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 247
  19. 2023DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Modelscited by 245
  20. 2023L-Eval: Instituting Standardized Evaluation for Long Context Language Modelscited by 233
  21. 2024BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystackcited by 215
  22. 2022LinkBERT: Pretraining Language Models with Document Linkscited by 211
  23. 2024Data Engineering for Scaling Language Models to 128K Contextcited by 186
  24. 2021BookSum: A Collection of Datasets for Long-form Narrative Summarizationcited by 184
  25. 2024Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durationscited by 170
  26. 2025APIGen-MT: Agentic Pipeline for Multi-Turn Data Generation via Simulated Agent-Human Interplaycited by 167
  27. 2025Goedel-Prover-V2: Scaling Formal Theorem Proving with Scaffolded Data Synthesis and Self-Correctioncited by 154
  28. 2024How to Train Long-Context Language Models (Effectively)cited by 146
  29. 2024LongWriter: Unleashing 10,000+ Word Generation from Long Context LLMscited by 144
  30. 2023Continual Pre-Training of Large Language Models: How to (re)warm your model?cited by 137
  31. 2025OpenRubrics: Towards Scalable Synthetic Rubric Generation for Reward Modeling and LLM Alignmentcited by 132
  32. 2023What's In My Big Data?cited by 129
  33. 2024In-Context Learning with Long-Context Models: An In-Depth Explorationcited by 128
  34. 2025Context Length Alone Hurts LLM Performance Despite Perfect Retrievalcited by 127
  35. 2025NoLiMa: Long-Context Evaluation Beyond Literal Matchingcited by 126
  36. 2023Scaling Laws of RoPE-based Extrapolationcited by 125
  37. 2024MemoRAG: Boosting Long Context Processing with Global Memory-Enhanced Retrieval Augmentationcited by 119
  38. 2024RAGBench: Explainable Benchmark for Retrieval-Augmented Generation Systemscited by 117

50 most cited of 117 All 117 (JSON)

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 2.

2 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026Trained Agentic Context Management
  2. 2024Bootstrap Your Own Context Length
  3. 2026ReCUBE: Evaluating Repository-Level Context Utilization in Code Generation
  4. 2025Scaling Instruction-Tuned LLMs to Million-Token Contexts via Hierarchical Synthetic Data Generation
  5. 2024LongAlign: A Recipe for Long Context Alignment of Large Language Models
  6. 2024An Effective Framework to Help Large Language Models Handle Numeric-involved Long-context Tasks
  7. 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understanding
  8. 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs