TL;DR
CODMAS is a novel multi-agent framework that automates Register Transfer Level (RTL) hardware optimization by pairing a "rubber-duck" planning agent with a predictive hypothesis agent. By combining this structured dialectic reasoning with deterministic EDA tool feedback, it achieves ~25% timing improvements and ~22% power reductions across various LLMs while significantly reducing code failure rates. The authors also introduce RTLOPT, a new benchmark dataset specifically designed for evaluating hardware description language optimization.
What Problem Does This Paper Address?
In electronic design automation (EDA), optimizing Register Transfer Level (RTL) code (typically written in Verilog or VHDL) is critical for improving a chip's Power, Performance, and Area (PPA). Crucial architectural transformations like pipelining (breaking up long combinational paths with registers) and clock gating (disabling clocks to inactive circuits) are traditionally performed manually by expert hardware engineers. This process is time-consuming, expensive, and highly error-prone.
While Large Language Models (LLMs) have excelled at generating software code, hardware description languages present unique challenges. RTL code must be strictly synthesizable into physical hardware circuits, and minor syntactic or logical changes can completely break functionality or timing constraints. Existing LLM approaches either focus on simple code generation from scratch or rely on local, heuristic rewrites, failing to capture global architectural intent. Furthermore, the field suffers from a severe lack of standardized, reproducible benchmarks to evaluate AI-driven RTL optimization.
Methods
The paper introduces CODMAS (Collaborative Optimization via a Dialectic Multi-Agent System), a framework that structures LLM reasoning into a closed-loop, pair-programming style architecture. Instead of relying on a single monolithic prompt, CODMAS splits the optimization task among four specialized agents:
- Dialectic Partners (Reasoning Layer):
- The Articulator: Inspired by "rubber-duck debugging," this agent analyzes the unoptimized RTL and creates a step-by-step architectural transformation plan (e.g., deciding exactly where to insert pipeline registers).
- The Hypothesis Partner: Acts as a critic. It predicts the PPA outcomes of the Articulator's plan and identifies potential functional pitfalls before any code is written.
- Executor Agents (Action Layer):
- Domain-Specific Coding Agent (DCA): Generates the actual Verilog edits. It uses a Domain Knowledge Injector (DKI) that feeds the LLM expert roles, few-shot examples, and a structural dataflow graph extracted via Pyverilog.
- Code Evaluation Agent (CEA): A deterministic evaluator that runs the generated code through real, open-source EDA tools (Icarus Verilog for compilation/simulation, Yosys for synthesis). It compiles a unified feedback report to drive the next iteration.
This multi-agent interaction forms a closed-loop dialectic where plans, hypotheses, and code are iteratively refined based on concrete EDA tool feedback.
The complete iterative architecture and its refinement loop are illustrated below:
Datasets
To evaluate their framework, the authors introduced RTLOPT, a curated benchmark dataset containing 120 Verilog "triples." Each triple consists of an unoptimized design, its optimized counterpart, and an associated testbench for functional verification.
- 70 triples focus on pipelining optimizations.
- 50 triples focus on clock gating optimizations.
Designs span arithmetic, control, and mixed modules. Unlike existing datasets that only check if code compiles or functions, RTLOPT explicitly includes metric-specific targets to measure actual PPA improvements.
Key Insights and Ideas
- Role Separation Beats Monolithic Reasoning: A key "aha" moment was discovering that splitting planning (Articulator) and critique (Hypothesis Partner) into separate agents drastically outperforms a single shared-memory agent. Collapsing these roles into one degrades stability and performance because explicit separation prevents the model from prematurely committing to suboptimal designs.
- Dataflow Graphs Provide Crucial Context: Providing an LLM with raw text Verilog files is insufficient for complex hardware tasks. Injecting a structured dataflow graph allows the coding agent to reason explicitly about combinational logic cones and pipeline depth, leading to architecture-aware edits.
- Diminishing Returns of Iteration: The authors observed that most optimization gains happen in the first 3 iterations. For harder problems, excessive iterations can cause the agents to oscillate or decline in performance due to conflicting hypotheses, highlighting the need for adaptive stopping criteria.
Key Results
CODMAS consistently outperformed strong prompting and agentic baselines (such as ReAct, Reflexion, and LLM-VeriPPA) across both proprietary and open-source models:
- Pipelining: Achieved an average of ~25% reduction in critical path delay (timing improvement), peaking at 25.5% with GPT-4o.
- Clock Gating: Attained an average power reduction of ~22% (21.7% with GPT-4o).
- Reliability: Reduced failure rates (FR) to under 30%, whereas standard baselines frequently suffered from 40% to 50%+ failure rates due to syntax or functional bugs.
- Area Control: Successfully kept area overhead near baseline levels (~4% reduction in some GPT-4o cases), preventing the typical area bloat associated with automated code generation.
Limitations and Future Work
- Scope of Optimizations: Currently limited to pipelining and clock gating. Future work needs to extend CODMAS to other complex transformations like retiming, resource sharing, and finite state machine (FSM) restructuring.
- Scalability: Running full synthesis and simulation loops using EDA tools is computationally expensive, which limits scalability to massive, industrial-scale multi-file chip designs.
- Verification Gap: Functional correctness is validated via simulation testbenches rather than exhaustive formal equivalence checking, meaning subtle corner-case bugs might still slip through.
- Plan Generality: Occasionally, the dialectic agents generate overly generic optimization plans, indicating a continued reliance on high-quality prompt templates.
Summary updated