Ensuring trustworthy code: leveraging a static analyzer to identify and mitigate defects in generated code
Zapiski Nauchnykh Seminarov POMI, Investigations on applied mathematics and informatics. Part IV, Tome 540 (2024), pp. 233-251

Voir la notice de l'article provenant de la source Math-Net.Ru

The rise of large language models (LLMs) has greatly advanced code generation capabilities. A recent StackOverflow survey found that 70% of developers are using or planning to use AI coding tools this year. However, most current methods focus on supervised fine-tuning objectives derived from text generation, often overlooking the distinct sequence-level properties of code, such as compilability, and syntactic and functional correctness. To address this gap, we introduce a novel approach that combines pre-trained LLMs with software analysis tools commonly used to detect vulnerabilities and validate code. Our method leverages detailed feedback from code compilation and analysis, incorporating this specialized knowledge into the prompt chaining process. We present CodePatchLLM, an extension of LLMs that uses Svace feedback for improved code generation. CodePatchLLM is a model-agnostic framework that supports multiple programming languages. Extensive experiments on the LeetCode dataset show that our approach outperforms the baseline CodeLlama model, achieving significant improvements in compilation success rates and functional correctness across Java, Python, and Kotlin. The CodePatchLLM framework is available at https://github.com/dsshay/CodePatchLLM.
@article{ZNSL_2024_540_a12,
     author = {D. Shaikhelislamov and M. Drobyshevskiy and A. Belevancev},
     title = {Ensuring trustworthy code: leveraging a static analyzer to identify and mitigate defects in generated code},
     journal = {Zapiski Nauchnykh Seminarov POMI},
     pages = {233--251},
     publisher = {mathdoc},
     volume = {540},
     year = {2024},
     language = {en},
     url = {http://geodesic.mathdoc.fr/item/ZNSL_2024_540_a12/}
}
TY  - JOUR
AU  - D. Shaikhelislamov
AU  - M. Drobyshevskiy
AU  - A. Belevancev
TI  - Ensuring trustworthy code: leveraging a static analyzer to identify and mitigate defects in generated code
JO  - Zapiski Nauchnykh Seminarov POMI
PY  - 2024
SP  - 233
EP  - 251
VL  - 540
PB  - mathdoc
UR  - http://geodesic.mathdoc.fr/item/ZNSL_2024_540_a12/
LA  - en
ID  - ZNSL_2024_540_a12
ER  - 
%0 Journal Article
%A D. Shaikhelislamov
%A M. Drobyshevskiy
%A A. Belevancev
%T Ensuring trustworthy code: leveraging a static analyzer to identify and mitigate defects in generated code
%J Zapiski Nauchnykh Seminarov POMI
%D 2024
%P 233-251
%V 540
%I mathdoc
%U http://geodesic.mathdoc.fr/item/ZNSL_2024_540_a12/
%G en
%F ZNSL_2024_540_a12
D. Shaikhelislamov; M. Drobyshevskiy; A. Belevancev. Ensuring trustworthy code: leveraging a static analyzer to identify and mitigate defects in generated code. Zapiski Nauchnykh Seminarov POMI, Investigations on applied mathematics and informatics. Part IV, Tome 540 (2024), pp. 233-251. http://geodesic.mathdoc.fr/item/ZNSL_2024_540_a12/