Systematically Understanding of Code Semantic Interpretation for LLMs
Abstract
Understanding and interpreting code is a crucial task in intelligent software engineering, aiding developers and users in adjusting code for correctness and robustness. The emergence of large language models (LLMs) provides new perspectives for code interpretation tasks. However, current LLM-based code interpretation remains restricted to limited dimensions, lacks a unified evaluation standard, and is missing a comprehensive and systematic assessment methodology. To address this issue, this paper proposes an LLM code understanding evaluation method based on a multi-granularity voting mechanism, aiming to systematically investigate and analyze LLMs' performance in code interpretation tasks. First, we carefully select code snippets from open-source GitHub projects and preprocess them for LLM analysis. Second, we use identical prompts and inputs to test three popular LLMs, recording their output. During this process, we apply prompt engineering techniques to specific target code snippets and conduct repeated experiments to explore the impact of prompt engineering on LLM-generated code explanations. Next, we design evaluation metrics to quantify the LLM outputs and assess their effectiveness based on the obtained scores. Experimental results demonstrate significant differences in code analysis and generation capabilities among the evaluated general-purpose LLMs from different vendors when given identical prompts and inputs. When multiple dimensions are considered in evaluating the generated content, different LLMs exhibit varying strengths in different aspects. Additionally, applying specific prompt engineering techniques can moderate the discrepancies in code analysis and generation capabilities among different LLMs.
References
- Fang C, Miao N, Srivastav S, et al. Large language models for code analysis: Do {LLMs} really do their job?[C]//33rd USENIX Security Symposium (USENIX Security 24). 2024: 829-846.
- Szabó Z, Bilicki V. A new approach to web application security: Utilizing gpt language models for source code inspection[J]. Future Internet, 2023, 15(10): 326.
- Leinonen J, Hellas A, Sarsa S, et al. Using large language models to enhance programming error messages[C]//Proceedings of the 54th ACM Technical Symposium on Computer Science Education V. 1. 2023: 563-569.
- Deng Y, Xia C S, Peng H, et al. Large language models are zero-shot fuzzers: Fuzzing deep-learning libraries via large language models[C]//Proceedings of the 32nd ACM SIGSOFT international symposium on software testing and analysis. 2023: 423-435.
- Jain N, Vaidyanath S, Iyer A, et al. Jigsaw: Large language models meet program synthesis[C]//Proceedings of the 44th International Conference on Software Engineering. 2022: 1219-1231.
- Pan R, Ibrahimzada A R, Krishna R, et al. Lost in translation: A study of bugs introduced by large language models while translating code[C]//Proceedings of the IEEE/ACM 46th International Conference on Software Engineering. 2024: 1-13.
- Nam D, Macvean A, Hellendoorn V, et al. Using an llm to help with code understanding[C]//Proceedings of the IEEE/ACM 46th International Conference on Software Engineering. 2024: 1-13.
- Leinonen J, Denny P, MacNeil S, et al. Comparing code explanations created by students and large language models[C]//Proceedings of the 2023 Conference on Innovation and Technology in Computer Science Education V. 1. 2023: 124-130.
- MacNeil S, Tran A, Mogil D, et al. Generating diverse code explanations using the gpt-3 large language model[C]//Proceedings of the 2022 ACM conference on international computing education research-volume 2. 2022: 37-39.
- MacNeil S, Tran A, Hellas A, et al. Experiences from using code explanations generated by large language models in a web software development e-book[C]//Proceedings of the 54th ACM Technical Symposium on Computer Science Education V. 1. 2023: 931-937.
- Sarsa S, Denny P, Hellas A, et al. Automatic generation of programming exercises and code explanations using large language models[C]//Proceedings of the 2022 ACM Conference on International Computing Education Research-Volume 1. 2022: 27-43.
- Estdale J, Georgiadou E. Applying the ISO/IEC 25010 quality models to software product[C]//European Conference on Software Process Improvement. Cham: Springer International Publishing, 2018: 492-503.