LEGO-Compiler: Enhancing Neural Compilation Through Translation Composability

📅 2025-05-26
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Current large language models (LLMs) exhibit limited reliability in long-range, complex program translation tasks, hindering their deployment in production-grade compilers and code transformation tools. To address this, we propose LEGO, a novel neural compilation paradigm that formally establishes the composability of program translation. LEGO modularizes the compilation pipeline into verifiable, testable sub-steps and introduces an external-execution-feedback-driven self-correction mechanism. Our approach integrates program chunking and reassembly, verifiable workflow modeling, and test-driven feedback learning. Evaluated on ExeBench and AnsiBench, LEGO achieves 99.0% and 97.9% translation accuracy, respectively, while enabling near 10× scaling in compilable program size. These results significantly improve LLMs’ reliability and scalability for assembly-level program translation, advancing their practical applicability in compiler infrastructure.

Technology Category

Application Category

📝 Abstract
Large language models (LLMs) have the potential to revolutionize how we design and implement compilers and code translation tools. However, existing LLMs struggle to handle long and complex programs. We introduce LEGO-Compiler, a novel neural compilation system that leverages LLMs to translate high-level languages into assembly code. Our approach centers on three key innovations: LEGO translation, which decomposes the input program into manageable blocks; breaking down the complex compilation process into smaller, simpler verifiable steps by organizing it as a verifiable LLM workflow by external tests; and a feedback mechanism for self-correction. Supported by formal proofs of translation composability, LEGO-Compiler demonstrates high accuracy on multiple datasets, including over 99% on ExeBench and 97.9% on industrial-grade AnsiBench. Additionally, LEGO-Compiler has also acheived near one order-of-magnitude improvement on compilable code size scalability. This work opens new avenues for applying LLMs to system-level tasks, complementing traditional compiler technologies.
Problem

Research questions and friction points this paper is trying to address.

Handles long complex programs via block decomposition
Breaks compilation into verifiable LLM workflow steps
Improves compilable code size scalability significantly
Innovation

Methods, ideas, or system contributions that make the work stand out.

Decomposes programs into manageable LEGO blocks
Organizes compilation as verifiable LLM workflow
Uses feedback mechanism for self-correction
🔎 Similar Papers
No similar papers found.