Skip to content

Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Code

Jul 2026 · arXiv.org · Vol abs/2607.13921 · 0 citations · 58 references
Computer Science

TL;DR

It is shown that generative compilation reduces non-compiling outputs and improves functional correctness, relative to standard post-generation feedback, by detecting a broad range of errors close to their source and early during generation, thereby reducing errors cascades and enabling focused diagnostics.

Abstract

Languages with rich static semantics, such as Rust, provide stronger guarantees for AI-generated code, but their strictness makes generation more difficult. Off-the-shelf compilers can provide useful feedback post-generation, but does not guide intermediate generation steps, such as those during autoregressive LLM decoding. Constrained decoding intervenes earlier by rejecting invalid tokens during sampling, but requires white-box model access and costly reimplementation for semantic constraints. We introduce generative compilation, the first approach to obtaining compiler feedback on partial programs during generation. The core technical device is a sealor: a lightweight, mostly syntax-guided transformation that converts partial programs into complete ones that standard compilers can diagnose. It is designed such that possible-to-complete partial programs are never rejected, while preserving enough code context to catch genuine dead ends early. We construct such a sealor on a core Rust-like calculus and prove that it satisfies these properties, all mechanized in Lean. We extend it to the first partial-program checker for real Rust. We evaluate our method on challenging repository-level Rust coding tasks, across both frontier black-box and open-weight models. We show that generative compilation reduces non-compiling outputs and improves functional correctness, relative to standard post-generation feedback. It does so by detecting a broad range of errors close to their source and early during generation, thereby reducing errors cascades and enabling focused diagnostics. More broadly, generative compilation is a step toward making compilers a first-class citizen of AI-assisted programming active during generation, rather than a separate post-generation check.

View source

Similar papers

Preprint Jul 2026

Teaching Code LLMs to Reason with Intermediate Formal Specifications

This paper introduces SpecCoder, a verification-guided CodeLLM training framework that learns from validated reference programs, behavior-changing mutants, and multi-turn specification-refinement traces, and improves checkpoint-specification quality over base CodeLLMs, and introduces HumanExec, a benchmark built from r...

Minh Le-Anh, Cuong Chi Le, Tien N. Nguyen · 0 citations
Book Open access Jul 2026

From Prompts to Pareto Fronts: Using Code LMs as Semantic Genetic Operators for Compiler Bug Discovery

Differential compiler testing requires automatically generated programs that are not only diverse and bug-revealing, but also semantically well-defined and reproducible. Rule-based generators provide strong validity guarantees but offer limited control over semantic variation, while large language models (LLMs) can syn...

Lang Hong Nguyet Anh, Ho Viet Duc Luong, Vu Van An · 0 citations
Jul 2026

Portable models as a replacement for industrial heuristics in compiler optimizations

The paper investigates the possibility of predicting function-inlining decisions in compact compilers, source-to-source tools, and interpreters where the reuse of GCC or LLVM optimization infrastructure is impractical and proposes a portable inlining-prediction framework that can be emitted as ordinary C code without a...

F. Nikolai, Vinarsky Alexander · 0 citations
Book Open access Jul 2026

Compilomorphic Fuzzing: Turning a Compiler Against Itself

Compilomorphic fuzzing is introduced, a new validation approach that turns a compiler into its own test oracle via structure-preserving transformations over programs and structured inputs, establishing a practical, model-free foundation for validating compilers in critical DSL domains.

Vasileios Klimis · 0 citations
Conference 2026

Characterizing Type Feedback in Just-In-Time Compilation

A characterization study of how feedback information is utilized by JIT compilers, providing motivation for future work on reducing recording overhead, and evaluating two oracle-based configurations that establish upper bounds on achievable reduction.

Sebastián Krynski, F. Říha, Filip Křikava et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.