FirmwareGym

FirmwareGym challenges AI agents to build firmware with the h5i framework, prove its behavior in Lean 4, and optimize performance on virtual hardware in Renode.

Technical illustration of a warehouse rover and a sensor circuit board

Can AI build and formally verify firmware?

Tasks

FirmwareGym spans five difficulty levels. Tasks include coordinating warehouse robots, fusing noisy or faulty sensor readings, controlling motors and batteries, scheduling real-time jobs, and storing data on NOR flash.

  • Prove implementation correctness. Use Lean 4 to prove task-specific properties such as collision-free robot deliveries or recovery of an entire transaction after a power cut.
  • Optimize performance. Run the compiled firmware through Renode scenarios. Use the raw CPU instruction counts, binary size, RAM usage, and peak stack measurements to guide optimization or define a custom reward. The default reward uses task-specific resource budgets.
Rust firmware candidate
Formally verify properties Lean 4 checks proofs against the specification.
Optimize performance Renode runs scenarios and returns CPU and memory metrics.

Public Baseline

Final evaluation pass rates by domain. Each cell shows the percentage and the number of tasks passed out of those attempted.

Model Control, power & safety Storage Communication Sensor fusion Scheduling & virtual machines Robot coordination Overall
Claude Opus 5.5 100% 7 / 7 50% 1 / 2 33% 1 / 3 50% 1 / 2 33% 1 / 3 0% 0 / 1 61% 11 / 18

One agent run per task, with up to 30 minutes and iterative development feedback. The final grader required successful compilation, all Lean obligations and Renode scenarios, any applicable randomized checks, and all resource budgets.

Get started

The Python SDK, API specification, and sample tasks are available under Apache 2.0. The hosted evaluator and full task catalog require an API key from your operator. Hosted development feedback and final benchmark evaluation are run separately.

Python SDK

Fetch tasks, submit Rust and Lean, and use raw evaluation metrics to define custom rewards.

Quickstart

Run a firmware evaluation and compute a custom reward.