arXiv:2606.05680cs.PLcs.AR2026-06中稿 · the IEEE Internati…

用注意力机制引导LLM生成更准确的硬件代码

CASS-RTL: Correctness-Aware Subspace Steering for RTL Generation with LLMs

论文配图:CASS-RTL: Correctness-Aware Subspace Steering for RTL Generation with LLMs
图 1 · 摘自论文原文
  • 通过分析注意力头识别正确与错误硬件代码的差异模式
  • 在低维空间中构建纠错信号子空间,提升生成准确性
  • 无需训练即可部署,适合芯片设计自动化场景

大型语言模型(LLMs)最近在从自然语言指令自动合成寄存器传输级(RTL)代码方面取得进展,为加速芯片设计提供了新路径。与常规自然语言或软件编码任务不同,基于LLM的RTL生成需严格保证时序准确性和并发性,微小逻辑错误可能导致电路无法使用或存在安全隐患。现有方法虽尝试通过外部验证、自评估提示、检索增强提示、领域微调、代理式解决方案和推理来缓解幻觉问题,但大多忽略了LLM内部注意力机制中可能与RTL正确性相关的关键特征。本文提出CASS-RTL,首个发现并利用LLM中与正确性相关组件的框架,以引导生成功能正确的RTL代码。我们(i)识别出激活模式能持续区分正确与错误RTL的注意力头;(ii)构建捕捉正确性相关信号的低维子空间;(iii)设计轻量级、几何感知的推理时干预策略。CASS-RTL完全模型无关,无需额外监督或重训练,可无缝集成至现有模型。实验在多个模型上验证,于VerilogEval上将pass@1/5/10准确率提升10%-20%,在CVDP上提升5%,证明该方法在不牺牲效率且无需大规模标注数据的情况下显著提升可靠性。

原文摘要 · Abstract (English)

Recent advances in large language models (LLMs) have enabled the automatic synthesis (generation) of register-transfer level (RTL) code from natural language instructions, offering a promising pathway to accelerate chip design. Unlike typical natural language (and software coding) tasks, LLM-based RTL code generation demands strict cycle accuracy with concurrency, where minor logical errors can render a circuit unusable or insecure. While prior work has explored hallucination mitigation via external verification, self-evaluation prompts, retrieval-augmented prompting, domain specific fine-tuning, agentic solutions, and reasoning, these approaches largely overlook the attention-oriented internal mechanisms of LLMs that may inherently correlate with RTL correctness. This work proposes CASS-RTL, a first-of-its-kind framework for discovering and leveraging LLMs' correctness-aware components to guide RTL generation toward functionally accurate outputs. We (i) identify attention heads whose activation patterns consistently differentiate correct from incorrect RTL; (ii) construct a low-dimensional subspace capturing correctness-relevant signals; and (iii) design a lightweight, geometry-aware intervention that steers the model at inference time. CASS-RTL is fully model-agnostic, requires no additional supervision or retraining, and readily integrates into existing models. Empirically, we evaluate CASS-RTL on multiple models and observe 10%-20% improvement in pass@1/5/10 accuracy on VerilogEval and 5% improvement on CVDP, demonstrating the effectiveness of our method in enhancing reliability without sacrificing model efficiency or requiring a large labeled dataset for fine-tuning.

硬件生成注意力机制LLM应用芯片设计

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