Leveraging Large Language Models to Improve Static Analysis Output in Embedded Software Development
No Thumbnail Available
URL
Journal Title
Journal ISSN
Volume Title
Perustieteiden korkeakoulu |
Master's thesis
Authors
Date
2024-06-17
Department
Major/Subject
Computer Science
Mcode
SCI3042
Degree programme
Master’s Programme in Computer, Communication and Information Sciences
Language
en
Pages
54+4
Series
Abstract
Static analysis is used in embedded software development to identify possible bugs and errors in the program code, and to correct them early in the development process. However, interpreting the results from existing static analysis tools, such as Cppcheck, requires manual work and may be error-prone or inefficient in cases where the number of results is large. This thesis researches the possibility of using Large Language Models (LLMs) to improve the result interpretation and reporting of Cppcheck static analysis. Recently, Large Language Models (LLMs) have become popular across many fields due to their ability to perform a wide range of text-processing tasks. In addition to natural language processing, anecdotal evidence suggests that LLMs have good capabilities in understanding and processing program code. The objective of this thesis is to develop a tool that interprets static analysis results and the relevant program code using LLMs. The proposed tool integrates the Cppcheck static analysis tool with an LLM to analyze, interpret and suggest fixes for the detected code errors. Comparative analysis of the tool was conducted, comparing it to the conventional use of Cppcheck and an experimental method of analyzing source code purely with an LLM. The findings suggest that the advanced LLMs can accurately analyze the errors and their surrounding code, and in many cases, produce applicable fixes for the code, which saves time and helps with the manual work associated with static analysis tools. Furthermore, the experimental findings suggest that using LLMs for static analysis, instead of the traditional tools, is effective and may in some cases outperform the traditional methods. Future research could focus on exploring the potential of LLM-only solutions for static analysis of the code, possibly used in parallel with the existing tools.Ohjelmakoodin staattista analyysia hyödynnetään sulautetussa ohjelmistokehityksessä bugien ja ohjelmointivirheiden löytämiseksi ja korjaamiseksi. Staattista analyysia suorittavien työkalujen, kuten Cppcheckin, käyttö ja sen tulosten tulkinta kuitenkin vaatii manuaalista työtä, ja voi olla aikaavievää ja virheille altista etenkin silloin, kun tulosten määrä on suuri. Tämän diplomityö tutkii suurten kielimallien hyödyntämistä staattisen analyysin tulosten tulkinnan ja raportoinnin parantamisessa. Suurten kielimallien kyky suoriutua tekstimuotoisista tehtävistä on johtanut niiden yleistyvään käyttöön monilla eri aloilla. Luonnollisen kielen prosessointikyvyn lisäksi kokeilu- ja kokemusperäinen tieto viittaa siihen, että kielimallit kykenevät prosessoimaan myös ohjelmakoodia melko hyvin. Tämän työn tavoitteena on kehittää työkalu, joka tulkitsee staattisen analyysin tuloksia sekä niihin liittyvää ohjelmakoodia suurten kielimallien avulla. Kehitetty työkalu yhdistää Cppcheck-työkalun ja kielimallin siten, että tulokset tulkitaan, analysoidaan ja niihin tehdään korjausehdotuksia kielimallin avulla. Työn osana suoritettiin vertaileva analyysi, jossa kehitettyä työkalua verrattiin Cppcheckin tavanomaiseen käyttötapaan, sekä myös kokeiluluontoiseen menetelmään, jossa kielimallia yksinään käytetään staattisen analyysin työkaluna. Tulosten perusteella edistyneet kielimallit kykenevät tarkasti analysoimaan staattisen analyysin tuloksia, ja joissain tapauksissa myös ehdottamaan koodiin toimivia korjauksia, jotka säästävät manuaalisen työn vaatimaa aikaa. Lisäksi kokeellinen vertailu viittasi siihen, että pelkän kielimallin käyttö perinteisten työkalujen sijaan on toimiva menetelmä staattiseen analyysiin, ja voi joissain tapauksissa olla jopa tehokkaampi kuin perinteiset työkalut. Jatkossa suurten kielimallien käyttöä staattisessa analyysissä sellaisenaan voitaisiin tutkia, mahdollisesti yhdistettynä perinteisiin työkaluihin.Description
Supervisor
Kiviharju, MikkoThesis advisor
Salminen, JuhoKeywords
static analysis, large language model, llm, embedded systems