REFORGE: LLM-Assisted RTL Bug Repair with Structured Context and Verification Feedback

Tanvir Hossain, Sudipta Paria, Aidan Gleason Myers, Swarup Bhunia, Tamzidul HoquearXiv 2026

TL;DR

Asking an LLM to fix a hardware bug is easy; trusting that fix before etching it into silicon is the hard part. Most AI hardware-repair tools declare victory the moment a patch passes a basic simulation test, potentially hiding broken corner cases, security holes, or bloated chip layouts. REFORGE introduces a multi-stage verification gauntlet that forces LLM-generated hardware fixes to prove they actually work, preserve existing behavior, stay secure, and meet physical cost budgets—all while keeping a detailed receipt of the evidence.

What Problem Does This Paper Address?

In chip design, engineers write code at the Register-Transfer Level (RTL)—essentially blueprints describing how digital signals move between registers and logic gates. Verification consumes roughly half of a chip project's effort because bugs in silicon can't simply be patched over the air.

Recently, researchers have used LLMs to automatically repair buggy RTL. Typically, these systems report a single "repair rate": the percentage of patches that compile and pass a testbench simulation. The catch? Passing a simulation is a low bar. A patch might fix the target bug while quietly breaking an untested corner case, opening a security vulnerability (like leaving a cryptographic lock writable), or blowing up the chip's Power, Performance, and Area (PPA)—its physical footprint, speed, and energy budget. Furthermore, if you ask an LLM for five alternative fixes so you can pick the most efficient one, it might give you five differently worded files that compile down to the exact same circuit. Without tracking separate evidence for functionality, security, and physical implementation, AI-repaired hardware isn't ready for real engineering workflows.

Methods

REFORGE separates proposing fixes from accepting and selecting them in an iterative generate–check–refine loop (tested across Codex/GPT-5.5, Claude Sonnet, and Grok-4.6):

The REFORGE five-stage repair, verification, and diversity-selection pipeline.
  1. Profiling & Localization: Standard simulation and synthesis tools scan the buggy RTL to map out its structural anatomy (clocks, state machines, security assets) and pinpoint the likely bug region using statistical fault localization (Ochiai scoring).
  2. Structured Variant Generation: Instead of repeatedly asking "fix this" and getting identical answers, REFORGE nudges the LLM along distinct transformation axes (e.g., control logic vs. datapath). In Round 1, it maximizes variety; in later rounds, it uses Thompson sampling (a classic explore-vs.-exploit algorithm) to favor strategies that progressed furthest in earlier checks, feeding back formal counterexamples and failure diagnoses.
  3. Four-Part Verification Gate: Every candidate faces four independent checks using open-source and commercial chip-design tools:
  4. Repair: Simulation plus Bounded Model Checking (mathematically proving the fix matches a golden reference up to $k$ clock cycles).
  5. Preservation: Ensuring previously working behavior outside the bug trigger remains intact.
  6. Security: Static checks, formal assertions, and information-flow tracking to ensure vulnerabilities aren't merely hidden or moved elsewhere.
  7. Cost: Synthesizing the circuit to check if area, delay, and power stay within 20% of a reference budget.
  8. Multi-View Selection: Rather than just comparing source text, REFORGE measures diversity across five views—lexical text, syntax trees, synthesized gate-level netlists, switching activity, and PPA cost—to retain genuinely distinct verified designs.

Datasets

The authors evaluated REFORGE across three complementary benchmarks (no training was performed):

  • CirFix: 21 seeded functional RTL bugs from an established academic benchmark.
  • Hack@DAC OpenTitan: 1 real-world register-arbiter bug extracted from the open-source OpenTitan silicon-root-of-trust chip.
  • Hardware-CWE Suite (Newly Introduced): 10 hand-written RTL modules containing security weaknesses based on MITRE’s Common Weakness Enumeration (CWE), paired with custom security detectors (9 of which are covered by automated detectors).

Key Insights and Ideas

  • "Passing the testbench" massively inflates success: Relying solely on functional simulation reports 3.9× more repairs than when requiring full equivalence, security, and physical cost checks. Single-number repair rates mask huge gaps in verification depth.
  • Different code $\neq$ different hardware: When auditing 408 pairs of LLM repairs that looked different in code but synthesized to identical PPA numbers, mathematical equivalence checking proved every single pair implemented the exact same circuit. Counting textually different files overstates true hardware diversity.
  • Feedback helps fix bugs, but narrows creativity: Feeding error diagnoses back to the LLM helps it get unstuck, increasing the odds of finding at least one valid fix. However, that specific feedback also funnels subsequent attempts toward the exact same solution, reducing the diversity of the final candidate pool.
  • Security fixes aren't automatically functional fixes: Candidates in the CWE suite passed differential security scans, yet lacked sufficient functional testbench coverage to prove behavioral preservation—showing why security and functional verdicts must be tracked separately.

Key Results

Across 288 primary runs (plus 20 perturbation controls) yielding 629 selected variants:

  • Context & Diagnosis Boost Delivery: On CirFix, bare prompting delivered at least one checked repair in 32/63 runs (21 bugs $\times$ 3 LLMs). Adding structural context raised this to 45/63, and adding iterative failure diagnosis pushed it to 51/63. All configurations repaired the Hack@DAC bug.
Fig. 3. CirFix repair outcomes by backend and prompt configuration. (a) Runs producing at least one checked repair; (b) runs reaching the full five-candidate target. Context and feedback increase checked repair delivery, although five- variant target attainment is not monotonic.
  • Evidence Breakdown: Of 430 functionally checked selections, 140 achieved unbounded mathematical verification, while 290 were verified up to a bounded cycle depth ($k \le 20$). On CirFix, 236 variants met the 20% PPA cost budget while 81 blew past it.
  • Prompt Caching Matters: Interfaces with prompt caching (Codex, Sonnet) finished CirFix campaigns in 1.7–4.1 hours, whereas Grok's uncached CLI reprocessed context every round, taking 5.5–11.4 hours and up to 4.06M tokens.

Limitations and Future Work

  • Known Security Rules Only: REFORGE catches known MITRE CWE patterns defined via rules, assertions, and taint tracking, meaning novel or unmodeled vulnerability classes can slip through. Future work aims to automatically detect and localize unknown vulnerabilities.
  • Proxy Similarity vs. Exact Equivalence: Heuristic netlist similarity didn't catch all functionally identical circuits. Future versions should group final candidates using exact SAT-based equivalence checking rather than relying solely on structural proxies.
  • Compute Overhead: Iterative CLI calls and repeated synthesis/formal runs are expensive; caching prompt prefixes and reusing verification artifacts across rounds are prime targets for optimization.

Summary updated

Abstract

Large language models (LLMs) can write and repair RTL, but successful compilation or testbench execution does not establish defect removal, behavioral preservation, security, or implementation feasibility. Existing LLM-based RTL repair methods often report a single repair rate without retaining separate evidence for these properties, limiting reproducible comparison and integration into hardware design flows. We present REFORGE, which, to our knowledge, is the first LLM-assisted RTL repair framework that maintains and accumulates structured repair evidence across iterations, allowing it to generate fixes that satisfy multiple objectives simultaneously, including functionality, behavioral equivalence, security, and cost efficiency. REFORGE profiles buggy RTL, identifies structural and security-relevant features, localizes failing behavior, and uses verification-guided diagnosis to generate complete RTL repair variants. Each variant undergoes syntax checking, simulation, formal analysis, off-trigger preservation, security re-scan, and synthesis-based power, performance, and area analysis. We implement REFORGE as a backend-independent repair-and-verification flow and evaluate it in 288 runs across three LLM backends and three benchmark suites. On CirFix, the proposed context and diagnosis increase runs delivering a checked repair from 32/63 to 51/63, while every configuration repairs the Hack@DAC OpenTitan defect. Evidence records also show that a testbench-only criterion reports 3.9 times more repairs than the full set of applicable checks, security-clean outputs may lack functional verification, and different RTL repairs can implement equivalent hardware. These results show that LLM-generated RTL repairs require explicit multi-stage verification evidence rather than a single pass/fail outcome.
BibTeX
@misc{hossain2026reforge,
  author = {Tanvir Hossain and Sudipta Paria and Aidan Gleason Myers and Swarup Bhunia and Tamzidul Hoque},
  title = {{REFORGE: LLM-Assisted RTL Bug Repair with Structured Context and Verification Feedback}},
  year = {2026},
  eprint = {2611.33748},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.33748},
}
Figure