Manuscript Offprint

arXiv:2611.09162

Rethinking Requirement-to-Code Traceability Through Single-Agent and Multi-Agent Approaches

Sarthak Banerjee, Sallam Abualhaija, Domenico Bianculli, Lionel Briand

Sarthak Banerjee®, Sallam Abualhaija®, Member, IEEE, Domenico Bianculli®, Member, IEEE, and Lionel Briand®, Fellow, IEEE

Abstract—Requirements-to-code traceability supports essential software engineering activities, including change impact analysis, maintenance, and regulatory compliance. Existing approaches typically rely on a retrieval-and-classification pipeline, which suffers from an inherent retrieval bottleneck: relevant source files that are not retrieved cannot be recovered during subsequent analysis. In this paper, we revisit requirements-to-code traceability in light of the substantially larger context windows offered by modern large language models, which make repository-scale analysis feasible without a separate retrieval step. We propose three approaches: a single-agent approach that analyzes the entire code repository in one pass, and two multi-agent approaches based on self-verification and multi-agent debate. Our evaluation shows that the single-agent approach substantially improves recall, achieving 80.9%, a gain of 38.6pp over the state-of-the-art retrieval-based baseline, albeit with a 25.8pp reduction in precision. By leveraging collaborative reasoning, the multi-agent debate-based approach achieves the best overall precision-recall balance, with 24.5% precision and 71.0% recall, yielding an F2 score of 49.5%. This represents an improvement of 7.5pp over the state of the art and 2.7pp over the single-agent approach. In addition, qualitative analysis provides key insights into highly variable quantitative results: the retrieval approach suits requirements that echo the code's vocabulary; single-agent, full-context reasoning suits well-documented, consistently named code; and multi-agent debate suits indirect, conflicting, or distributed evidence.

Index Terms—Traceability, Requirements, Code, Multi-agents, Large Language Models (LLMs).

I. INTRODUCTION

Establishing trace links between software requirements and source code has long been a persistent challenge in software engineering (SE) [1]. This challenge becomes even more critical as modern software development increasingly relies on artificial intelligence (AI) coding agents¹. Today's coding agents can generate entire software projects directly from natural-language (NL) requirements [2]. While these technologies offer substantial productivity benefits, they also introduce new traceability challenges.

AI-generated code typically lacks explicit trace links that connect the requirements or prompts to their corresponding implementation within the codebase. The literature has highlighted this gap and emphasized the need for tools to reconstruct these links [3], [4]. Furthermore, prior work suggests that AI coding agents cannot yet be relied upon to provide accurate traceability information. For instance, tracing issues to commits through pull requests may be unreliable, because pull request descriptions, often the primary communication channel between AI agents and human developers, do not always accurately reflect the implemented changes [5]. Together, these findings suggest that, although AI-assisted software development can accelerate implementation, it may further weaken the availability and reliability of software traceability information.

Creating and maintaining trace links manually is both time-intensive and error-prone, particularly as systems evolve. Whenever code is added, modified, or refactored, the corresponding trace links must also be updated. In practice, however, these updates are often postponed or omitted altogether. As a result, traceability information in industrial projects is frequently missing, incomplete, or outdated [6]. Recovering these links after development is equally demanding, as it requires examining each requirement against potentially thousands of code artifacts, a task that becomes increasingly costly as repository size grows.

Automated trace link recovery (TLR) is therefore essential, yet remains difficult for several reasons. First, a substantial semantic gap exists between NL requirements and source code, as implementation details are often expressed using terminology that significantly differs from that of the requirement. Second, requirements are frequently scattered across multiple files, meaning that no single file fully captures their implementation. Third, the search space is typically highly imbalanced. In existing requirement-to-code traceability benchmarks [7], [8], true trace links often represent only 1% to 5% of all possible requirement-code pairs, while the total number of candidate links ranges from roughly 6700 to 29600 (see Table I on page 6). An effective TLR approach must therefore identify a small number of correct links among thousands of plausible but incorrect candidates.

Recent advances in Large Language Models (LLMs) have led to promising progress in automated TLR. Most existing approaches follow a retrieval-and-classification pipeline that combines Retrieval-Augmented Generation (RAG) [9], [10] with LLM-based pairwise trace link prediction [11]. Given a requirement, these approaches first retrieve the top-kk semantically similar code files and then ask the LLM to determine whether a trace link exists for each requirement-file pair.

While this pipeline effectively reduces the search space, it has two important limitations. First, it introduces a retrieval bottleneck: any relevant file that is not included among the top-kk candidates is excluded from further consideration. This

¹The 2026 Stack Overflow survey of 30,000 developers across 169 countries reports that about 66% of developers use AI coding assistants or agents for software implementation, of whom 73% indicate daily use—Stack Overflow, 2026 Developer Survey, October 2026

Figure

Fig. 1: Motivating example: trace links from eTour.

limitation is particularly problematic given the semantic gap between requirements and source code, which can prevent relevant files from being ranked highly in the first place. Second, evaluating code files independently limits the ability to capture cross-file traceability, where a requirement is implemented collectively across multiple interacting files. Consequently, some trace links may be missed even when the relevant files are successfully retrieved.

To illustrate these challenges, consider the use case UC53 from eTour, a widely used requirements-to-code traceability benchmark [7], illustrated in Fig. 1. This use case describes how a tourist submits feedback for a visited site. The system checks that no feedback was issued before, validates the input, stores the feedback, and adds the site to the tourist's list of visited sites. In the benchmark, UC53 is traced to six Java code files: IDBVisitBC, DBVisitPR, IDBVisitPR, CulturalHeritageVisitChecker, ControlData, and SiteTableModel. Existing retrieval-and-classification approaches can identify only two of the six files: IDBVisitBC and DBVisitPR (marked as found in the figure), both of which contain vocabulary close to the use case. The remaining four files (marked as missed in the figure) are likely missed because the large terminology gap leads to very low textual similarity. Moreover, existing approaches assess each file against the use case in isolation and therefore cannot recover these four files through their code dependencies on the two found ones.

Recent work has attempted to mitigate these issues through multi-agent architectures that combine RAG with self-verification [12]. However, because self-verification operates on top of the same retrieval pipeline, it inherits the retrieval bottleneck: relevant files filtered out early cannot be recovered. Moreover, self-verification typically reassesses predicted links rather than revising them, allowing upstream errors to propagate to the final output. Finally, although these approaches employ multiple agents, they make limited use of capabilities commonly associated with effective multi-agent systems—such as collaboration, memory, and coordinated reasoning [13].

In this paper, we rethink requirements-to-code traceability by asking two questions: (1) Can repository-level reasoning recover trace links missed by retrieval-based and pairwise approaches? (2) Is a single reasoning pass sufficient? To answer the first question, we investigate whether giving an LLM access to the entire codebase improves trace recovery,

particularly for cross-file trace links. To answer the second, we examine the role of collaborative reasoning in traceability analysis. Unlike prior self-verification approaches, which primarily reassess predictions, we introduce a multi-agent approach in which agents iteratively critique, refine, and revise candidate trace links.

Contributions. This paper makes the following contributions: (1) We propose three LLM-based approaches: (i) TRACER, a single-agent approach that provides an LLM with the entire code repository (rather than a limited set of retrieved candidates), enabling repository-level reasoning across multiple interacting files to identify cross-file trace links; (ii) COR-RECTOR and (iii) DEBATER, two multi-agent approaches that build on established self-correction and multi-agent debate frameworks [14], [15]. We further evaluate two prompting strategies: a conservative prompt (P1\mathcal{P}_1), which instructs the model to return only highly confident trace links, and a comprehensive prompt (P2\mathcal{P}_2), which encourages the model to identify all plausible trace links supported by the available evidence, including links that require combining information across multiple artifacts.

(2) We conduct a comprehensive empirical evaluation on three benchmark datasets, namely eTour, iTrust, and Dronology. Our results show that TRACER with P2\mathcal{P}_2 achieves the highest average recall of 80.9% with an average precision of 17.8%, and F2 of 46.3%. Compared to the RAG-based approach (P = 43.6%, R = 42.3%, F2 = 41.5%), TRACER improves recall by 38.6 and F2 by 4.8 percentage points (pp), at the cost of a 25.8 pp drop in precision. Among the multi-agent approaches, DEBATER with P2\mathcal{P}_2 achieves an average precision of 24.5%, recall of 71.0%, and F2 of 49.5%. Compared to the single agent TRACER, DEBATER reduces the number of predicted links that an analyst must validate (i.e., confirm or reject) by about 30% on eTour and iTrust, losing 3.9 pp and 6.3 pp in recall, respectively. On Dronology, it halves the validation effort, but recall drops by 19.3 pp. On all three datasets, DEBATER also achieves higher precision (24.5% vs. 17.8%), i.e., fewer of the links the analyst validates are false positives. DEBATER therefore offers the best trade-off between the human validation effort and the coverage of true links.

(3) As the quantitative analysis of our experimental results offered limited insights and revealed significant variability across approaches, we complement it with a qualitative analysis of all requirements and use cases that have ground-truth links across all datasets. Specifically, we manually inspected 57 use cases in eTour, 105 use cases in iTrust, and 57 requirements in Dronology, together with their associated code files. Our analysis shows that TRACER excels when trace evidence is explicit, whereas DEBATER is particularly effective at recovering trace links supported by indirect, conflicting, or distributed implementation evidence. A RAG-based approach only works best when requirements echo the code's vocabulary. Our findings help practitioners select the most appropriate traceability approach based on the characteristics of their artifacts.

Structure. Section II presents the necessary background. Section III introduces our approaches. Section IV reports on our empirical evaluation, and Section V presents the qualitative analysis. Section VI discusses related work, and Section VII concludes the paper.

References (61)