생성적 컴파일: 인공지능이 코드를 생성하는 과정에서 실시간 컴파일러 피드백 활용
Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Code
Rust와 같이 풍부한 정적 의미 체계를 갖춘 언어는 AI가 생성한 코드에 대한 강력한 보장을 제공하지만, 엄격함은 코드 생성을 더욱 어렵게 만듭니다. 기존 컴파일러는 코드 생성 후 유용한 피드백을 제공할 수 있지만, autoregressive LLM 디코딩과 같은 중간 생성 단계를 안내하지 못합니다. 제약 조건이 있는 디코딩은 샘플링 과정에서 잘못된 토큰을 거부하여 문제를 해결하려 하지만, 모델에 대한 접근 권한이 필요하며 의미 제약 조건을 적용하기 위해 상당한 구현 노력이 필요합니다. 본 연구에서는 코드 생성 과정에서 부분 프로그램에 대한 컴파일러 피드백을 실시간으로 제공하는 최초의 방법인 '생성적 컴파일'을 소개합니다. 핵심 기술 요소는 '실러(sealer)'라는 경량화된, 주로 구문 지향적인 변환 기술로, 부분 프로그램을 표준 컴파일러가 진단할 수 있는 완전한 프로그램으로 변환합니다. 이 기술은 완료 가능한 부분 프로그램이 거부되지 않도록 설계되었으며, 동시에 실제 오류를 초기에 감지할 수 있을 만큼 충분한 코드 컨텍스트를 유지합니다. 우리는 Rust와 유사한 계산 모델에 이러한 실러를 구축하고, Lean을 사용하여 해당 속성이 만족됨을 증명했습니다. 또한 이를 기반으로 실제 Rust 언어에 대한 부분 프로그램 검사기를 개발했습니다. 본 연구에서는 최첨단 블랙박스 모델과 오픈 웨이트 모델 모두를 사용하여 저장소 수준의 복잡한 Rust 코딩 작업에서 제안하는 방법의 성능을 평가했습니다. 실험 결과, 생성적 컴파일은 기존의 코드 생성 후 피드백 방식에 비해 컴파일 오류 발생률을 줄이고 기능 정확도를 향상시키는 것을 확인했습니다. 이는 다양한 유형의 오류를 근원지에서부터 조기에 감지하여 오류 연쇄 반응을 줄이고, 보다 집중적인 진단을 가능하게 합니다. 더욱 넓은 관점에서, 생성적 컴파일은 컴파일러를 코드 생성 과정에 적극적으로 참여하는 AI 지원 프로그래밍의 핵심 요소로 만들어가는 첫걸음입니다.
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.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.
Log in to request an AI analysis.