Can Large Language Models Understand Intermediate Representations in Compilers?
Paper β’ 2502.06854 β’ Published
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Assignment 15 β Investigating LLM-assisted compiler lowering to LLVM IR
| Metric | Value |
|---|---|
| Total Generations | 118 (15 constructs Γ 4 models Γ 2 strategies) |
| Overall Validity Rate | 89.8% |
| Best Model | Llama-3.3-70B (100.0% valid) |
| Repair Success Rate | 87.5% (7/8 constructs fully repaired) |
| Error Reduction via Repair | 90.9% |
βββ source_constructs.py # 15 C constructs across 6 complexity levels
βββ ir_generator.py # LLM-based LLVM IR generation pipeline
βββ ir_validator.py # 5-pass LLVM IR validator (SSA, types, CFG)
βββ failure_analyzer.py # 5-class failure taxonomy with 25 sub-categories
βββ repair_loop.py # Iterative validation-repair architecture
βββ report_generator.py # Automated report generation
βββ run_pipeline_v2.py # Main pipeline script
βββ results/
β βββ REPORT.md # Full project report
β βββ generation_results.json
β βββ failure_analysis.json
β βββ detailed_examples.json
β βββ repair_results.json
β βββ repair_statistics.json
βββ README.md
15 C constructs organized by complexity:
| Level | Category | Constructs | Validity Rate |
|---|---|---|---|
| L1 | Arithmetic & Assignment | 4 | 100.0% |
| L2 | Control Flow | 4 | 84.4% |
| L3 | Functions & Calling | 2 | 100.0% |
| L4 | Pointers & Memory | 2 | 86.7% |
| L5 | Structs & Aggregates | 1 | 87.5% |
| L6 | Composite | 2 | 75.0% |
| Model | Valid Rate | Compilable | Avg Time |
|---|---|---|---|
| Llama-3.3-70B | 100.0% | 100.0% | 1.53s |
| Qwen2.5-Coder-32B | 93.3% | 100.0% | 3.67s |
| Llama-3.1-8B | 89.7% | 89.7% | 0.33s |
| Qwen2.5-72B | 75.9% | 82.8% | 22.8s |
| Class | Category | Count | % of Total |
|---|---|---|---|
| CLASS_1 | Structural/Syntactic | 14 | 24.6% |
| CLASS_2 | Control Flow | 38 | 66.7% |
| CLASS_4 | Semantic/Functional | 5 | 8.8% |
Top failure sub-categories:
Based on AIvril 2 (arXiv:2412.04485) architecture:
# Install dependencies
pip install huggingface_hub openai
# Set your HF token
export HF_TOKEN=your_token_here
# Run the full pipeline
python run_pipeline_v2.py
# Generate report from existing results
python report_generator.py results/
MIT