Abstract
Software Traceability (ST) is essential for maintaining consistency between natural language (NL) requirements and programming language (PL) artifacts. However, traditional textual similarity methods often fail to bridge the "semantic gap" inherent in NL-PL links. This paper presents a comprehensive study on the limitations of keyword matching and proposes the use of auxiliary strategies—such as code dependencies and user feedback—integrated into advanced architectures like Heterogeneous Graph Transformers (HGT) and Large Language Models (LLMs). Our results show significant performance gains, with LLM-based approaches achieving up to an 8.84% improvement in F1-score over existing state-of-the-art methods.
Introduction: The Semantic Gap in Software Traceability
Connecting written requirements to the code that implements them is a notoriously difficult "needle-in-a-haystack" problem. While textual similarity (e.g., Cosine or Jaccard similarity) has been the mainstream method for recovering these links, it performs poorly when mapping English descriptions to technical source code. For instance, a requirement might discuss "user authentication," while the corresponding Java code uses variable names like auth_provider_impl and complex API calls. This discrepancy creates a semantic gap that simple keyword matching cannot bridge.
Methodology
The research followed a multi-stage process: a Systematic Literature Review (SLR), an experimental study to quantify the limitations of text similarity, and a case study evaluating new model architectures.
Systematic Literature Review (SLR)
The authors conducted an SLR of 50 papers and 99 projects to establish the current state of the field. This process involved defining search domains across major databases (ACM, IEEE, etc.), formulating specific search terms, and applying rigorous inclusion/exclusion criteria and quality assessments to filter journals and conferences by JCR and CORE rankings.
Experimental Study and the "Difference Ratio"
To quantify why text similarity fails, the authors introduced the Difference Ratio. This metric measures the gap between the similarity of "true" links versus "false" links. They found that while text similarity is effective for homogeneous links (NL-NL or PL-PL), it is nearly indistinguishable for heterogeneous NL-PL links, necessitating auxiliary strategies to boost performance.
Proposed Solutions: HGT and LLMs
The paper evaluates two primary architectures enhanced with auxiliary strategies:
- HGT-All (Supervised): A Heterogeneous Graph Transformer that models requirements and code as nodes. It incorporates "edges" representing code dependencies (imports, method calls) and user feedback.
- Gemini-All (Unsupervised): Utilizing Gemini 2.5 Pro with a prompt-learning mechanism. The model is provided with "Additional Information" blocks containing structural context (e.g., calling relationships) to improve its logical reasoning.
Key Results and Insights
- Performance Gains: HGT-All and Gemini-All both outperformed the previous state-of-the-art (HGNNLink). Gemini-All showed a massive 8.84% improvement in F1-score, highlighting the power of LLMs in understanding code logic.
- Structural Context: Adding code dependency information (who calls whom) was identified as the most effective auxiliary strategy for improving recovery accuracy.
- Scale vs. Logic: HGT-All excels in large-scale industrial projects with dense structural data, whereas Gemini-All is superior for smaller projects where deep semantic understanding is paramount.
Conclusion
Recovering NL-PL traceability links requires moving beyond textual similarity. By integrating structural context and leveraging the reasoning capabilities of LLMs and graph-based models, researchers can significantly improve the accuracy of traceability tools. Future work will focus on expanding language support beyond Java and improving the explainability of recovered links.
Summary updated