paper-with-me

홈 › Papers

Correctness Assessment of Code Generated by Large Language Models Using Internal Representations

2025-01-22 · Tuan-Dung Bui, Thanh Trong Vu, Thu-Trang Nguyen, Son Nguyen, Hieu Dinh Vo

Ensuring the correctness of code generated by Large Language Models (LLMs) presents a significant challenge in AI-driven software development. Existing approaches predominantly rely on black-box (closed-box) approaches that evaluate correctness post-generation, failing to utilize the rich insights embedded in the LLMs' internal states during code generation. In this paper, we introduce OPENIA, a novel white-box (open-box) framework that leverages these internal representations to assess the correctness of LLM-generated code. OPENIA systematically analyzes the intermediate states of representative open-source LLMs specialized for code, including DeepSeek-Coder, CodeLlama, and MagicCoder, across diverse code generation benchmarks. Our empirical analysis reveals that these internal representations encode latent information, which strongly correlates with the correctness of the generated code. Building on these insights, OPENIA uses a white-box/open-box approach to make informed predictions about code correctness, offering significant advantages in adaptability and robustness over traditional classification-based methods and zero-shot approaches. Experimental results demonstrate that OPENIA consistently outperforms baseline models, achieving higher accuracy, precision, recall, and F1-Scores with up to a 2X improvement in standalone code generation and a 46% enhancement in repository-specific scenarios. By unlocking the potential of in-process signals, OPENIA paves the way for more proactive and efficient quality assurance mechanisms in LLM-assisted code generation.

📄 PDF Abstract BibTeX arXiv:2501.12934

Code (1)

ise-uet-vnu/openia 공식 구현 pytorch

Tasks

Code Generation

Similar Papers 제목 키워드 기반

Automating the Correctness Assessment of AI-generated Code for Security Contexts

2023-10-28 · Domenico Cotroneo, Alessio Foggia, Cristina Improta, Pietro Liguori 외

Evaluating the correctness of code generated by AI is a challenging open problem. In this paper, we propose a fully automated method, named ACCA, to evaluate the correctness of AI-generated code for security purposes. Th…

Language Modelling

Examination of Code generated by Large Language Models

2024-08-29 · Robin Beer, Alexander Feix, Tim Guttzeit, Tamara Muras 외

Large language models (LLMs), such as ChatGPT and Copilot, are transforming software development by automating code generation and, arguably, enable rapid prototyping, support education, and boost productivity. Therefore…

Code Generation

Is this Change the Answer to that Problem? Correlating Descriptions of Bug and Code Changes for Evaluating Patch Correctness

2022-08-08 · Haoye Tian, Xunzhu Tang, Andrew Habib, Shangwen Wang 외

In this work, we propose a novel perspective to the problem of patch correctness assessment: a correct patch implements changes that "answer" to a problem posed by buggy behaviour. Concretely, we turn the patch correctne…

Question Answering

An Empirical Study of AI-based Smart Contract Creation

2023-08-05 · Rabimba Karanjai, Edward Li, Lei Xu, Weidong Shi

The introduction of large language models (LLMs) like ChatGPT and Google Palm2 for smart contract generation seems to be the first well-established instance of an AI pair programmer. LLMs have access to a large number of…

Code Generation

SALLM: Security Assessment of Generated Code

2023-11-01 · Mohammed Latif Siddiq, Joanna C. S. Santos, Sajith Devareddy, Anna Muller

With the growing popularity of Large Language Models (LLMs) in software engineers' daily practices, it is important to ensure that the code generated by these tools is not only functionally correct but also free of vulne…

Code Generation