评测大模型从自然语言生成硬件状态机代码的能力,发现模型随复杂度上升表现骤降。
LLM-FSM: Scaling Large Language Models for Finite-State Reasoning in RTL Code Generation
- 构建自动化基准,自动生成带状态机的硬件代码任务
- 1000个任务中强模型在复杂状态机上准确率显著下降
- 适合研究硬件生成与大模型推理能力的学者
有限状态推理是硬件设计的核心能力。本文提出LLM-FSM,一个评估大语言模型(LLMs)从自然语言规范恢复有限状态机(FSM)行为并转换为正确寄存器传输级(RTL)实现的基准。不同于依赖人工构造样本的先前基准,LLM-FSM通过完全自动化的流程构建:先生成可配置状态数和约束转移结构的FSM;再引导LLM将每个FSM以结构化YAML格式表达并转化为自然语言描述;同时从同一YAML自动生成正确构造的参考RTL与测试平台。所有1000个问题均通过基于LLM和SAT求解器的验证,部分经人工复核。实验表明,即使最强的模型在状态机复杂度增加时准确率也急剧下降。进一步证明,训练时通过监督微调(SFT)提升规模能有效泛化到分布外(OOD)任务,而增加推理时计算量可提高推理可靠性。该基准可随未来模型能力扩展状态复杂度,保持可扩展性。
原文摘要 · Abstract (English)
Finite-state reasoning, the ability to understand and implement state-dependent behavior, is central to hardware design. In this paper, we present LLM-FSM, a benchmark that evaluates how well large language models (LLMs) can recover finite-state machine (FSM) behavior from natural-language specifications and translate it into correct register transfer-level (RTL) implementations. Unlike prior specification-to-RTL benchmarks that rely on manually constructed examples, LLM-FSM is built through a fully automated pipeline. LLM-FSM first constructs FSM with configurable state counts and constrained transition structures. It then prompts LLMs to express each FSM in a structured YAML format with an application context, and to further convert that YAML into a natural-language (NL) specification. From the same YAML, our pipeline synthesizes the reference RTL and testbench in a correct-by-construction manner. All 1,000 problems are verified using LLM-based and SAT-solver-based checks, with human review on a subset. Our experiments show that even the strongest LLMs exhibit sharply declining accuracy as FSM complexity increases. We further demonstrate that training-time scaling via supervised fine-tuning (SFT) generalizes effectively to out-of-distribution (OOD) tasks, while increasing test-time compute improves reasoning reliability. Finally, LLM-FSM remains extensible by allowing its FSM complexity to scale with future model capabilities.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。