Skip to content
Book Open access

HarnessLLM: Rust Verification Harness Generation with Large Language Models

Apr 2026 · Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering · 0 citations · 56 references
Computer Science

TL;DR

This paper presents HarnessLLM, an automated workflow that leverages LLMs to generate verification harnesses for Rust code directly from existing test suites and is the first work to use LLMs for generating harnesses aimed at memory safety verification in real-world Rust projects.

Abstract

Rust’s ownership and type system offer strong memory safety guarantees, but unsafe code and runtime panics still present significant risks. Formal verification is essential to ensure memory safety, but developing verification harnesses remains a challenging and manual task. Although large language models (LLMs) have shown strong performance in various code analysis tasks, directly applying them to harness generation often results in inaccurate API invocations, inefficient nondeterministic data generation, and fabricated fixes. In this paper, we present HarnessLLM, an automated workflow that leverages LLMs to generate verification harnesses for Rust code directly from existing test suites. HarnessLLM automatically extracts calling scenarios from test cases, generates nondeterministic arguments based on dependency analysis, and incrementally synthesizes harnesses. It then iteratively refines the harnesses, preserving critical code regions and reporting fabricated types or functions to LLMs for correction. 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. It outperformed the existing approach, Autoharness, which succeeded on only 41% of those scenarios. Finally, 6 real-world memory safety bugs were detected using the generated harnesses, demonstrating the practical utility of our approach in verification. To our knowledge, this is the first work to use LLMs for generating harnesses aimed at memory safety verification in real-world Rust projects.

Read PDF

Similar papers

Open access Oct 2026

Bringing Foundational Verification to Real-World Rust Code

How to extend RefinedRust with several of the high-level abstractions that Rust provides, including traits, closures, and iterators, and in a manner such that they can be used in conjunction with unsafe code.

Lennard Gäher, Vincent Lafeychine, Sascha Kehrli et al. · 0 citations
Jul 2026

Benchmarking LLMs for Verilog Design Flows

A reproducible benchmarking platform that evaluates open-source LLMs on Verilog RTL generation across 50 curated tasks consisting of combinational, sequential, finite state machine (FSM), and mixed designs, enabling reproducible evaluation of generative AI for hardware design workflows.

Angshuman Chakravertty, Rahul Koshti, Buddhi Prakash Sharma et al. · 0 citations
Open access Jul 2026

KaPilot: LLM-Assisted Generation of Kani Specifications for Unsafe Rust Verification

KaPilot is presented, a multi-agent framework for automatically generating specifications to verify unsafe Rust memory safety using Kani, and the shuffle-and-implication strategy is applied to systematically determine the best specification from these candidates.

Ming-Hua Wang, Yu-Xi Ling, Ming-Zhi Gao et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.