EARL: Entropy-Aware RL Alignment of LLMs for Reliable RTL Code Generation

Jiahe Shi, Zhengqi Gao, Ching-Yun Ko, Duane S. BoningarXiv 2025 · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable proficiency in software engineering, yet generating Register-Transfer Level (RTL) code—the bedrock of digital hardware design—remains a significant challenge. Unlike general-purpose programming, hardware description languages like Verilog are exceptionally unforgiving; minor syntax errors or subtle timing misunderstandings can render a design useless.

While Supervised Fine-Tuning (SFT) allows models to mimic existing code, it lacks the mechanism to learn from functional failures. Reinforcement Learning with Verifiable Rewards (RLVR) addresses this by incorporating compiler and simulator feedback. However, standard RLVR treats every token in a file as equally important. In RTL, much of the code consists of deterministic boilerplate (e.g., port declarations). Spreading learning signals across these low-uncertainty tokens dilutes the "gradient budget," hindering the model's ability to master the complex logic that defines hardware functionality.

The EARL Framework

Researchers from MIT and IBM propose EARL (Entropy-Aware Reinforcement Learning), a framework designed to focus the learning process on critical decision points. EARL introduces two primary innovations to the RL pipeline for hardware generation:

1. Entropy-Guided Selective Updates

By analyzing the entropy of RTL generation, the team discovered a highly skewed distribution. Most tokens are generated with near-zero uncertainty. EARL utilizes a "quantile mask" (typically set at the 80th percentile) to gate policy gradients. This ensures that the model only updates its weights based on tokens where it was uncertain—the true "decision points" such as if statements, always blocks, or specific signal assignments.

Figure 1: Entropy distribution of RTL generation tokens, highlighting the 80th and 90th percentile thresholds used for selective updates.

2. Hierarchical Verifiable Rewards

Rather than a binary pass/fail metric, EARL employs a three-stage reward hierarchy that mirrors industrial verification workflows:

  • Syntax Check: Verification of compilation via iverilog.
  • Interface Check: Ensuring module names and ports align with the specification.
  • Functional Check: Utilizing formal equivalence checking (via the eqy engine from Yosys) to compare the output against a reference implementation.

Key Insights: The 80/20 Rule of RTL

A core contribution of this work is the first detailed entropy study of RTL generation. The results reveal that a tiny minority of "forking tokens" determine the entire logical trajectory of a module. Updating the model on the remaining 80% of deterministic tokens acts as noise, destabilizing the training process.

Figure 2: Word clouds contrasting high-entropy tokens (logic-driving decision points) with low-entropy tokens (boilerplate and structural syntax).

By masking low-entropy tokens, the RL algorithm achieves sharper credit assignment. It more effectively associates rewards (like passing a testbench) with the specific logical choices that led to success, rather than the surrounding syntax.

Results and Performance

Implemented on a DeepSeek-Coder-7B base, EARL achieved state-of-the-art results across several benchmarks:

  • RTLLM Benchmark: EARL reached a 100% syntax pass rate and a 68.9% functional pass rate, representing a 14.7% improvement over previous RL methods.
  • VerilogEval-Human: The model achieved 49.6% pass@1, the highest among all tested models, including those with significantly larger parameter counts.
  • Training Stability: The entropy-masking approach significantly reduced "wasted" updates, leading to more stable training dynamics compared to standard PPO or DAPO (Dynamic Sampling Policy Optimization) methods.

Limitations and Future Directions

While EARL marks a significant advancement, challenges remain. Formal equivalence checking is robust but computationally expensive for massive, multi-million gate designs. Additionally, the quality of the initial SFT stage remains dependent on synthetic datasets, which may carry the biases of their "teacher" models (e.g., GPT-4).

Future work may involve applying entropy-aware RL to other structured domains, such as formal specification languages (SystemVerilog Assertions) or specialized programming languages where rigid syntax often masks complex underlying logic.

Summary updated

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
VerilogEval-MachineEARL (DeepSeek-Coder-7B; DAPO instantiation)pass@172.9%Code Generation · fine-tuned · params=7B · backbone=DeepSeek-Coder-7B · training=SFT initialization + DAPO-EARL · completions=5 · temperature=1.0
Source quote
L336: On {VerilogEval-Machine}, EARL attains 72.9% pass@1 and 83.9% pass@5, surpassing the strongest RL baseline VeriReason by 3.1% and 0.8%, respectively, and outperforming the best SFT model by 4.2% in pass@1.
VerilogEval-MachineEARL (DeepSeek-Coder-7B; DAPO instantiation)pass@583.9%Code Generation · fine-tuned · params=7B · backbone=DeepSeek-Coder-7B · training=SFT initialization + DAPO-EARL · completions=5 · temperature=1.0
Source quote
L336: On {VerilogEval-Machine}, EARL attains 72.9% pass@1 and 83.9% pass@5, surpassing the strongest RL baseline VeriReason by 3.1% and 0.8%, respectively, and outperforming the best SFT model by 4.2% in pass@1.
VerilogEval-HumanEARL (DeepSeek-Coder-7B; DAPO instantiation)pass@149.6%Code Generation · fine-tuned · params=7B · backbone=DeepSeek-Coder-7B · training=SFT initialization + DAPO-EARL · completions=5 · temperature=1.0
Source quote
L337: On VerilogEval-Human, which contains expert-written tasks more aligned with real-world HDL practices, EARL achieves 49.6% pass@1 and 60.2% pass@5, both the highest among all methods.
VerilogEval-HumanEARL (DeepSeek-Coder-7B; DAPO instantiation)pass@560.2%Code Generation · fine-tuned · params=7B · backbone=DeepSeek-Coder-7B · training=SFT initialization + DAPO-EARL · completions=5 · temperature=1.0
Source quote
L337: On VerilogEval-Human, which contains expert-written tasks more aligned with real-world HDL practices, EARL achieves 49.6% pass@1 and 60.2% pass@5, both the highest among all methods.
RTLLM v1.1EARL (DeepSeek-Coder-7B; DAPO instantiation)syntax pass@5100%Code Generation · fine-tuned · params=7B · backbone=DeepSeek-Coder-7B · training=SFT initialization + DAPO-EARL · temperature=1.0
Source quote
L338: On {RTLLM v1.1}, EARL obtains perfect syntax pass@5 (100%) and the highest functional correctness (68.9%), outperforming the best RL method by 14.7% and the best SFT method by 17.2%.
RTLLM v1.1EARL (DeepSeek-Coder-7B; DAPO instantiation)functional correctness68.9%Code Generation · fine-tuned · params=7B · backbone=DeepSeek-Coder-7B · training=SFT initialization + DAPO-EARL · temperature=1.0
Source quote
L338: On {RTLLM v1.1}, EARL obtains perfect syntax pass@5 (100%) and the highest functional correctness (68.9%), outperforming the best RL method by 14.7% and the best SFT method by 17.2%.
BibTeX
@misc{shi2025earl,
  author = {Jiahe Shi and Zhengqi Gao and Ching-Yun Ko and Duane S. Boning},
  title = {{EARL: Entropy-Aware RL Alignment of LLMs for Reliable RTL Code Generation}},
  year = {2025},
  eprint = {2511.12033},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.12033},
}
Figure