OSVBench: Benchmarking LLMs on Specification Generation Tasks for Operating System Verification
Shangyu Li, Juyong Jiang, Tiancheng Zhao, Jiasi Shen
TL;DR
OSVBench introduces a long-context, OS-kernel-focused benchmark for generating formal specifications needed for verification, using Hyperkernel as the verification engine. It reframes specification generation as a deterministic program-synthesis task with explicit verification assumptions, fixed declarative specs, and a restricted search space, then evaluates 12 LLMs across 245 syscall tasks with injected bugs. The findings reveal limited and highly variable performance across models, with larger or non-reasoning models not uniformly dominating, and demonstrate that demonstrations (few-shot) and self-repair can improve outcomes but whose gains vary by model. The work highlights substantial gaps in current LLM capabilities for complex, domain-specific verification and provides a dataset and methodology to drive future improvements in long-context, formal-spec generation for OS kernels.
Abstract
We introduce OSVBench, a new benchmark for evaluating Large Language Models (LLMs) on the task of generating complete formal specifications for verifying the functional correctness of operating system kernels. This benchmark is built upon a real-world operating system kernel, Hyperkernel, and consists of 245 complex specification generation tasks in total, each of which is a long-context task of about 20k-30k tokens. The benchmark formulates the specification generation task as a program synthesis problem confined to a domain for specifying states and transitions. This formulation is provided to LLMs through a programming model. The LLMs must be able to understand the programming model and verification assumptions before delineating the correct search space for syntax and semantics and generating formal specifications. Guided by the operating system's high-level functional description, the LLMs are asked to generate a specification that fully describes all correct states and transitions for a potentially buggy code implementation of the operating system. Experimental results with 12 state-of-the-art LLMs indicate limited performance of existing LLMs on the specification generation task for operating system verification. Significant disparities in their performance highlight differences in their ability to handle long-context code generation tasks. The code are available at https://github.com/lishangyu-hkust/OSVBench
