Skip to main content

Research Repository

Advanced Search

Code Gradients: Towards Automated Traceability of LLM-Generated Code

North, Marc; Atapour-Abarghouei, Amir; Bencomo, Nelly

Code Gradients: Towards Automated Traceability of LLM-Generated Code Thumbnail


Authors

Marc North marc.north@durham.ac.uk
PGR Student Doctor of Philosophy



Abstract

Large language models (LLMs) have recently seen huge growth in capability and usage. Within software engineering, LLMs are increasingly being used by developers to generate code. Code generated by an LLM can be seen essentially a continuous mapping from requirements to code. This represents a great opportunity within requirements engineering to use this mapping to provide traceability from requirements to LLM-generated code. The challenge is that the black-box nature of LLMs makes it difficult to trace requirements, while traditional approaches require extensive post-hoc testing or expert analysis. In this research preview, we explore the use of LLM explainability techniques to trace LLM-generated code back to requirements. By inspecting the gradients of LLM output, we develop a first attempt at tracing LLM inputs through to its generated code. We use this to estimate which low-level requirements have been met. Furthermore, through an automated iterative process, we re-query the LLM, instructing it to rewrite its code to meet the missing requirements. Our results suggest that the gradients of LLM outputs can be used to trace requirements through LLM code generation and that this traceability could potentially be used to improve generated code to better meet requirements. Future work is required to fully validate this result, but this represents a first step towards automatic traceability and verification of AI generated code.

Citation

North, M., Atapour-Abarghouei, A., & Bencomo, N. (2024, June). Code Gradients: Towards Automated Traceability of LLM-Generated Code. Presented at 2024 IEEE 32nd International Requirements Engineering Conference (RE), Reykjavik, Iceland

Presentation Conference Type Conference Paper (published)
Conference Name 2024 IEEE 32nd International Requirements Engineering Conference (RE)
Start Date Jun 24, 2024
End Date Jun 28, 2024
Acceptance Date Mar 22, 2024
Online Publication Date Aug 21, 2024
Publication Date Aug 21, 2024
Deposit Date May 7, 2024
Publicly Available Date Aug 21, 2024
Publisher Institute of Electrical and Electronics Engineers
Peer Reviewed Peer Reviewed
Pages 321-329
Series ISSN 1090-705X
Book Title 2024 IEEE 32nd International Requirements Engineering Conference (RE)
ISBN 9798350395129
DOI https://doi.org/10.1109/RE59067.2024.00038
Keywords Index Terms-Requirements Engineering; Large Language Models; Traceability
Public URL https://durham-repository.worktribe.com/output/2433851

Files





You might also like



Downloadable Citations