cs.SEMay 19, 2025

Towards Functional Correctness of Code Models with Selective Generation

Authors: Jaewoo Jeong, Taesoo Kim, Sangdon Park

Organizations: CSE, POSTECH · SCS&SCP GaTech · Microsoft · GSAI, POSTECH

Abstract

The hallucination of code generation models hinders their applicability to systems requiring higher safety standards. One critical bottleneck in addressing code hallucination is the difficulty of identifying the functional correctness of generated code, due to its unnatural form. We address this core bottleneck by automatically generating unit tests using dynamic code analysis tools, leveraging the executable nature of code. Accordingly, we propose a selective code generator that abstains from uncertain generations -- based on the functional correctness evaluated by generated unit tests -- to theoretically control the correctness among non-abstained answers, \ie the false discovery rate. Finally, we propose to use generated unit tests in evaluation as well as in learning for precise code evaluation, calling this paradigm FuzzEval. We demonstrate the efficacy of our method along with the controllability of code hallucination and reasonable selection efficiency.

Figures & tables

Explore similar work

CardsList
  1. Route-Align-Verify for Functional Correctness in Code Generation

    Aug 4, 2026Erxue Zhou, Jingxiang Meng, Aofan LiuExecution-Guided Code GenerationCode Generation

  2. Verification Trap: Understanding Test-Time Selection Failures under False Premises in Code Generation

    Oct 4, 2026Feng He, Hejia Wang, Linghao Meng +2Execution-Guided Code GenerationCode Generation Evaluation