Source note3 min read

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

Source

arXiv

arxiv.org/abs/2607.13921v1

Read the source

Source

Plain-Language Brief

Researchers introduce 'generative compilation', an approach to get feedback from compilers on partially generated code during the code generation process. The method aims to reduce errors and improve the functionality of AI-generated code, particularly in languages with rich static semantics like Rust.

What the Document Says

  • The researchers propose 'generative compilation' for obtaining compiler feedback on partial programs during generation.
  • A lightweight syntax-guided transformation called a 'sealor' is introduced to convert partial programs into complete ones that standard compilers can diagnose.
  • The sealor is designed such that possible-to-complete partial programs are never rejected and preserves enough code context to catch genuine dead ends early.
  • The method is proved to satisfy these properties using Lean, and extended to a partial-program checker for real Rust.
  • The researchers evaluate the method on challenging Rust coding tasks using both black-box and open-weight models.
  • Generative compilation reduces non-compiling outputs and improves functional correctness compared to standard post-generation feedback.

Key Concepts Mentioned

  • AI-generated code
  • Rust programming language
  • Compilers
  • Partial programs
  • Sealor
  • Lean theorem prover

Claims Made by the Document

  • Generative compilation provides compiler feedback on partial programs during generation.
  • The sealor converts partial programs into complete ones that standard compilers can diagnose.
  • The sealor is designed to ensure possible-to-complete partial programs are never rejected.
  • The method improves functional correctness and reduces non-compiling outputs compared to standard post-generation feedback.

Evidence Used

  • The introduction of generative compilation
  • The description of the sealor and its properties
  • The proof of the sealor's properties in Lean
  • The extension to a partial-program checker for real Rust
  • The evaluation results on challenging Rust coding tasks

Methods / Approach

UNKNOWN

Limitations Stated by the Authors

UNKNOWN

Limitations Noted by the Agent

Agent interpretation — not from the source.

UNKNOWN

Open Questions

UNKNOWN

Notes for Future Q&A

May include interpretation. Labeled where it does.

UNKNOWN

Raw Abstract / Excerpt

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.