A Comparison of LLM Performance in Detecting Specific Classes of Vulnerabilities in the C Language

Thesis title: Srovnání efektivity LLM při detekci specifických tříd zranitelností v jazyce C
Author: Sozonov, Semen
Thesis type: Bakalářská práce
Supervisor: Novák, Richard Antonín
Opponents: Korčák, Jiří
Thesis language: Česky
Abstract:
Tato bakalářská práce experimentálně srovnává efektivitu vybraných velkých jazykových mo- delů při detekci specifických tříd bezpečnostních zranitelností ve zdrojovém kódu jazyka C. Jsou porovnávány dva přístupy: fine-tuning specializovaného encoder modelu CodeBERT a využití dekodérového modelu Llama 3 pomocí Few-Shot Chain-of-Thought promptingu bez nutnosti přetrénování. Oba přístupy jsou aplikovány na detekci zranitelností CWE-119 a CWE-476 z datasetu MSR BigVul, který po předzpracování obsahuje 23 543 vzorků kódu. Výsledky ukazují, že fine-tuned CodeBERT pro kategorii CWE-119 dosáhl Recallu 83,5 %, Precision 91,5 % a MCC 0,87, čímž se řadí po bok nejlepších publikovaných přístupů na tomto datasetu. Pro CWE-476 s výrazně menší trénovací sadou model dosáhl Recallu 50,0 % a MCC 0,64, přičemž výsledky dokumentují dopad nevyváženosti tříd na trénování v pod- mínkách omezeného počtu pozitivních vzorků. Model Llama 3 bez fine-tuningu dosáhl v obou kategoriích kriticky nízkého Recallu, a proto není vhodný pro produkční bezpečnostní ana- lýzu. Práce diskutuje silné a slabé stránky obou přístupů a jejich využitelnost v praxi.
Keywords: detekce zranitelností; kybernetická bezpečnost; CWE-119; CWE-476; CodeBERT; Llama 3; velké jazykové modely; fine-tuning; Few-Shot prompting; jazyk C
Thesis title: A Comparison of LLM Performance in Detecting Specific Classes of Vulnerabilities in the C Language
Author: Sozonov, Semen
Thesis type: Bachelor thesis
Supervisor: Novák, Richard Antonín
Opponents: Korčák, Jiří
Thesis language: Česky
Abstract:
This bachelor’s thesis experimentally compares the effectiveness of selected large language mo- dels in detecting specific classes of security vulnerabilities in C source code. Two approaches are compared: fine-tuning of the encoder-only model CodeBERT and using the decoder-only model Llama 3 via Few-Shot Chain-of-Thought prompting without any retraining. Both ap- proaches are applied to the detection of CWE-119 and CWE-476 vulnerabilities from the MSR BigVul dataset, which contains 23,543 code samples after preprocessing. Results show that fine-tuned CodeBERT for CWE-119 achieves Recall of 83.5%, Precision of 91.5%, and MCC of 0.87, placing it on par with the best published approaches on this dataset. For CWE-476, which has a substantially smaller training set, the model achieved Recall of 50.0% and MCC of 0.64, illustrating the impact of class imbalance under limited positive sample conditions. Llama 3 without fine-tuning achieved critically low Recall in both categories and is therefore unsuitable for production security analysis. The thesis discusses the strengths and weaknesses of both approaches and their practical applicability.
Keywords: cybersecurity; CWE-119; CWE-476; CodeBERT; Llama 3; large language models; fine-tuning; Few-Shot prompting; vulnerability detection; C language

Information about study

Study programme: Aplikovaná informatika
Type of study programme: Bakalářský studijní program
Assigned degree: Bc.
Institutions assigning academic degree: Vysoká škola ekonomická v Praze
Faculty: Faculty of Informatics and Statistics
Department: Department of Systems Analysis

Information on submission and defense

Date of assignment: 18. 2. 2026
Date of submission: 11. 5. 2026
Date of defense: 16. 6. 2026
Identifier in the InSIS system: https://insis.vse.cz/zp/95683/podrobnosti

Files for download

    Last update: