Large language models (LLMs) have shown remarkable capabilities in natural language processing tasks, yet their application in hardware security verification remains limited due to scarcity of publicly available hardware description language (HDL) datasets. This knowledge gap constrains LLM performance in detecting vulnerabilities within HDL designs. To address this challenge, we propose SecureRAG-RTL, a novel Retrieval-Augmented Generation (RAG)-based approach that significantly enhances LLM-based security verification of hardware designs. Our approach integrates domain-specific retrieval with generative reasoning, enabling models to overcome inherent limitations in hardware security expertise. We establish baseline vulnerability detection rates using prompt-only methods and then demonstrate that SecureRAG-RTL achieves substantial improvements across diverse LLM architectures, regardless of size. On average, our method increases detection accuracy by about 30%, highlighting its effectiveness in bridging domain knowledge gaps. For evaluation, we curated and annotated a benchmark dataset of 14 HDL designs containing real-world security vulnerabilities, which we will release publicly to support future research. These findings underscore the potential of RAG-driven augmentation to enable scalable, efficient, and accurate hardware security verification workflows.
Figures & tables
Model
Vulnerability Number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Code Llama 7B It [ 15 ]
✗
✓
✗
✗
✓
✗
✓
✗
✗
✗
✓
✗
✗
✗
StarCoder 2 7B [ 16 ]
✓
✗
✗
✗
✗
✗
✓
✓
✗
✗
✗
✗
✓
✗
DeepSeek-Coder 6.7B It [ 17 ]
✗
✗
✗
✓
✗
✓
✓
✗
✓
✗
✗
✗
✗
✗
GPT-4o [ 18 ]
✓
✓
✗
✓
✗
✓
✗
✗
✗
✓
✓
✓
✗
✗
Gemini 2.5 Pro [ 19 ]
✓
✓
✗
✓
✗
✓
✗
✓
✗
✗
✓
✓
✗
✗
TABLE I: Zero-shot prompting to detect vulnerabilities.
Fig. 1: The proposed SecureRAG-RTL pipeline for hardware vulnerability detection.
Fig. 2: Detection Agent Prompt.
Fig. 3: Detection agent responses when CWE is not found.
Fig. 4: Detection agent responses when a CWE is found.
Category
Models Experimented
T1
T5
T10
Small Models
DeepSeek-R1-Distill-Qwen 1.5B
0
2
3
Qwen 2.5 Coder 3B Instruct
1
3
4
Falcon 3 3B Instruct
2
2
6
Granite 4.0 Micro 3B
2
4
6
Phi 3 Mini 3.8B Instruct
1
2
4
Gemma 3 4B Instruct
2
4
7
TABLE II: Retrieval phase evaluation of different models.
Model
Vulnerability Number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
DeepSeek-R1-D-Q 1.5B
0/0
11/24
3/5
59/71
4/5
14/14
0/0
16/18
0/3
0/0
9/11
1/10
7/15
0/0
Qwen 2.5 Coder 3B It
4/54
0/2
54/60
9/38
59/68
0/9
62/65
9/58
11/14
2/3
15/68
0/0
7/9
0/1
Falcon 3 3B It
54/55
0/61
0/0
0/1
3/10
67/73
9/31
14/15
16/31
9/9
5/10
0/1
0/51
0/0
Granite 4.0 Micro 4B
60/67
48/53
0/2
7/10
5/32
13/13
12/12
0/45
2/3
9/59
1/1
7/62
12/13
0/4
Phi 3 Mini 3.8B It
1/2
0/0
13/28
69/81
0/8
7/10
10/79
11/12
0/0
8/12
4/5
1/1
9/13
0/5
TABLE III: A comparative visualization of the ROUGE-L scores (in %) before and after incorporating SecureRAG-RTL.
Models Experimented
Accuracy (Before)
Accuracy (After)
Increase
DeepSeek-R1-D-Qwen 1.5B
7.14%
21.43%
14.29%
Qwen 2.5 Coder 3B It
21.43%
50.00%
28.57%
Falcon 3 3B It
14.29%
42.86%
28.57%
Granite 4.0 Micro 3B
14.29%
42.86%
28.57%
Phi 3 Mini 3.8B It
7.14%
21.43%
14.29%
Gemma 3 4B It
21.43%
64.29%
42.86%
TABLE IV: Comparison of detection accuracy before and after implementing SecureRAG-RTL.
The integration of Large Language Models (LLMs) into Electronic Design Automation (EDA) and hardware security is rapidly reshaping the semiconductor industry. While LLMs offer unprecedented capabilities in generating Register Transfer Level (RTL) code, automating testbenches, and bridging the semantic gap between high-level specifications and silicon, they simultaneously introduce severe vulnerabilities. This comprehensive review provides an in-depth analysis of the state-of-the-art in LLM-driven hardware design, organized around key advancements in EDA synthesis, hardware trust, design for security, and education. We systematically expand on the methodologies of recent breakthroughs -- from reasoning-driven synthesis and multi-agent vulnerability extraction to data contamination and adversarial machine learning (ML) evasion. We integrate general discussions on critical countermeasures, such as dynamic benchmarking to combat data memorization and aggressive red-teaming for robust security assessment. Finally, we synthesize cross-cutting lessons learned to guide future research toward secure, trustworthy, and autonomous design ecosystems.
Johann Knechtel, Ozgur Sinanoglu, Ramesh Karri
New York University Abu Dhabi · NYU Tandon School of Engineering
Large language models (LLMs) are increasingly used for hardware and firmware code generation, but existing studies primarily evaluate functional correctness while largely overlooking security. However, LLM-generated code that appears functionally sound may embed security flaws which could induce catastrophic damages after deployment. This critical research gap motivates us to design a benchmark for assessing security awareness under realistic specifications. In this work, we introduce HardSecBench, a benchmark with 924 tasks spanning Verilog Register Transfer Level (RTL) and firmware-level C, covering 76 hardware-relevant Common Weakness Enumeration (CWE) entries. Each task includes a structured specification, a secure reference implementation, and executable tests. To automate artifact synthesis, we propose a multi-agent pipeline that decouples synthesis from verification and grounds evaluation in execution evidence, enabling reliable evaluation. We evaluate diverse LLMs and find that they often satisfy functional requirements while leaving security risks. We also find that security results vary with prompting. These findings highlight pressing challenges and offer actionable insights for future advancements in LLM-assisted hardware design. Our data and code are available at https://github.com/chenqirui2002/HardSecBench.
Qirui Chen, Jingxian Shuai, Shuangwu Chen +8
University of Science and Technology of China, China · Xi’an Jiaotong University, China · Nanjing University, China +1
Existing benchmarks for hardware design primarily evaluate Large Language Models (LLMs) on isolated, component-level tasks such as generating HDL modules from specifications, leaving repository-scale evaluation unaddressed. We introduce HWE-Bench, the first large-scale, repository-level benchmark for evaluating LLM agents on real-world hardware bug repair tasks. HWE-Bench comprises 417 task instances derived from real historical bug-fix pull requests across six major open-source projects spanning both Verilog/SystemVerilog and Chisel, covering RISC-V cores, SoCs, and security roots-of-trust. Each task is grounded in a fully containerized environment where the agent must resolve a real bug report, with correctness validated through the project's native simulation and regression flows. The benchmark is built through a largely automated pipeline that enables efficient expansion to new repositories. We evaluate seven LLMs with four agent frameworks and find that the best agent resolves 70.7% of tasks overall, with performance exceeding 90% on smaller cores but dropping below 65% on complex SoC-level projects. We observe larger performance gaps across models than commonly reported on software benchmarks, and difficulty is driven by project scope and bug-type distribution rather than code size alone. Our failure analysis traces agent failures to three stages of the debugging process: fault localization, hardware-semantic reasoning, and cross-artifact coordination across RTL, configuration, and verification components, providing concrete directions for developing more capable hardware-aware agents.