Maya's missing implementations
Maya is assembling training data from shop/app.py. Her seed S calls pack.encode (A) and pack.audit (B). Both call codec.normalize (C), in another external package.
Teaching fixture: invented names, graph, and lengths. Each block stands for synthetic tokens, not measured Python tokenization.
Serializing only shop supplies the seed, but none of those external implementations. More files from shop can make the dump longer without exposing what these calls do.
If you are paying for long-sequence training, extra history should contain information worth using. The paper argues that repositories are often not self-contained and that dependency-deprived long contexts offer limited gains. §2; §3
Follow references, then put their source before the seed
OctoLong uses AST queries, environment-aware language-server resolution, and deduplicated breadth-first traversal to retrieve referenced implementations across repositories, then prepends dependency hops to build long training contexts. §3, Figure 2
Instead of treating a repository as a self-contained document, follow function and class references into installed dependencies, then follow their references. Collect source implementations, not just library names. §2–3
Maya's installed environment lets A and B resolve to source. Both lead to C, but C is collected once. The two-hop context is : synthetic tokens. It is too shallow for the paper's training-data filter.
Our inference: a causal language model can use preceding tokens, not future tokens. Putting dependencies before the seed makes them available during seed prediction; it does not guarantee successful use. Figure 2
Acquisition is not the whole training recipe
The contribution here is data acquisition, not BFS itself or a new attention architecture. The evaluated models additionally use a mixed corpus, context-extension training, checkpoint merging, and instruction tuning. §4; §6
Discover outward; write dependency layers first
C,A,B,S. BFS discovers layers [S], [A,B], [C], but each new layer is prepended and C is stored once. S,A,B,C confuses discovery with writing order; a library-name list omits extracted source.
The installed environment makes source discoverable; syntax queries locate calls; the resolver identifies declarations; a second query extracts implementations. BFS expands a whole frontier before moving deeper. A visited set prevents repeated implementations. §3
Notice the difference between discovery and writing order. Shared source enters the collection only once. Teaching fixture, not a reported trace.
Seed selection and acquisition gates
Repositories need at least 15 GitHub stars, more than 5 contributors, declared dependencies, and installability: 12K repositories remain. OpenCoder quality filtering retains 92K Python seeds. Each is provisioned in a container with its dependencies. §3
The pipeline uses tree-sitter, jedi GoToDeclaration, then tree-sitter boundary extraction. GoToImplementation could simplify this, but most language servers do not support it. §3, footnote 5
Training acquisition stops at depth 10 or 128K code tokens, whichever comes first. Contexts shallower than 5 levels or with hop success below 60% are discarded. §3
Four blocks, one shared implementation
Teaching example: S calls A then B; A and B both call C. Request two outward hops, with all references resolvable and prepend serialization. Seed depth is zero in this fixture.
- Provision the environment.Start with the seed in the frontier and visited set.
The installed environment makes external source available; S begins the collection.
- Locate calls and extract A and B.Resolve both seed call sites into implementations.
Syntax identifies call expressions, declaration resolution finds source, and another query finds implementation boundaries.
- Record the direct-dependency layer.Both direct dependencies enter the next frontier.
A and B are the same hop; neither has been visited.
- Expand A and B; deduplicate C.Two resolved references select one implementation.
Mark C visited immediately, so the second call does not add its source again.
- Serialize and check depth.Reverse hop layers, preserving order inside each layer.
The requested depth ends acquisition. This illustrates collection, not a retained training example.
The paper's corresponding rules are BFS, no repeated classes or functions, prepended hops, and the minimum-depth filter. §3
The full synthetic graph
S→[A,B]; A→C; B→C; C→D; D→E; E→F; F→[].
D, E, and F are additional external source blocks for the sandbox. All block lengths are supplied teaching values, not code tokenizations. Ordered call lists specify only a tie-break within a BFS layer.
Same seed; different information
Stop at the repository boundary
Same input: S in shop calls A and B in pack; both call C in codec. Difference: whether retrieval may cross the repository boundary to a resolved implementation.
Contains S but no A, B, or C. Package names alone still supply none of their implementations.
At two hops, collects S, A, B, C once each, then serializes .
Append discoveries in BFS order
Same input: the same collected layers and supplied block lengths. One difference: prepend versus append serialization.
Our inference: append leaves the dependencies after S; prepend makes them preceding history, without changing which blocks were collected. This is a causal-visibility argument, not a measured benchmark gain. Figure 2
Not a general topological ordering
Our inference: reversing BFS layers sorts first-discovery distances, not every dependency edge. Cycles or cross-layer backreferences can prevent all dependencies from appearing before all callers. §3
Reach five hops—and break resolution
It cannot collect D through F. A higher depth limit permits more expansion but supplies no missing source-resolution capability. A package name is not an extracted implementation; collection stops with C and remains below the minimum depth.
Goal: collect the shared implementation once, put it before its callers, and reach the minimum-depth gate—then find why a native boundary prevents that result.
Teaching simulator · acquisition only
- Raise depth to five with resolution working. What changes in length and the gate?
- Keep five hops but block C→D. Which blocks disappear?
- At two hops, switch prepend to append. Does length change?
Traversal trace
Invariant: each implementation appears at most once. Serialization changes neither membership nor length; prepend places deeper collected layers before shallower ones.
The native-boundary failure illustrates an author-stated limitation: within-language resolution can miss implementations across ABI/FFI boundaries. Cross-repository does not mean cross-language. Limitations
What the simulator leaves out
No parser, package installation, language server, tokenizer, training, attention, or benchmark model runs here. Ordered call lists stand in for extraction and resolution. All lengths are synthetic.
The tiny graph does not simulate the 128K stop, repository eligibility, quality filtering, cleaning, or decontamination. It reports only an illustrative depth gate—not full training-example acceptance.
Our inference: the text gives the 60% hop-success threshold but not enough aggregation detail to reproduce that metric faithfully. It also leaves exact implementation-level depth bookkeeping open. We count S at depth zero and outward hops thereafter. §3
Is the extra history useful, or merely attended to?
Attention asks where a scorer allocates weight. A full-versus-truncated-history likelihood comparison asks whether additional history makes a token more predictable. The paper uses simplified LongAttn and LongPPL as complementary corpus diagnostics, not new training losses. §3
Measurements use Phi3 and EXAONE 3.5; attention is from the first layer. For contexts longer than 128K, only the trailing 128K is scored. The probability test's truncated start is , fixed across the final span—not a sliding 2K window. §3
Formal version: attention regions
Average final-span attention mass into three overlapping recent-prefix regions, rather than partitioning all prefix attention into disjoint bins. §3, LongAttn formula
| Symbol | Meaning | In the worked fixture |
|---|---|---|
| Dependency mean (Dep. Mean). | Not computed. | |
| Paper's K-token scale; total scored context length. | No K-scale scored input. | |
| Query position among final 8K tokens. | No query scores. | |
| Earlier key position in selected region. | No key positions. | |
| First-layer attention from query to key, measured with the two scorers. | No attention model. | |
| Region index: 1, 2, or 3. | Symbolic brackets only. | |
| Half, quarter, or eighth of prefix length. | No measured region sizes. | |
| Region's first position. | Not assigned. | |
| Three times 8K query positions. | Not rescaled to block count. |
The acquisition fixture supplies abstract code blocks and synthetic lengths, not the additional scorer measurements this equation needs.
Formal version: context-sensitive key tokens
Count the fraction of final-span tokens whose log probability gains more than 2 with full history rather than fixed-start truncated history. Equality does not qualify. §3, LongPPL formula
| Symbol | Meaning | In the worked fixture |
|---|---|---|
| Key-token fraction; Table 1 uses percent. | Not computed. | |
| Final-span token position and scored token. | No scored tokens. | |
| Context token sequence. | Only blocks and synthetic lengths. | |
| Diagnostic model probability and parameters; two scorers described above. | No diagnostic model. | |
| Log probability in the gain comparison. | No measured probabilities. | |
| Full history, positions 1 through . | Symbolic schematic only. | |
| Starts at , ends at ; grows with position. | Not instantiated. | |
| 1 if gain strictly exceeds 2; 0 otherwise. | No gains supplied. | |
| Scale, total scored length, and evaluation-span length/denominator. | No K-scale input; not replaced by four blocks. |
From mined contexts to evaluated models
About 6.2B cross-repository code tokens contribute 12.05% of the LCFT mixture. The rest comes from conventional code, papers, mathematics, books, and other sources—not just OctoLong contexts. §4, Table 2
- LCFT: extend Qwen3 dense base models using mixed long and short training data.
- Merge: combine original-base and post-LCFT weights to help retain short-input performance.
- SFT: instruction-tune at the extended context length using broad response and interaction data.
The suite spans 0.6B, 1.7B, 4B, 8B, and 14B parameters. Appendix B lists 57993 OctoLong samples averaging approximately 107K tokens. Table 5; Appendix B.1
Exact training settings
Appendix A gives 51.5B LCFT tokens, 10.1B SFT tokens, and training sequence length 131,072 Tokens. It uses full fine-tuning and one epoch. Table 5
RoPE base frequency rises from 1M to 10M; context extends from 32K to 128K in a single LCFT stage. Original-base:post-LCFT merge ratio is 1:9, before SFT. Sequence parallelism and packing support long training; this is not an architectural sparse-attention change. §4
Cleaning and instruction formatting
Both mixtures use OpenLID English filtering at confidence 0.9, MinHash shingle size 20 with Jaccard threshold 0.7, and removal of samples with 13-gram overlap against a downstream evaluation instance. SFT calls are normalized to Hermes format, and intermediate thinking blocks are discarded. Appendix B
What the comparisons establish
The overall recipe comparison. The 8B backbone and common SFT recipe make this useful evidence, but the control replaces the entire LCFT mix. Other proportions change too, so it cannot uniquely attribute the difference to cross-repository code.
The study compares against 18 open-weight models supporting at least 64K. Its 8B −Cross-Repo Code control uses a size-matched, proportionally faithful ProLong replication in place of the entire LCFT mixture. All variants use the compiled SFT mixture. §4–5
1 · Corpus diagnostics, uncapped acquisition
Depth-10 OctoLong: median 201,477; 99th percentile 1,582,313; Dep. Mean 0.6283; Sink Prop. 1.2e-4; key tokens 7.09%.
In-repository code: 4,879; 207,681; 0.5334; 1.2e-3; 1.82%, respectively.
The mined data is longer and scores better on both diagnostic families. These are uncapped acquisition lengths, not the training-length distribution. Examples longer than 128K are scored only on their trailing 128K. Table 1
2 · Long-context code
OctoLong-8B-Instruct / mixture control
LooGLE V2 Code: 29.89 ± 0.14 / 26.38
LongCodeQA: 65.19 ± 0.44 / 62.17
RepoQA: 64.77 ± 0.22 / 61.58
The recipe comparison favors OctoLong on code retrieval and state tracking. Reported drops for the control: 3.51, 3.02, and 3.19 score points—not relative percentages. Table 3
3 · General-domain long context
OctoLong-8B-Instruct / mixture control
LongBench V2: 39.18 ± 0.16 / 37.02
MRCR: 40.87 ± 0.19 / 36.88
AA-LCR: 13.00 ± 1.63 / 11.00
Favorable comparisons are not confined to code. Not every external baseline is beaten: on AA-LCR, OctoLong-14B scores 21.00 ± 1.70 versus Qwen2.5-14B-Instruct-1M's 23.00 ± 0.48. Table 3
4 · Agentic tool use
OctoLong-8B-Instruct / mixture control
BFCL V3: 61.67 ± 0.54 / 57.74
-Bench: 27.35 ± 0.41 / 22.38
Final post-SFT models also improve on tool-use benchmarks; reported control drops are 3.93 and 4.97 points. This is not a claim of universal agent reliability. Table 4
5 · Short code: name the comparator
Pass@1, OctoLong-8B / no-LCFT same-SFT control
LiveCodeBench V6: 20.82 ± 0.31 / 20.49
BigCodeBench Hard: 19.44 ± 0.39 / 19.03
Short-code capability is largely retained against the same-SFT no-LCFT control. Against separately post-trained Qwen3-8B, BigCodeBench pass@1/25 is 19.44/49.23 versus 20.73/40.11. OctoLong trails at pass@1 but leads at pass@25; success with many candidates is not single-answer reliability. Tables 4, 9
6 · Length retention depends on the task
OctoLong-8B, 64K / 128K
LongCodeQA: 65.52 / 64.85
RepoQA: 67.87 / 61.67
Retention is closer on LongCodeQA; RepoQA still declines. Strong averages do not mean zero degradation at the context boundary, or performance beyond 128K. Table 6
Table 2 · Full mixture composition (%)
| Source | OctoLong-LCFT | ProLong |
|---|---|---|
| In-Repo & Code-Adjacent | 21.51 | 30.00 |
| Academic Papers & PDF | 18.55 | 4.00 |
| Math & Math-Adjacent | 12.22 | 4.00 |
| OctoLong | 12.05 | – |
| General Domain | 11.95 | 10.00 |
| Books | 9.52 | 30.00 |
| Agentic & Instruct-Like | 6.84 | 4.00 |
| Tech Content & Forum | 4.31 | 4.00 |
| Educational | 3.05 | 14.00 |
Evaluation protocol and sampling budgets
Scores average three independent inference runs: nucleus sampling , temperature 0.6, output budget 2K tokens. Subsets averaging more than 128K tokens are skipped. §5
Short-code pass@{1,5,10,25} uses a sampling group . Pass@1 concerns one candidate; pass@25 concerns a larger candidate budget. §5, RQ4
What these results do not show: million-token trained-model performance, a clean one-component causal effect, universal superiority over baselines, or preservation after a subsequent RL stage. The acquisition simulator predicts none of these benchmark scores.
Where the recipe stops being evidence
Author-stated limits
- Gains after subsequent RL post-training are not directly verified. Comparing against RL-trained baselines is not that experiment. Limitations
- Training omits low-resource-language data, stops at 14B parameters and 128K context, and collects Python-only cross-repository data. Portability to mature language-server/package-manager ecosystems is proposed, not a broad collection demonstrated here. §5; Limitations
- Within-language retrieval can miss dependencies across ABI/FFI boundaries. The authors point to polyglot static analysis and control-flow tracking as needed capabilities. Limitations
Our inferences and implementation uncertainty
Our inference: changing the entire LCFT mix leaves the cross-repository category's unique causal contribution unresolved. Table 2; §5
Our inference: two model-dependent scorers, first-layer attention, a fixed likelihood-gain threshold, and trailing-128K inspection cannot exhaustively verify semantic dependence. §3
Our inference: three inference runs measure decoding variation, not robustness across independent training seeds. Appendix A lists random seed 77. §5; Table 5
Our inference: exact hop-success aggregation and depth bookkeeping remain underspecified in the text. The sandbox uses its own declared conventions and does not report full corpus acceptance. §3
Our inference: reverse BFS layers are not a general topological sort; arbitrary cyclic or cross-linked graphs need not put every dependency before every caller. §3
Open questions
- Does swapping only the OctoLong category, holding other proportions and token budgets fixed, reproduce the gains?
- Do gains survive subsequent RL?
- What happens with larger models, contexts beyond 128K, and broader natural-language coverage?
- How much source is missed at native boundaries, and can polyglot analysis recover it?
- How sensitive are corpus rankings to scorer choice and the fixed probability-gain threshold?
- What exact implementation conventions define hop success and depth?
Explain it to a colleague
Answer each in your head before opening its reference answer.
Rebuild the mechanism
S calls A and B; each calls C. Give distinct layers, final prepend sequence, and synthetic length when each block has the fixture's supplied length.
Reference answer and why
BFS collects layers; the visited set suppresses shared source, and prepend reverses hop order.
The visited set suppresses the second C. Prepend reverses layers, not members within a layer; two outward hops do not reach the minimum-depth gate. §3 · teaching computation
Transfer to another language boundary
A TypeScript seed calls an installed package function, which calls a Rust native extension whose implementation the language server cannot locate. What can the acquisition pattern collect, and what is missing?
Reference answer and why
With a mature TypeScript resolver and package manager, it can collect the resolvable TypeScript implementation. It must not invent or claim the Rust implementation. Recovering that dependency requires cross-language analysis beyond within-language retrieval.
Cross-repository is not cross-language. Metadata helps only where resolution supports the reference; the authors identify ABI/FFI boundaries explicitly. §5; Limitations
Police the evidence claim
“Million-token samples and 65.19 versus 62.17 prove replacing only 12% of the corpus gives million-token code understanding.” Which two boundaries did this cross?
Reference answer and why
Million-token lengths come from uncapped acquisition, not the 128K-trained/evaluated models. The score comparison replaces the entire LCFT mixture, not only the 12.05% cross-repository component.
Corpus acquisition capacity, trained context capacity, and isolated causal attribution are different claims. §3–5, Tables 1–3
Compact glossary
- Cross-repository code context
- A seed serialized with recursively referenced class/function implementations beyond its repository. §2–3
- Seed
- A quality-filtered Python file that starts traversal. §3
- Language Server Protocol
- A JSON-RPC interface to source analyses; here, type- and scope-aware reference resolution uses package-manager conventions. §3
- GoToDeclaration
- The per-call-site request locating a declaration before AST boundary extraction. §3
- BFS hop
- A breadth-first expansion of references; implementations are not repeated and hops are prepended. §3
- LCFT
- Context-extension/long-context fine-tuning before instruction tuning. §4
- SFT
- Supervised fine-tuning, called instruction tuning here. §4
- Context-sensitive key token
- A final-span token with log-probability gain greater than 2 under full versus truncated history. §3
- Sink Prop.
- Mean attention mass fraction from final 8K tokens to leading positions 0–32. §3
- −Cross-Repo Code
- Control replacing the entire LCFT mix with a size-matched ProLong replication. §5