Agentic Harness for Real-World Compilers
Organizations: Southern University of Science and Technology · ETH Zurich · The Chinese University of Hong Kong
Abstract
Compilers are critical to modern computing, yet fixing compiler bugs is difficult. While recent large language model (LLM) advancements enable automated bug repair, compiler bugs pose unique challenges due to their complexity, deep cross-domain expertise requirements, and sparse, non-descriptive bug reports, necessitating compiler-specific harnesses. To bridge the gap, we introduce llvm-harness, the first harness designed to assist LLM agents in understanding and fixing compiler bugs. Our current focus is on the middle end of LLVM, one of the most widely used compiler infrastructures. Central to llvm-harness are agent-friendly LLVM tools, a benchmark llvm-bench of 334 reproducible LLVM middle-end bugs, and a tailored mini agent llvm-autofix-mini for fixing LLVM middle-end bugs automatically. We evaluate five frontier models and find that they exhibit a performance decline when tackling compiler bugs with the state-of-the-art agent. With llvm-harness' enhancement, their performance improves by 62%. Our specialized mini agent llvm-autofix-mini further outperforms the llvm-harness-enhanced state-of-the-art by 22%. This emphasizes the necessity for specialized harnesses like ours to assist LLMs in compiler engineering tasks. Despite promising results, our expert review also reveals several open challenges that remain when applying LLMs for compiler engineering tasks. GitHub: https://github.com/dtcxzyw/llvm-harness
Figures & tables
| Tests | Fixes | |||||||
| Name | Split | #Bugs (#C/#M) | #Comp | #Rep | #Reg | #Lines | #Funcs | #Files |
| full | full | 334 (222/112) | 64 | 1.4 | 722.2 | 17.1 | 1.6 | 1.2 |
| easy | 255 (176/79) | 48 | 1.4 | 734.1 | 9.1 | 1.0 | 1.0 | |
| medium | 44 (26/18) | 18 | 1.4 | 626.5 | 38.8 | 2.6 | 1.0 | |
| hard | 35 (20/15) | 25 | 1.7 | 756.6 | 47.6 | 4.9 | 2.7 | |
| live | full | 229 (160/69) | 43 | 1.5 | 743.7 | 18.5 | 1.7 | 1.2 |
| %Passed | $Cost | ||||||
| Model | SWEV | full | easy | medium | hard | SWEV | full |
| GPT 4o | 21.6 | 8.3 (-61.6%) | 9.9 | 5.9 | 0.0 | 1.53 | 1.59 |
| GPT 5 | 65.0 | 21.0 (-67.8%) | 23.3 | 17.6 | 8.7 | 0.28 | 0.74 |
| Gemini 2.5 Pro | 53.6 | 9.2 (-82.9%) | 10.5 | 5.9 | 4.3 | 0.29 | 0.81 |
| Qwen 3 Max | 69.6 | 24.4 (-64.9%) | 29.1 | 17.6 | 0.0 | – | 4.32 |
| DeepSeek V3.2 | 60.0 | 38.9 (-35.2%) | 43.0 | 32.4 | 17.4 | 0.03 | 0.08 |
| Difficulty | Bug Type | |||||
| Harness | full | easy | medium | hard | crash | miscomp |
| 24.0 | 26.2 | 17.6 | 17.4 | 28.1 | 14.5 | |
| 38.9 | 43.0 | 32.4 | 17.4 | 41.9 | 31.9 | |
| Improv. | 1.6 | 1.6 | 1.8 | 1.0 | 1.5 | 2.2 |
| mini-SWE-agent | llvm-autofix-mini | |||
| Model | %Passed | $Cost | %Passed | $Cost |
| GPT 4o | 8.3 | 1.59 | 12.2 (1.5 ) | 2.18 |
| GPT 5 | 21.0 | 0.74 | 51.5 (2.5 ) | 0.59 |
| Gemini 2.5 Pro | 9.2 | 0.81 | 14.4 (1.6 ) | 1.16 |
| Qwen 3 Max | 24.4 | 4.32 | 35.8 (1.5 ) | 5.67 |
| DeepSeek V3.2 | 38.9 | 0.08 | 10.5 (0.3 ) | 0.15 |
| Token Cost (million) | |||||||||
| M | T/m | #Tests | #Rounds | #Tot | #In | #Out | #Cache | %Cache | $Cost |
| mini-SWE-agent | |||||||||
| G4 | 7.1 | 13.0 | 74.4 | 2.2 | 2.2 | 6.9K | 2.2 | 96.4 | 1.6 |
| G5 | 14.6 | 9.5 | 66.9 | 2.6 | 2.6 | 28.2K | 2.5 | 94.4 | 0.7 |
| GM | 8.8 | 7.4 | 51.7 | 1.6 | 1.6 | 21.3K | 1.4 | 85.8 | 0.8 |
| QW | 18.1 | 13.1 | 77.7 | 2.4 | 2.4 | 15.3K | 1.1 | 43.9 | 4.3 |
| mini-SWE-agent | llvm-autofix-mini | |||
| Model | %Passed | %Valid | %Passed | %Valid |
| GPT 4o | 8.3 | 1.7 (21.0%) | 12.2 | 3.9 (32.1%) |
| GPT 5 | 21.0 | 6.6 (31.3%) | 51.5 | 20.1 (39.0%) |
| Gemini 2.5 Pro | 9.2 | 2.2 (23.8%) | 14.4 | 5.2 (36.4%) |
| Qwen 3 Max | 24.4 | 8.7 (35.7%) | 35.8 | 13.1 (36.6%) |
| DeepSeek V3.2 | 38.9 | 14.4 (37.1%) | 10.5 | 4.4 (41.7%) |
| mini-SWE-agent | llvm-autofix-mini | ||||
| Type | Model | %Passed | %Valid | %Passed | %Valid |
| crash | GPT 4o | 11.9 | 2.5 (21.1%) | 17.5 | 5.6 (32.1%) |
| GPT 5 | 24.4 | 6.9 (28.2%) | 56.9 | 18.1 (31.9%) | |
| Gemini 2.5 Pro | 11.2 | 2.5 (22.2%) | 15.6 | 6.2 (40.0%) | |
| Qwen 3 Max | 32.5 | 11.2 (34.6%) | 43.1 | 15.0 (34.8%) | |
| DeepSeek V3.2 | 41.9 | 11.9 (28.4%) | 12.5 | 4.4 (35.0%) | |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Signature | Description |
| Generic Tools | |
| find ( pat , dir ) | Find files matching the pattern pat in the directory dir recursively |
| grep ( args ) | Find text matching patterns and files mentioned in arguments args |
| list ( dir ) | List files and directories in the directory dir |
| read ( file , pos , k ) | Read k lines of content starting from line pos of the file file |
| edit ( file , text , rep ) | Replace the text text with the text rep in the file file |
| Signature | Description |
| Generic Tools | |
| write ( file , txt ) | Write txt into file |
| bash ( cmd , tmo ) | Execute command cmd in a Bash environment with tmo as timeout |
| todo ( act , args ) | Perform a TODO action act with args |
| LLVM-specific Tools | |
| build () | Build a debuggable LLVM |
| Model | #01 | #10 | #11 | #00 | -value | Significant? | |
| GPT 5 | 77 | 7 | 41 | 104 | 56.68 | 0.0000 | |
| Gemini 2.5 Pro | 23 | 11 | 10 | 185 | 3.56 | 0.0296 | |
| Qwen 3 Max | 42 | 16 | 40 | 131 | 10.78 | 0.0005 |
| mini-SWE-agent | llvm-autofix-mini | |||||||||
| %Passed | %Valid | %Passed | %Valid | |||||||
| Model | Release Date | #Post ( e / m / h ) | Pre | Post | Pre | Post | Pre | Post | Pre | Post |
| GPT 4o | 2024-07-18 | 229 (172/34/23) | – | 8.3 | – | 1.7 | – | 12.2 | – | 3.9 |
| GPT 5 | 2025-08-07 | 14 (9/3/2) | 20.9 | 21.4 | 7.0 | 0.0 | 49.3 | 85.7 | 19.5 | 28.6 |
| Gemini 2.5 Pro | 2025-07-17 | 21 (14/4/3) | 9.1 | 9.5 | 2.4 | 0.0 | 13.5 | 23.8 | 4.8 | 9.5 |
| Qwen 3 Max | 2025-09-05 | 0 (0/0/0) | 24.5 | – | 8.7 | – | 35.8 | – | 13.1 | – |
LLM Agent Harnesses
LLM agent harnesses are the software and runtime systems that organize an agent’s tools, context, state, execution, and safeguards.
See all 381 papers