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 that allows compilers to provide feedback on partial programs during the generation of AI-generated code in languages with rich static semantics like Rust. The method aims to reduce non-compiling outputs and improve functional correctness by detecting errors early and enabling focused diagnostics.

What the Document Says

  • The paper presents generative compilation, an approach that enables compiler feedback on partial programs during the generation of AI-generated code.
  • The method is designed for languages with rich static semantics like Rust, where strictness makes code generation more difficult.
  • Off-the-shelf compilers provide useful feedback post-generation but not during intermediate steps, such as 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.
  • The paper proposes a lightweight, mostly syntax-guided transformation called sealor that converts 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 paper constructs a sealor on a core Rust-like calculus and proves it satisfies the stated properties, all mechanized in Lean.
  • The method is extended to the first partial-program checker for real Rust.
  • Evaluation of the method is conducted on challenging repository-level Rust coding tasks across both frontier black-box and open-weight models.
  • Results show that generative compilation reduces non-compiling outputs and improves functional correctness, relative to standard post-generation feedback.
  • The method detects a broad range of errors close to their source and early during generation, thereby reducing error cascades and enabling focused diagnostics.

Key Concepts Mentioned

  • AI-generated code
  • compiler feedback
  • static semantics
  • Rust
  • partial programs
  • sealor
  • Lean
  • evaluation

Claims Made by the Document

  • Generative compilation reduces non-compiling outputs and improves functional correctness.
  • Generative compilation detects a broad range of errors early during generation.

Evidence Used

  • Results from evaluation on challenging repository-level 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.