arXiv(opens in a new tab)cs.SEAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.26602

The Thousand-Graph Hypothesis: A Testable Hypothesis of Task-Conditioned Relation Materialization in Repository-Level Code Reasoning

Fei Ding

ABSTRACT

Large software repositories far exceed the context size that language models can effectively process in one shot. Training repository knowledge into a model is expensive, quickly stale, and difficult to keep current; on-demand retrieval is flexible but can still miss dispersed dependencies; explicit external code graphs add recurring costs for relation extraction, graph synchronization, and consistency maintenance. We propose The Thousand-Graph Hypothesis and the Implicit Relation Materialization Hypothesis: repository systems may persist only entities, while relevant entities entering context allow self-attention to organize task-specific connections transiently. We argue the same repository can induce different latent task graphs across tasks. To fit entity sets within bounded context, we use a two-layer repository entity index separating global positioning from local entity detail. In a controlled end-to-end SWE-bench Verified setting with DeepSeek-V4-Flash, the base system, one-layer index, and two-layer index obtain 92.1%, 94.2%, and 95.6% success rates, respectively. The results indicate the two-layer setting improves success and that the full system can complete repository-level repair without pre-built entity relation edges. This is compatible with the hypothesis, but does not directly verify the latent graph realized inside the model. The reported deployment record (over half a year, more than 200 repositories, and several GitHub fixes) together with the currently auditable subset forms a practical long-term trace.

1 INTRODUCTION

Modern software repositories include many files, functions, interfaces, configurations, tests, data structures, and engineering constraints, often far beyond what a model can process in one context window. In addition, repositories are dynamic: commits, refactoring, migration, and requirement changes continuously reshape repository state. Repository-level code reasoning is therefore not only a one-step long-context problem, but also a question of how up-to-date repository knowledge reaches current reasoning.

Even with larger context windows, positional decay and evidence interference still reduce effective use of key signals (Liu et al., 2024a).

One route is to train repository knowledge into a model, but this is costly and becomes stale as code evolves. A second route retrieves local files on demand; this is flexible but can miss task-critical entities across files under limited steps. A third route is explicit repository graphs that externalize call, inheritance, usage, and dependency relations (Liu et al., 2025a; Ouyang et al., 2025; Chen et al., 2025). Explicit graphs are precise and queryable, but repository changes shift maintenance to graph updates and consistency work.

RepoCoder, Repoformer, and Agentless improve accessibility with iterative retrieval, selective retrieval, and structural localization (Zhang et al., 2023; Wu et al., 2024; Xia et al., 2025). They pri-

∗^{*}Corresponding author: dignfei@gmail.com

Figure

Figure 1: Task-conditioned attention interpretation of The Thousand-Graph Hypothesis. The shared entity base and different task contexts induce different relation structures; Φ\Phi aggregates cross-token, layer, and head interactions for each task.

marily improve where to read; the remaining question is whether task-relevant entities are enough once they are in context, or whether relations still need to be pre-built.

Maintaining explicit graphs also incurs lifecycle cost. RPG-Encoder provides incremental graph updates; in one cross-commit analysis it reports full rebuild of 14.7M tokens and 633k incremental tokens (Luo et al., 2026a). RIG and Codebase-Memory similarly address edge invalidation, re-linking, and consistency checks after repository changes (Cherny-Shahar & Yehudai, 2026; Vogel et al., 2026).

We propose a falsifiable counterpoint: repository systems may only need to persist entities, not pre-built entity edges. Once relevant entities are in context, self-attention can temporarily materialize task-specific relations. Different tasks on the same repository can therefore induce different latent task graphs, which we call The Thousand-Graph Hypothesis.

This hypothesis raises a scaling challenge: even entity-only indexing can exceed context if repositories are large. We address this by a two-layer entity index that separates global routing from local entity focus. The interface supports persistent entities and zero pre-built edges, while still assembling task-specific inputs.

Our contributions are:

• A new task framing of repository knowledge as a long-tail, evolving-state problem.

• A new mechanism hypothesis: task-conditioned relation materialization without persistent external relations.

• A scalable two-layer repository entity interface that separates global and local entity access.

• Controlled end-to-end evidence on one model and one public benchmark.

• A practical long-term deployment note separating full reported usage from the currently auditable subset.

References (20)