Bachelor thesis
Cite …

Exploring the Traceability of Requirements and Source Code via LLMs

Abstract

Efficient work with code relies heavily on requirement-to-code traceability. With the emergence of more advanced LLMs, there is potential to identify these trace links using LLMs instead of specialized software or human intervention. This could save time and costs while also enabling use by less experienced users.

This thesis focuses on the development of an approach that prepares the input and uses RAG and LLMs to identify trace links and assess its scientific validity. The core idea is to leverage LLMs for this purpose, supported by a Prototype that enables communication with the models and the needed preparation.

First, the fundamentals and related work are explored to establish suitable evaluation metrics and a comparative data basis. This is followed by a preliminary study in which the parameters of the Prototype are iteratively refined using two self-created datasets, and the Prototype is implemented in parallel.

After the Prototype's results are deemed satisfactory based on the metrics of Precision, Recall, and F1-score, the two datasets from the preliminary study and two additional datasets identified from related work are used with the same parameters to collect data for evaluation. The results are analyzed, and hypotheses are formulated, revealing that finding trace links at the file level using LLMs works relatively well. Subsequently, a necessary sample is used to evaluate the metrics for finding trace links at the function level through LLMs, where potential for this application is identified.

It is found that LLMs face similar limitations to humans when finding trace links in given code; however, they can offer advantages if the identified prerequisites are met, as they might be faster than humans while also being able to generate appropriate documentation. Ultimately, the approach pursued in this thesis proves very promising, as the results, compared to those from the related work chosen as a benchmark, yield comparable outcomes for finding trace links at the file level and additionally provide valid indications of the possibility of finding trace links at the function level using LLMs.

Finally, optimization potentials of the chosen approach are developed based on related work and the actual evaluation results.