VeriGRAG: Enhancing LLM-Based Verilog Code Generation with Structure-Aware Soft Prompts
cs.AR, cs.AI, cs.PL
Submitted: 2025-09-27
Updated: 2026-10-17
Comments: 8 pages, 6 figures. Accepted at ASP-DAC 2027; updated to the camera-ready version
License: http://creativecommons.org/licenses/by/4.0/
The gist: Large language models (LLMs) have demonstrated remarkable capabilities in generating Verilog code from natural language descriptions.
Terminology
Abstract
Large language models (LLMs) have demonstrated remarkable capabilities in generating Verilog code from natural language descriptions. However, Verilog code inherently encodes the structural characteristics of hardware circuits, including data path organization and interconnections among components. Effectively leveraging these structural characteristics to enhance the functional and syntactic correctness of LLM-based Verilog code generation remains a significant challenge. To address this challenge, we propose VeriGRAG, a novel framework that converts Verilog code into data path graphs and employs graph neural networks (GNNs) to encode their structural information. A multimodal retriever, trained through knowledge distillation from a cross-attention encoder to a dual encoder, then selects the graph embeddings most relevant to the input hardware description. The VeriFormer module uses learnable query tokens and two-stage training to extract code-relevant structural features and align them with the LLM's input embedding space, producing structure-aware soft prompts. Experiments on VerilogEval and RTLLM show improvements in both syntactic and functional correctness. With Qwen2.5-Coder-32B as its backbone, VeriGRAG achieves the highest functional pass@1 and pass@5 scores among the compared methods on both benchmarks.
Related papers
- WitCert: Sound Runtime Risk Observability and Gating for KV-Cache Quantization
- Golden Ruler: A Numeric Format Catalog with Bit-Exact Conformance Vectors for FP8, BF16, MXFP4, and Microscaling Formats
- RFChipAgent: Multi-Agentic AI Flow for Analog/RF Chip Design
- PoisonCap: Efficient Hierarchical Temporal Safety for CHERI
- Provisioning to Runtime Optimization of a 100 MW-Scale AI Cluster
- Bit-Accurate Modeling of GPU Matrix Multiply-Accumulate Units: Demystifying Numerical Discrepancy and Accuracy