LLM-generated Rust harnesses achieve 94.7% precision and uncover six memory safety bugs
HarnessLLM can automatically generate verification harnesses for Rust code with high precision and detect real memory safety bugs
Software arXiv 24 Jul 2026 Method Prototype evidence
Published as “HarnessLLM: Rust Verification Harness Generation with Large Language Models”
Why it matters
The approach can automatically produce verification harnesses for Rust projects, dramatically reducing manual effort and enabling detection of previously unknown memory-safety bugs.
Summary
HarnessLLM automatically generates Rust verification harnesses from existing tests, achieving 100% success on 294 harnesses with an average generation time of 145 seconds per harness and uncovering six real-world memory safety bugs. It extracts calling scenarios with 94.66% precision and outperforms the prior Autoharness tool, which only succeeded on 41% of scenarios. The evidence is strong, based on evaluation across nine real-world Rust libraries, though reported generation times differ from detailed measurements.
What they found 4
- High-precision scenario extraction and fast harness generation
“In our evaluation on 9 real-world Rust codebases, HarnessLLM extracted 294 calling scenarios from 494 test cases with 94.66% precision and generated harnesses for all scenarios in an average of 145 seconds each.”
- Outperforms Autoharness
“It outperformed the existing approach, Autoharness, which succeeded on only 41% of those scenarios.”
- Detects real memory-safety bugs
“Finally, 6 real-world memory safety bugs were detected using the generated harnesses, demonstrating the practical utility of our approach in verification.”
- 100% syntactic success across libraries
“Within 10 generation attempts, HarnessLLM produced syntactically correct harnesses for all 9 Rust libraries.”
Caveats 3
- The abstract reports an average generation time of 145 seconds per harness, but Table 6 shows a measured average of 353 seconds for GPT-4.1.
- Avg. Time (sec) 353
- scenario coverage decreased under sparse tests.
What’s new here 4
- Generates verification harnesses directly from test suites using LLMs, eliminating manual harness authoring.
- Handles complex user-defined types via dependency-graph analysis and Chain-of-Thought prompting.
- Iteratively refines harnesses with compiler feedback to correct hallucinated types or functions.
- Achieves full coverage where prior tools (Autoharness) fail due to Arbitrary-trait limitations.