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

📄 arXiv: 2606.05680v1 📥 PDF

作者: Mohammad Akyash, Nowfel Mashnoor, Kimia Azar, Hadi Kamali

分类: cs.PL, cs.AR, cs.LG

发布日期: 2026-06-04

备注: Accepted to the IEEE International Conference on LLM-Aided Design (LAD '26)


💡 一句话要点

提出CASS-RTL以解决RTL生成中的正确性问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 RTL生成 芯片设计 逻辑错误 注意力机制 自动化设计 硬件描述语言

📋 核心要点

  1. 现有方法在RTL代码生成中未能有效解决逻辑错误和正确性问题,导致生成的电路可能不可靠。
  2. CASS-RTL框架通过识别LLM中的注意力头和构建低维子空间,利用正确性相关信号引导RTL生成。
  3. 在VerilogEval和CVDP上进行的实验表明,CASS-RTL在准确率上提升了10%-20%,有效增强了模型的可靠性。

📝 摘要(中文)

近年来,大型语言模型(LLMs)的进步使得从自然语言指令自动合成寄存器传输级(RTL)代码成为可能,这为加速芯片设计提供了有希望的途径。然而,与典型的自然语言处理任务不同,基于LLM的RTL代码生成要求严格的周期准确性和并发性,微小的逻辑错误可能导致电路无法使用或不安全。本文提出了CASS-RTL框架,首次发现并利用LLM的正确性感知组件,引导RTL生成朝着功能准确的输出。我们通过识别注意力头、构建低维子空间以及设计轻量级几何感知干预,显著提高了RTL生成的可靠性。实验证明,CASS-RTL在多个模型上实现了10%-20%的准确率提升。

🔬 方法详解

问题定义:本文旨在解决基于LLM的RTL代码生成中的逻辑错误和正确性问题。现有方法主要关注外部验证和提示优化,但未能充分利用LLM内部的注意力机制。

核心思路:CASS-RTL框架通过识别和利用LLM中与正确性相关的注意力头,构建低维子空间,以引导模型生成更准确的RTL代码。这样的设计能够有效捕捉与正确性相关的信号,提升生成结果的可靠性。

技术框架:CASS-RTL的整体架构包括三个主要模块:首先,识别出能够区分正确与错误RTL的注意力头;其次,构建一个低维子空间以捕捉相关信号;最后,设计几何感知的干预机制,在推理时引导模型输出。

关键创新:CASS-RTL的最大创新在于首次将注意力机制与RTL生成的正确性关联起来,提供了一种新的思路来提升生成代码的准确性。这与传统方法的根本区别在于,后者往往忽视了内部机制的作用。

关键设计:在设计中,CASS-RTL不需要额外的监督或重训练,能够无缝集成到现有模型中。其干预机制轻量且高效,确保在不牺牲模型效率的情况下,提升生成结果的可靠性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

CASS-RTL在多个模型上的实验结果显示,VerilogEval的准确率提升了10%-20%,而在CVDP上也实现了5%的提升。这些结果表明,该方法在增强生成代码的可靠性方面具有显著效果,同时保持了模型的高效性。

🎯 应用场景

CASS-RTL框架在芯片设计、硬件描述语言生成等领域具有广泛的应用潜力。通过提高RTL代码生成的准确性,该方法可以加速芯片开发周期,降低设计错误风险,提升最终产品的安全性和可靠性。未来,该技术可能推动更智能的自动化设计工具的发展,进一步优化硬件设计流程。

📄 摘要(原文)

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.