Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Code
TL;DR — This work introduces "generative compilation," a method to get compiler feedback on partial programs during AI code generation (not just after), using a lightweight "sealor" that completes partial code so standard compilers can diagnose it early. It matters because it turns the compiler into an active, in-the-loop tool that catches errors at their source, improving correctness of AI-generated code in strict languages like Rust.
- Core device (sealor): a mostly syntax-guided transformation converting partial programs into complete, compilable ones; designed so completable partials are never rejected while retaining enough context to detect genuine dead ends early.
- Formal + practical grounding: properties proven on a core Rust-like calculus and mechanized in Lean, then extended to what they describe as the first partial-program checker for real Rust.
- Positioning vs. alternatives: unlike post-generation compiler checks (no guidance mid-decode) or constrained decoding (needs white-box access and costly reimplementation for semantic constraints), it works during generation and with black-box models.
- Reported results: evaluated on repository-level Rust tasks across frontier black-box and open-weight models; reduces non-compiling outputs and improves functional correctness versus standard post-generation feedback by catching errors early and reducing error cascades. (Specific numeric gains are not provided in the abstract.)