AnalogCoder: Analog Circuit Design via Training-Free Code Generation

Yao Lai, Sungyoung Lee, Guojin Chen, Souradip Poddar, Mengkang Hu, David Z. Pan, Ping Luo

Abstract

Analog circuit design has traditionally been a manual, expert-driven process that resists automation due to high physical complexity and a scarcity of domain-specific training data. This paper introduces AnalogCoder, a training-free Large Language Model (LLM) agent that automates analog design by generating Python code rather than low-level netlists. By employing a feedback-enhanced self-correction loop and a modular circuit tool library, AnalogCoder bridges the abstraction gap in hardware design. Experimental results demonstrate that AnalogCoder successfully designs complex analog systems, outperforming state-of-the-art models like GPT-4o by a significant margin.

Introduction

While Large Language Models (LLMs) have made significant strides in digital circuit design using high-level languages like Verilog, analog design remains a "dark art" for AI. The authors identify three primary hurdles:

  1. Complexity: Analog circuits rely on intricate physical interconnections where minor parameter adjustments can fundamentally alter functionality.
  2. Abstraction Gap: Unlike digital logic, analog design requires direct manipulation of low-level physical components (MOSFETs, resistors, capacitors).
  3. Data Scarcity: SPICE netlists, the industry standard, represent less than 0.1% of public code repositories, leaving LLMs with insufficient training data to achieve proficiency.

Methodology: Python as an Intermediate Representation

AnalogCoder addresses data scarcity by using Python (via the PySpice library) as an intermediate representation. Since LLMs are already experts at Python, they can describe circuits as code more effectively than as raw SPICE netlists. This approach leverages the general-purpose coding strength of LLMs to bridge the gap to specialized hardware design.

The system architecture relies on two core mechanisms:

  • Feedback-Enhanced Design Flow: Instead of single-shot generation, the agent operates in a loop. It performs four critical checks: a requirement check, a simulation/operating point check (ensuring transistors are active), a DC sweep (verifying signal paths), and a final functional performance check. Errors are fed back to the LLM for automated self-correction.
  • Circuit Tool Library: For complex "composite" circuits, the agent utilizes a library of verified sub-circuits (e.g., single-stage op-amps). This allows the model to move from component-level to system-level design by retrieving and reusing proven modules.
The AnalogCoder workflow handles basic and composite tasks through feedback loops and a modular tool library.

Experimental Evaluation

The authors introduced a comprehensive benchmark consisting of 24 unique analog circuits, ranging from "Easy" tasks (e.g., common-source amplifiers) to "Hard" composite tasks (e.g., Phase-Locked Loops and Voltage-Controlled Oscillators). This benchmark is significantly larger than previous efforts, offering 3x more tasks than the ChipChat benchmark.

Key Results

AnalogCoder establishes a new state-of-the-art in automated analog design. It successfully completed 20 out of 24 tasks, significantly outperforming standard GPT-4o (15 solved) and Llama-3-70B (11 solved). Notably, AnalogCoder was the only model capable of solving several "Hard" composite tasks, a feat attributed to its hierarchical tool library and modular approach.

Performance comparison across various LLMs shows AnalogCoder leading in all difficulty categories, particularly in complex tasks.

Discussion and Future Work

The success of AnalogCoder highlights that an LLM's general coding capability is a powerful lever for hardware design when bridged correctly. By treating verification as an integral part of the design loop—mimicking human engineering practices like checking operating points—the agent achieves high functional correctness.

However, current limitations include a lack of focus on multi-objective optimization. In real-world scenarios, engineers must balance power consumption, area, and noise resilience. Future research will explore integrating optimization algorithms, such as Bayesian optimization, to fine-tune component parameters after functional correctness is established.

Summary updated

BibTeX
@inproceedings{lai2025analogcoder,
  author = {Yao Lai and Sungyoung Lee and Guojin Chen and Souradip Poddar and Mengkang Hu and David Z. Pan and Ping Luo},
  title = {{AnalogCoder: Analog Circuit Design via Training-Free Code Generation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i1.32016},
}
Figure