← Latest papers
🤖 machine learning

Towards Functional Correctness of Large Code Models with Selective Generation

This paper proposes "FuzzEval," a paradigm that leverages dynamically generated unit tests to enable a selective code generator to abstain from uncertain outputs, thereby theoretically controlling the false discovery rate and improving the functional correctness of large code models.

Original authors: Jaewoo Jeong, Taesoo Kim, Sangdon Park

Published 2026-06-16
📖 4 min read☕ Coffee break read

Original authors: Jaewoo Jeong, Taesoo Kim, Sangdon Park

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a very talented but slightly overconfident robot assistant whose job is to write computer code for you. You ask it, "Write a program that sorts a list of names," and it happily spits out a solution. But here's the catch: sometimes, this robot is hallucinating. It writes code that looks like it works, but when you actually run it, it crashes, gives the wrong answer, or does something completely unexpected.

In the world of software, this is dangerous. You can't just trust the robot blindly.

This paper introduces a new "safety inspector" system for these code-writing robots. Instead of just accepting whatever code the robot generates, this system acts like a strict quality control manager who says, "I'll only let the good code through; if I'm not sure, I'll admit I don't know."

Here is how the system works, broken down into simple concepts:

1. The Problem: The "Black Box" of Code

Usually, when we check if a piece of code is good, we rely on a few pre-written tests (like a checklist). But for complex problems, a checklist might miss hidden bugs. It's like checking if a car is safe by only looking at the tires and ignoring the engine. The paper argues that because code is so complex and "unnatural" for humans to read, it's hard to tell if two pieces of code do the exact same thing just by looking at them.

2. The Solution: The "Fuzzing" Machine

To solve this, the authors use a tool called Fuzzing. Imagine you have a machine that takes a piece of code and throws millions of random, weird, and extreme inputs at it, just to see if it breaks.

  • The Analogy: Think of a stress-tester for a bridge. Instead of just driving one car across, the machine throws sandbags, heavy trucks, and even elephants across the bridge in random patterns to see if it holds up.
  • The Result: This machine automatically generates thousands of "unit tests" (little scenarios to check the code) that the robot never saw before.

3. The "Selective Generator": The Honest Robot

The paper proposes a new way to use the code-writing robot. They add a "gatekeeper" step.

  • The Process: The robot tries to write code. Then, the "Fuzzing Machine" immediately tests it against thousands of random scenarios.
  • The Decision:
    • If the code passes the tests with high confidence, the gatekeeper says, "Go ahead, this is good!" and gives you the code.
    • If the code fails or the tests are too ambiguous, the gatekeeper says, "I don't know," and refuses to give you the code.

This is called Selective Generation. The robot is allowed to say "I don't know" instead of guessing and giving you bad code.

4. The Guarantee: The "False Discovery Rate"

The most exciting part of the paper is the math behind the gatekeeper. The authors don't just hope the system works; they prove it mathematically.

  • They set a rule: "We want to make sure that less than 30% (or whatever number you choose) of the code we do give you is actually bad."
  • They call this the False Discovery Rate (FDR).
  • The system is designed so that even if the robot is terrible, the gatekeeper will filter out the bad stuff so strictly that the final batch of code you receive is guaranteed to be mostly correct.

5. FuzzEval: A Better Report Card

Finally, the authors suggest using this same "Fuzzing Machine" to grade code models in the future. Instead of just checking if code passes a few standard tests (like a school exam with 5 questions), they propose using the Fuzzing Machine to generate hundreds of random tests. This gives a much more accurate and rigorous report card on how good a code-writing AI really is. They call this new grading method FuzzEval.

Summary

In short, this paper teaches us how to build a safety net for AI code generators. By using a "stress-test" machine (Fuzzing) to automatically create millions of tests, we can create a system that:

  1. Filters out bad code before it reaches you.
  2. Admits ignorance ("I don't know") when it's unsure, rather than hallucinating a wrong answer.
  3. Guarantees mathematically that the code you do get is safe to use.

It turns a "guess and hope" approach into a "test and verify" approach, making AI-generated code much more reliable for real-world use.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →