CASS-RTL:面向LLM的RTL生成的正确性感知子空间引导
CASS-RTL: Correctness-Aware Subspace Steering for RTL Generation with LLMs
AI总结:
提出CASS-RTL框架,通过识别LLM中与RTL正确性相关的注意力头并构建低维子空间进行轻量级干预,在无需额外监督或重训练的情况下提升RTL代码生成的功能准确性。
摘要:
近期大型语言模型(LLM)的进展使得从自然语言指令自动综合(生成)寄存器传输级(RTL)代码成为可能,为加速芯片设计提供了有前景的途径。与典型的自然语言(及软件编码)任务不同,基于LLM的RTL代码生成要求严格的周期准确性和并发性,微小的逻辑错误可能导致电路无法使用或不安全。尽管先前的工作通过外部验证、自我评估提示、检索增强提示、领域特定微调、智能体解决方案和推理来探索幻觉缓解,但这些方法大多忽视了LLM中可能固有地与RTL正确性相关的注意力导向内部机制。本文提出CASS-RTL,这是首个发现并利用LLM的正确性感知组件来引导RTL生成朝向功能准确输出的框架。我们(i)识别注意力头,其激活模式一致地区分正确与不正确的RTL;(ii)构建一个低维子空间以捕获正确性相关信号;(iii)设计一种轻量级的、几何感知的干预,在推理时引导模型。CASS-RTL完全与模型无关,无需额外监督或重训练,并易于集成到现有模型中。实验上,我们在多个模型上评估CASS-RTL,观察到在VerilogEval上pass@1/5/10准确率提升10%-20%,在CVDP上提升5%,证明了我们的方法在增强可靠性方面的有效性,同时不牺牲模型效率或需要大型标注数据集进行微调。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。