T-LLM Compiler: Trusted LLM-based Code Optimization and Verification Framework

| Source: arXiv AI

Tags: code optimization, compiler, LLM, verification, PolyBench, open-source, HPC

T-LLM Compiler combines LLM-generated code transformations with traditional compiler verification in an iterative feedback loop, achieving 83.3% optimization accuracy and up to 16.1% runtime speedup on PolyBench/C benchmarks (26.7% average speedup vs standard baselines). Source code is open-sourced.

Details

LLMs can propose code transformations—loop tiling, vectorization, memory access reordering—but lack the ability to verify whether those transformations are semantically equivalent to the original code. Traditional compilers can verify correctness but cannot propose high-level restructuring. T-LLM Compiler combines both: an LLM generates candidate transformations, a traditional compiler applies them, and verification tools confirm correctness, triggering another LLM pass when the transformation fails. The system is evaluated on PolyBench/C, a standard suite of compute-intensive numerical kernels used in compiler research. T-LLM Compiler achieves code optimization accuracy of up to 83.3%—meaning the fraction of transformations that both compile correctly and produce semantically equivalent code. Runtime speedup reaches up to 16.1% on specific benchmarks, with an average of 26.7% over standard compiler baselines. The architecture is iterative: failures feed back into the LLM with error context, allowing the model to correct its transformation strategy. This corrective loop is what closes the gap between LLM-proposed optimizations (which are often syntactically correct but semantically wrong) and verified, deployable code. The source code is released publicly. Limitations are clear: PolyBench/C is a narrow benchmark set focused on numeric kernels, and generalization to arbitrary C codebases or other languages is not demonstrated.