RTL Agent: An Agent-Based Approach for Functionally Correct HDL Generation via LLMs
LLMs as code generators have undergone rapid progress over the past couple of years. However, the models on their own provide no guarantees for the functional correctness of the generated code. Functional tests can not only be used by designers to assess the functional correctness of code, but also to guide them towards the solution of the problem. The same can be applied to LLMs performing automatic code generation through the use of the Reflexion technique. Reflexion is an agent-based workflow where the model generating code iterates over a loop of code generation, getting feedback from the test bench, reflecting on the feedback, and making appropriate changes to the code. The technique is known to drastically improve the performance of LLMs on software code generation. In this work, we adopt the technique for hardware description language (HDL) code generation as RTL Agent - an implementation of the workflow for Verilog generation with Reflexion. We compare multiple LLMs with standard inference vs with Reflexion on the VerilogEval benchmark. Within 5 iterations of the feedback loop, we observe a relative improvement of 33.2% for the low-performance model Llama3 and an average of 17.7% for the high-performance models GPT-4o and GPT-4o-mini in their Pass@1 performance. We present a cost analysis of the technique to enable cost-performance trade-offs.
Authors
- Rui Mao (ORCID: https://orcid.org/0000-0002-1082-8755)
- Debjyoti Bhattacharjee (ORCID: https://orcid.org/0000-0001-6561-8934)
- Erik Cambria (ORCID: https://orcid.org/0000-0002-3030-1280)
- Anupam Chattopadhyay
- Sriram Ranga
Institutions
- Nanyang Technological University (SG)
- IMEC (BE)
Publication Details
- Published
- 2024-12-17
- DOI
- https://doi.org/10.1109/ats64447.2024.10915277
- Citations
- 3
- Primary Topic
- Advanced Control Systems Optimization
- Type
- article
- Field-Weighted Citation Impact
- 0.98