HDLCoRe: A Training-Free Framework for Mitigating Hallucinations in LLM-Generated HDL

Heng Ping, Shixuan Li, Peiyu Zhang, Anzhe Cheng, Shukai Duan +6 more
3/18/2025
cs.CLcs.AI

No confident code implementation found for this paper.

Abstract

Recent advances in large language models (LLMs) have demonstrated remarkable capabilities in code generation tasks. However, when applied to hardware description languages (HDL), these models exhibit significant limitations due to data scarcity, resulting in hallucinations and incorrect code generation. To address these challenges, we propose HDLCoRe, a training-free framework that enhances LLMs' HDL generation capabilities through prompt engineering techniques and retrieval-augmented generation (RAG). Our approach consists of two main components: (1) an HDL-aware Chain-of-Thought (CoT) prompting technique with self-verification that classifies tasks by complexity and type, incorporates domain-specific knowledge, and guides LLMs through step-by-step self-simulation for error correction; and (2) a two-stage heterogeneous RAG system that addresses formatting inconsistencies through key component extraction and efficiently retrieves relevant HDL examples through sequential filtering and re-ranking. HDLCoRe eliminates the need for model fine-tuning while substantially improving LLMs' HDL generation capabilities. Experimental results demonstrate that our framework achieves superior performance on the RTLLM2.0 benchmark, significantly reducing hallucinations and improving both syntactic and functional correctness.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{ping2025hdlcore,
  title  = {HDLCoRe: A Training-Free Framework for Mitigating Hallucinations in LLM-Generated HDL},
  author = {Heng Ping and Shixuan Li and Peiyu Zhang and Anzhe Cheng and Shukai Duan and Nikos Kanakaris and Xiongye Xiao and Wei Yang and Shahin Nazarian and Andrei Irimia and Paul Bogdan},
  year   = {2025},
  eprint = {2503.16528},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2503.16528v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2503.16528.svg)](https://codeofpaper.com/paper/2503.16528)

Discussion