aiqbench analysis
OctoLong introduces a novel training methodology that integrates code dependency graphs directly into long-context corpora via AST parsing and package management tools. This approach demonstrates that replacing just 12% of standard text data with structured, cross-repository code contexts significantly improves models' ability to track state across millions of tokens in agentic workflows. The research validates a critical path for advancing open-weight language models capable of handling complex software engineering tasks beyond simple linear context windows.
OctoLong: Mid-Training On Cross-Repository Code Contexts Enhances Long-Context Modeling
arXiv:2608.05141v1 Announce Type: cross Abstract: Context lengths of language models (LMs) have dramatically increased, driven by the demands for in-context learning, self-improvement, and long-horizon agentic workflows. Existing long-context corpora, however, are dominated by books, academic articles, and code repositories, which are finite resources and often scarce in 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 facilitate the recursive retrieval of code references, enabling the curation of dependency-rich code contexts of millions of tokens in length. 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 ~50B-token mixture containing ~6.2B tokens of OctoLong code contexts, followed by ~10B tokens of instruction tuning. Our training ablations and experimental evaluations against 18 state-of-the-art open-weight long-context LMs show that supplanting just 12% of traditional 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 short-context coding scenarios.
Abstract:Context lengths of language models (LMs) have dramatically increased, driven by the demands for in-context learning, self-improvement, and long-horizon agentic workflows. Existing long-context corpora, however, are dominated by books, academic articles, and code repositories, which are finite resources and often scarce in 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 facilitate the recursive retrieval of code references, enabling the curation of dependency-rich code contexts of millions of tokens in length. 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 ~50B-token mixture containing ~6.2B tokens of OctoLong code contexts, followed by ~10B tokens of instruction tuning. Our training ablations and experimental evaluations against 18 state-of-the-art open-weight long-context LMs show that supplanting just 12% of traditional 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 short-context coding scenarios.
Artificial Intelligence (cs.AI); Machine Learning (cs.LG); Software Engineering (cs.SE)
arXiv:2608.05141 [cs.AI]
(or arXiv:2608.05141v1 [cs.AI] for this version)
https://doi.org/10.48550/arXiv.2608.05141 Focus to learn more arXiv-issued DOI via DataCite (pending registration)
arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.
Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.
Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.
Full text under the publisher's open licence · 281 words
Related coverage
Introducing North Mini Code: Cohere’s First Model For Developers
Hugging Face · Jun 9, 2026

Honest Abacus AI Review: ChatLLM, DeepAgent, AI Studio & More
KDnuggets · Aug 4, 2026

Vertical Advantage: Transforming Industries with Lakebase and Agentic AI
Databricks · Aug 27, 2026

BRICS Draws a New Global Line: Full Text of New Delhi Declaration
slguardian.org · Sep 12, 2026