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.
CodeCircuit: Toward Inferring LLM-Generated Code Correctness via Attribution Graphs
University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);University of Edinburgh(爱丁堡大学);Nanyang Technological University(南洋理工大学);National University of Singapore(新加坡国立大学);IQuest Research(IQuest研究)
Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesis
Peking University(北京大学);University of Michigan(密歇根大学);Shanghai Jiao Tong University(上海交通大学);Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);Tencent(腾讯)
VISOR: A Vision-Language Model-based Test Oracle for Testing Robots
Simula Research Laboratory(Simula研究实验室);Oslo Metropolitan University(奥斯陆理工大学);Mondragon University(蒙dragon大学);National Institute of Informatics(国立信息研究所)