Researchers from TU Darmstadt and UKP Lab published OctoLong, a context engineering pipeline that fixes a blind spot in long-context training data: code corpora almost never capture cross-repository dependency chains. Released August 5, the paper introduces a three-tool stack—AST parser, language server backend, and package manager—that recursively traverses import graphs and symbol references to assemble training contexts of millions of tokens.

Standard long-context corpora rely on books, academic papers, and single-repository code dumps. None contain the cross-module, cross-package logic that coding agents encounter in production. When a function call threads through four upstream libraries, agents must resolve that logic in full. OctoLong's pipeline does this: start from an entry-point symbol, walk the language server's reference graph, pull in transitively imported packages, and repeat recursively until context budget is reached.

OctoLong pipeline: three-tool stack recursively assembles cross-repository training contexts from an entry-point symbol.
FIG. 02 OctoLong pipeline: three-tool stack recursively assembles cross-repository training contexts from an entry-point symbol. — OctoLong paper, TU Darmstadt / UKP Lab, 2025

The resulting training mix totals roughly 50B tokens. OctoLong-specific cross-repository contexts account for 6.2B tokens—12% of the total. The OctoLong-Instruct model suite trains on this mixture via mid-training context extension, then fine-tunes on ~10B tokens of instruction data. Models span 600M to 14B parameters, making gains reproducible across inference budgets rather than confined to frontier-scale checkpoints.

Mid-training token mix: OctoLong cross-repository contexts replace 12 % of the standard corpus.
FIG. 03 Mid-training token mix: OctoLong cross-repository contexts replace 12 % of the standard corpus. — OctoLong paper, TU Darmstadt / UKP Lab, 2025

Evaluations across 18 open-weight long-context LMs show that replacing 12% of the training corpus with OctoLong data improves long-range retrieval, long-term state tracking, repository-level code understanding, and agentic task performance. API usage accuracy in non-long-context coding scenarios also improves, suggesting the cross-repo training signal generalizes rather than overfits to needle-in-a-haystack recall.

Evaluation DimensionContext Type TestedObserved Effect
Long-range retrievalLong-contextImproved
Long-term state trackingLong-contextImproved
Repository-level code understandingLong-contextImproved
Agentic task performanceLong-contextImproved
API usage accuracyNon-long-context codingImproved — signal generalizes beyond needle-in-a-haystack recall
FIG. 04 Evaluation dimensions across 18 open-weight long-context LMs where OctoLong data substitution drove gains. — OctoLong paper, TU Darmstadt / UKP Lab, 2025

OctoLong is not proprietary. The methodology orchestrates standard developer tooling. Any team with access to a language server (Pyright, rust-analyzer, clangd) and a package manager can replicate the pipeline against their own codebases. That matters for practitioners fine-tuning domain-specific code agents—financial infrastructure teams, compiler engineers, embedded systems developers—who need dependency structures representative of their own stacks.

Two limits warrant attention. First, contexts reach millions of tokens during curation, but the paper does not fully detail the lengths at which trained models are evaluated; production teams should benchmark at actual deployment context lengths. Second, recursive reference retrieval assumes a correctly configured language server, a non-trivial requirement for polyglot repositories or legacy codebases with incomplete type information.

For teams planning context-extension fine-tuning of repo-level coding agents: data substitution rate is the lever. Replacing 12% of a 50B-token mixture with AST/language-server-constructed cross-repository chains drives the gains. The pipeline is open methodology; the cost is language server infrastructure, not a proprietary license.