NINJA: A Navigator-Inspector Joint Architecture for Context-Efficient Issue Localization

Wenkai Fang, Shunyu Liu, Wei Luo, Zihao Wu, Yang Zhou, Tongya Zheng, Wotao Yin, Jialie Shen, Leszek Rutkowski, Mingli Song, Dacheng TaoarXiv 2026 · arXiv

Finding a needle in a haystack is hard. Finding a bug in a million-line repository is harder. While Large Language Model (LLM) agents have shown great promise in software engineering, they often stumble over a fundamental hurdle: context accumulation.

In a new paper titled "NINJA: A Navigator-Inspector Joint Architecture for Context-Efficient Issue Localization," researchers from Zhejiang University, Alibaba, and other institutions introduce a hierarchical approach that allows LLMs to hunt for bugs with surgical precision.

TL;DR

NINJA is a hierarchical multi-agent framework that splits bug hunting into global "navigation" and local "inspection." By isolating local code analysis into independent, fresh contexts, NINJA prevents the "context bloat" that confuses single-agent systems, allowing fine-tuned open-source models to outperform heavyweights like Claude-Haiku-4.5.

What Problem Does This Paper Address?

Issue localization—identifying exactly which files and functions need to be changed to fix a bug—is the critical first step in automated program repair.

Most current agents use a "flat" exploration strategy: a single agent wanders through a repository, reading files and searching code. Every action and observation is appended to its memory (context). As the search goes on, this context grows massive. This leads to two problems:

  1. Reasoning Compression: Long contexts "squish" the model's effective reasoning space, making it harder to make smart decisions in the later stages of a task.
  2. The Breadth-Depth Dilemma: A single agent struggles to balance a broad search across the whole repository (breadth) with deep, multi-hop tracing of function calls (depth).

Methods

The authors propose a "divide and conquer" architecture inspired by—you guessed it—ninjas. The framework consists of two specialized roles:

  • The Navigator (Global Coordinator): This agent maintains the "big picture." It searches the repository at a high level to identify promising files. It manages a global state (pending files, explored files, and confirmed suspicious locations) and dispatches tasks to the inspectors.
  • The Inspector (Local Specialist): When the Navigator finds a suspicious file, it sends an Inspector in. Crucially, each Inspector starts with a fresh, independent context. It doesn't inherit the Navigator's long history. It focuses purely on tracing callers and callees within its assigned region to find the root cause.
Figure 1: Overview of the NINJA framework and agentic fine-tuning pipeline. (1) NINJA decomposes repository exploration into global navigation and local inspection, where the navigator searches and dispatches issue-relevant files to inspectors, updates the global state from their returned findings, and iteratively continues exploration or finalizes the results. (2) The fine-tuning pipeline combines SFT warmup with component-wise RL, training the inspector before the navigator.

To make this system work, the team used a two-stage agentic fine-tuning strategy. They first used Supervised Fine-Tuning (SFT) to teach the models the basic "rules of the game" (tool use and formatting). Then, they applied Reinforcement Learning (PPO) sequentially—first training the Inspector to be a better local hunter, then training the Navigator to be a better coordinator.

Datasets

The models were trained using SWE-smith-py, a dataset designed for software engineering agents. For evaluation, the researchers used two major benchmarks:

  • SWE-Bench-Lite: A subset of real-world GitHub issues from popular Python repositories.
  • LocBench: A dedicated benchmark for repository-level issue localization.

To ensure scientific integrity, they performed repository-level filtering to prevent "data leakage," ensuring the models weren't tested on code they had already seen during training.

Key Insights and Ideas

  • Context Isolation is a Superpower: The "aha moment" here is that forgetting can be as important as remembering. By resetting the context for Inspectors, NINJA ensures that the model always has maximum "brainpower" available for deep code reasoning.
  • Hierarchy Beats Flatness: The ablation studies (see Figure 2/Table 2 below) show that removing the independent context causes performance to crater. The division of labor isn't just an organizational choice; it's a technical necessity for long-horizon tasks.
  • RL for Strategy, not just Syntax: While SFT helps with formatting, the RL phase was crucial for teaching the Navigator when to stop searching and when to dig deeper.
Table 2: Ablation study of our NINJA framework on SWE-Bench-Lite.

Key Results

NINJA sets a new bar for open-source software agents.

  • Beating the Giants: After fine-tuning, the Qwen3-Coder-30B model using the NINJA architecture (NINJA-30B) achieved a function-level Acc@5 of 77.3% on SWE-Bench-Lite, surpassing the closed-source Claude-Haiku-4.5 (76.3%).
  • Efficiency: Despite being a multi-agent system, NINJA remains computationally competitive. While it uses more tokens than some lightweight baselines, its "resolve rate" in downstream tasks is significantly higher, proving that the extra effort pays off.
Table 1: Results on SWE-Bench-Lite. Best and second-best localization results are in bold and underlined, respectively. CodeRank, Haiku-4.5, and Qwen3-30B denote CodeRankEmbed, Claude- Haiku-4.5, and Qwen3-Coder-30B-A3B-Instruct. NINJA-14B and NINJA-30B are obtained by applying agentic fine-tuning (SFT+PPO) to Qwen3-14B and Qwen3-30B, respectively.

Limitations and Future Work

While NINJA is powerful, the authors note a few areas for growth:

  • Language Support: The current evaluation focused on Python. While the architecture is language-agnostic, it requires language-specific tools (like parsers) to work on C++ or Java.
  • Overhead: Hierarchical search is slower and more token-intensive than a simple retrieval-based search. It’s a "high-effort" mode for when accuracy is the priority.
  • Support Locations: The paper highlights that current benchmarks mostly look for "edit locations" (where the fix goes). However, understanding "support locations" (code that explains the bug but doesn't change) is vital for real-world engineering. Future work will likely focus on identifying these contextual hints more effectively.

For those interested in the implementation, the code is available on GitHub.

Summary updated

Abstract

Recent advances in agent-based methods have demonstrated strong promise for issue localization, a critical prerequisite for software issue resolution. However, most existing agent-based methods rely on a single agent with a growing context, where long-context accumulation compresses the effective reasoning space. Meanwhile, the flat exploration structure hinders the balance between file-level breadth and function-level depth. To address these limitations, we propose NINJA, a hierarchical Navigator-Inspector Joint Architecture for context-efficient issue localization. NINJA decomposes repository exploration into global navigation and local inspection: the navigator maintains the global search state, performs file-level search, and dispatches selected entry files, while inspectors independently conduct function-level exploration around the assigned files in separate contexts. Through multi-round interactions, inspectors return suspicious locations as feedback, and the navigator updates the global state to decide whether to continue exploration or finalize localization. This hierarchical design balances file-level breadth with function-level depth, while independent inspector contexts prevent local exploration traces from accumulating in a single growing context. To further strengthen both global coordination and local exploration, we introduce a two-stage agentic fine-tuning strategy. Extensive experiments across multiple benchmarks and LLM backbones show that NINJA consistently outperforms competitive baselines. Notably, after fine-tuning, Qwen3-Coder-30B-A3B-Instruct surpasses the strong closed-source Claude-Haiku-4.5 model. Our code is available at https://github.com/wantbook-book/NINJA.
BibTeX
@misc{fang2026ninja,
  author = {Wenkai Fang and Shunyu Liu and Wei Luo and Zihao Wu and Yang Zhou and Tongya Zheng and Wotao Yin and Jialie Shen and Leszek Rutkowski and Mingli Song and Dacheng Tao},
  title = {{NINJA: A Navigator-Inspector Joint Architecture for Context-Efficient Issue Localization}},
  year = {2026},
  eprint = {2611.10027},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.10027},
}
Figure