arXiv:2505.15701cs.ARcs.CL2025-05被引 1

用图数据库提升LLM对硬件描述语言的检索与生成能力

HDLxGraph: Bridging Large Language Models and HDL Repositories via HDL Graph Databases

  • 将HDL代码的语法树和数据流图融合进检索增强生成框架
  • 在搜索、调试和补全任务上分别提升12.04%、12.22%、5.04%
  • 适用于芯片设计领域的开发者与LLM研究者

检索增强生成(RAG)是辅助大型语言模型(LLM)完成硬件描述语言(HDL)任务的关键技术,能缓解训练数据有限和提示过长的问题。然而,现有RAG在处理模糊查询以及包含数千甚至数万行代码的真实仓库级项目时表现不佳。我们分析发现,传统基于语义相似度的RAG与HDL代码之间存在结构和词汇两方面根本性不匹配。为此,我们提出HDLxGraph,首个将HDL固有图结构与RAG结合的框架。具体地,HDLxGraph引入抽象语法树(ASTs)捕捉HDL的层次结构,并使用数据流图(DFGs)解决词汇不匹配问题。此外,为弥补缺乏全面的HDL搜索基准,我们构建了HDLSearch——一个基于真实仓库级HDL项目的LLM生成数据集。评估显示,HDLxGraph在搜索、调试和补全任务上分别比当前最优的语义相似度RAG和软件代码图RAG基线提升12.04%/12.22%/5.04%和11.59%/8.18%/4.07%。HDLxGraph与HDLSearch的代码已开源。

原文摘要 · Abstract (English)

Retrieval Augmented Generation (RAG) is an essential agent for Large Language Model (LLM) aided Description Language (HDL) tasks, addressing the challenges of limited training data and prohibitively long prompts. However, its performance in handling ambiguous queries and real-world, repository-level HDL projects containing thousands or even tens of thousands of code lines remains limited. Our analysis demonstrates two fundamental mismatches, structural and vocabulary, between conventional semantic similarity-based RAGs and HDL codes. To this end, we propose HDLxGraph, the first framework that integrates the inherent graph characteristics of HDLs with RAGs for LLM-assisted tasks. Specifically, HDLxGraph incorporates Abstract Syntax Trees (ASTs) to capture HDLs' hierarchical structures and Data Flow Graphs (DFGs) to address the vocabulary mismatch. In addition, to overcome the lack of comprehensive HDL search benchmarks, we introduce HDLSearch, an LLM generated dataset derived from real-world, repository-level HDL projects. Evaluations show that HDLxGraph improves search, debugging, and completion accuracy by 12.04%/12.22%/5.04% and by 11.59%/8.18%/4.07% over state-of-the-art similarity-based RAG and software-code Graph RAG baselines, respectively. The code of HDLxGraph and HDLSearch benchmark are available at https://github.com/UMN-ZhaoLab/HDLxGraph.

HDL图神经网络LLM代码生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。