Table of Contents
Fetching ...

MeltRTL: Multi-Expert LLMs with Inference-time Intervention for RTL Code Generation

Nowfel Mashnoor, Mohammad Akyash, Hadi Kamali, Kimia Azar

TL;DR

MeltRTL tackles the core challenge of generating correct RTL code with LLMs by applying probe-guided multi-expert attention and inference-time intervention to steer internal representations without retraining. It trains lightweight probes on attention activations to identify correctness-critical heads and uses ensemble decisions to selectively steer those heads during decoding, enabling domain-aware expertise across combinational, sequential, and FSM designs. The approach yields significant gains on the VerilogEval benchmark, achieving up to 96% synthesizability and 60% functional correctness with only modest computational overhead, underscoring the practicality of train-free, representation-level control for hardware design tasks. This work introduces a new paradigm where internal model dynamics are steered at inference time to enforce semantic fidelity in RTL generation, complementing existing fine-tuning, retrieval, and tool-assisted methods.

Abstract

The automated generation of hardware register-transfer level (RTL) code with large language models (LLMs) shows promise, yet current solutions struggle to produce syntactically and functionally correct code for complex digital designs. This paper introduces MeltRTL, a novel framework that integrates multi-expert attention with inference-time intervention (ITI) to significantly improve LLM-based RTL code generation accuracy without retraining the base model. MeltRTL introduces three key innovations: (1) A multi-expert attention architecture that dynamically routes design specifications to specialized expert networks, enabling targeted reasoning across various hardware categories; (2) An inference-time intervention mechanism that employs non-linear probes to detect and correct hardware-specific inaccuracies during generation; and (3) An efficient intervention framework that selectively operates on expert-specific attention heads with minimal computational overhead. We evaluate MeltRTL on the VerilogEval benchmark, achieving 96% synthesizability and 60% functional correctness, compared to the base LLM's 85.3% and 45.3%, respectively. These improvements are obtained entirely at inference time, with only 27% computational overhead and no model fine-tuning, making MeltRTL immediately deployable on existing pre-trained LLMs. Ablation studies further show the complementary benefits of multi-expert architecture and ITI, highlighting their synergistic effects when combined.

MeltRTL: Multi-Expert LLMs with Inference-time Intervention for RTL Code Generation

TL;DR

MeltRTL tackles the core challenge of generating correct RTL code with LLMs by applying probe-guided multi-expert attention and inference-time intervention to steer internal representations without retraining. It trains lightweight probes on attention activations to identify correctness-critical heads and uses ensemble decisions to selectively steer those heads during decoding, enabling domain-aware expertise across combinational, sequential, and FSM designs. The approach yields significant gains on the VerilogEval benchmark, achieving up to 96% synthesizability and 60% functional correctness with only modest computational overhead, underscoring the practicality of train-free, representation-level control for hardware design tasks. This work introduces a new paradigm where internal model dynamics are steered at inference time to enforce semantic fidelity in RTL generation, complementing existing fine-tuning, retrieval, and tool-assisted methods.

Abstract

The automated generation of hardware register-transfer level (RTL) code with large language models (LLMs) shows promise, yet current solutions struggle to produce syntactically and functionally correct code for complex digital designs. This paper introduces MeltRTL, a novel framework that integrates multi-expert attention with inference-time intervention (ITI) to significantly improve LLM-based RTL code generation accuracy without retraining the base model. MeltRTL introduces three key innovations: (1) A multi-expert attention architecture that dynamically routes design specifications to specialized expert networks, enabling targeted reasoning across various hardware categories; (2) An inference-time intervention mechanism that employs non-linear probes to detect and correct hardware-specific inaccuracies during generation; and (3) An efficient intervention framework that selectively operates on expert-specific attention heads with minimal computational overhead. We evaluate MeltRTL on the VerilogEval benchmark, achieving 96% synthesizability and 60% functional correctness, compared to the base LLM's 85.3% and 45.3%, respectively. These improvements are obtained entirely at inference time, with only 27% computational overhead and no model fine-tuning, making MeltRTL immediately deployable on existing pre-trained LLMs. Ablation studies further show the complementary benefits of multi-expert architecture and ITI, highlighting their synergistic effects when combined.
Paper Structure (19 sections, 9 equations, 5 figures, 7 tables)

This paper contains 19 sections, 9 equations, 5 figures, 7 tables.

Figures (5)

  • Figure 1: Overall framework of MeltRTL, consisting of three stages: (i) dataset collection, (ii) detection of heads relevant to functional correctness, and (iii) LLM steering via modification of the identified heads.
  • Figure 2: Heatmaps of Correctness-Critical Attention Heads Selection Across Design Classes. Brighter regions indicate heads more strongly correlated with functional correctness, revealing that distinct subsets of heads specialize by design category
  • Figure 3: Distribution of Activation Vector Norms for Correct vs. Incorrect Predictions (for L2 Norm of Attention-Head Activations). The variation in norm ranges highlights how different probe architectures capture correctness-related signals with distinct sensitivity and scaling.
  • Figure 4: Activation Shifts Across All Classifiers for Expert Tasks. Combinational designs show the clearest separation with distinct centroids, FSMs exhibit significant overlap, and sequential logic falls in between, reflecting the varying difficulty of correctness alignment across design categories.
  • Figure 5: Intervention strength ($\alpha$) vs. correctness; peak near $K{=}15$, $\alpha{\approx}3.0$.