From Trace to Line: LLM Agent for Real-World OSS Vulnerability Localization

Haoran Xi, Minghao Shao, Brendan Dolan-Gavitt, Muhammad Shafique, Ramesh Karri · DOI

Abstract

Vulnerability localization in real-world open-source software (OSS) is hindered by the complexity of large codebases and the disconnect between runtime failure symptoms and their root causes. We present T2L (Trace-to-Line), a hierarchical agentic framework designed to pinpoint exact vulnerable lines by integrating dynamic runtime evidence. T2L utilizes an Agentic Trace Analyzer (ATA) to process crash logs and sanitizer outputs, guiding a two-tier Planner-Executor architecture. Our evaluation on the new T2L-ARVO benchmark shows that T2L-Agent, powered by GPT-5, achieves a 54.8% line-level localization rate, highlighting the necessity of runtime context and parallel reasoning in automated debugging.

Introduction

The "research-practice gap" in Large Language Model (LLM) based security analysis stems from a focus on coarse-grained detection (file or function level) and a lack of integration with dynamic debugging tools. Real-world developers rely on stack traces and sanitizer reports to navigate multi-file repositories. T2L addresses this by reframing vulnerability localization as a trace-guided, hierarchical search problem, moving from broad code "neighborhoods" to specific, actionable lines.

Methodology

The T2L-Agent architecture is built on four pillars:

  1. Agentic Trace Analyzer (ATA): Bridges the gap between execution and analysis by running code in reproducible Docker containers and generating a "Unified Evidence Block" from tools like AddressSanitizer (ASAN).
  2. Two-Tier Localization: A Planner Agent identifies candidate regions based on the evidence block, while an Executor Agent performs iterative refinement to isolate the specific buggy lines.
  3. Divergence Tracing: Instead of a linear chain of thought, the agent explores multiple reasoning branches simultaneously. This prevents the system from being derailed by a single incorrect hypothesis.
  4. AST-based Chunking: Code is partitioned into semantically meaningful, function-aligned chunks using tree-sitter, ensuring the LLM maintains structural context within its window limits.

Experimental Setup

We introduced T2L-ARVO, a benchmark of 50 expert-verified vulnerabilities derived from the ARVO dataset. These cases cover five major crash categories, including Buffer Overflows, Uninitialized Access, and Memory Lifecycle Errors. Unlike synthetic benchmarks, T2L-ARVO requires reasoning across complex, multi-file dependencies in real-world OSS projects.

Results and Discussion

Our experiments yielded several key insights into the behavior of agentic localization systems:

  • The Criticality of Runtime Evidence: Ablation studies demonstrated that without ATA-provided traces, even state-of-the-art models like GPT-5 failed to locate vulnerabilities, with performance dropping to near 0%. This confirms that static analysis alone is insufficient for complex OSS bugs.
  • Algorithmic Gains from Divergence: Divergence Tracing provided significant accuracy boosts. By exploring parallel hypotheses, the agent could recover from initial misinterpretations, which is crucial for memory corruption bugs where the root cause is often distant from the crash site.
  • Thinking Budgets and Decision Drag: Surprisingly, increasing the "thinking budget" (compute tokens) did not always yield better results. "Medium" budgets often outperformed "High" budgets, suggesting that excessive analysis can lead to "decision drag" and an accumulation of minor tool-use errors that derail the final localization.
  • Model Performance: GPT-5 led with a 54.8% line-level localization rate and a 58.0% detection rate. Interestingly, while GPT-5 was superior at pinpointing lines, GPT-4.1 showed high competency in initial coarse-grained detection.

Conclusion

T2L-Agent demonstrates that combining hierarchical reasoning with dynamic runtime context is essential for practical vulnerability localization. By bridging the gap between coarse bug detection and precise line-level guidance, T2L offers a path toward more effective automated debugging. Future research will explore cost-optimization strategies, such as model cascading, to make these agentic workflows viable for large-scale OSS maintenance.

Summary updated

BibTeX
@misc{xi2025from,
  author = {Haoran Xi and Minghao Shao and Brendan Dolan-Gavitt and Muhammad Shafique and Ramesh Karri},
  title = {{From Trace to Line: LLM Agent for Real-World OSS Vulnerability Localization}},
  year = {2025},
  eprint = {2510.02389},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.02389},
}
Figure