SPICEPilot: Navigating SPICE Code Generation and Simulation with AI Guidance

Deepak Vungarala, Sakila Alam, Arnob Ghosh, Shaahin Angizi · DOI

Abstract

While Large Language Models (LLMs) have demonstrated proficiency in software development and digital hardware description, analog circuit design remains a significant challenge due to its reliance on complex physical principles and nuanced engineering norms. This paper introduces SPICEPilot, a framework designed to bridge this gap by combining specialized "Pilot Prompting" with a Python-based simulation environment (PySpice). By leveraging an iterative validation loop and hardware-specific in-context learning, SPICEPilot achieves a 79.8% average Pass@1 accuracy across a diverse benchmark of 60 circuits, significantly outperforming existing state-of-the-art methods.

Introduction

Analog circuit design is a cornerstone of modern electronics, yet it has remained a "blind spot" for generative AI. Unlike digital design, which often follows rigid logic, analog design requires a deep understanding of physics, transistor sizing, and simulation methodologies. Current LLMs frequently exhibit three "fatal flaws" when tasked with generating SPICE (Simulation Program with Integrated Circuit Emphasis) code:

  1. Transistor Sizing Misconceptions: Models often ignore standard design ratios, such as the 2:1 width ratio between PMOS and NMOS transistors required to balance drive strength.
  2. Analysis Paralysis: Models struggle to select the appropriate simulation type (e.g., DC vs. Transient analysis) for specific circuit behaviors.
  3. Input Errors: Models frequently assign incorrect voltage levels or signal types, rendering simulations invalid or meaningless.

To address these issues, we present SPICEPilot, a framework that transforms circuit generation from a one-shot request into a guided, iterative process.

Methodology

The Pilot Prompt

At the core of the framework is the "Pilot Prompt." Rather than providing a simple natural language description of a circuit, SPICEPilot utilizes In-Context Learning (ICL) to embed hardware-specific knowledge and step-by-step guidelines directly into the prompt. This acts as a logical "cheat sheet," forcing the LLM to adhere to electronics fundamentals during the generation phase.

PySpice Integration and Dual Representation

A key insight of this work is the use of Python as a bridge. LLMs possess significantly more training data for Python than for raw SPICE netlists. By utilizing the PySpice library, SPICEPilot allows the model to write Python code that programmatically generates the circuit. The framework then maintains a dual representation of the design in both Python (.py) and SPICE (.sp) formats, ensuring compatibility with both modern AI workflows and traditional engineering tools.

Automated Validation Loop

To ensure functionality, SPICEPilot incorporates an automated code validation step. If the generated code fails to simulate or contains syntax errors, the error logs are fed back to the LLM. The model then enters a revision cycle, iteratively refining the code until a functional circuit is produced.

The SPICEPilot Dataset

To evaluate the framework, we introduced the SPICEPilot Dataset, a comprehensive benchmark consisting of 60 unique circuits. This dataset is 150% larger than previous benchmarks like AnalogCoder and spans a wide range of complexity, from basic logic gates to advanced systems such as Delta-Sigma Modulators and Successive Approximation Register (SAR) ADCs. Tasks are categorized by transistor count into four difficulty levels:

  • Easy: ≤10 transistors
  • Medium: 11-25 transistors
  • Hard: 26-45 transistors
  • Extreme: >45 transistors

Results and Discussion

Experimental results indicate that SPICEPilot, particularly when paired with Claude-3.5 Sonnet, delivers a paradigm shift in performance. The framework achieved an average Pass@1 score of 79.8%, a substantial increase from the 52.2% seen in previous benchmarks.

On "Hard" tasks, SPICEPilot maintained a 47.7% Pass@1 rate, whereas the previous leader, AnalogCoder, achieved only 33.9%. For "Easy" and "Medium" tasks, the framework reached near-perfect reliability (100% and 91.7% respectively), suggesting that the system is highly effective for automating foundational circuit components.

These results suggest that LLMs do not necessarily need to "memorize" every possible circuit configuration; rather, they can succeed by following explicit hardware rules provided in the context window. By leveraging Python's existing data abundance, SPICEPilot effectively bypasses the scarcity of high-quality analog design data.

Conclusion and Future Work

SPICEPilot demonstrates that guided, iterative frameworks can overcome the traditional barriers to AI-driven analog design. While the system excels at generating functional circuits, challenges remain in high-level optimization—such as fine-tuning component values for specific gain or bandwidth targets.

Future research will focus on multi-modal inputs to allow models to interpret schematic images, as well as more sophisticated feedback loops for performance-driven optimization. By creating a self-improving loop for hardware generation, SPICEPilot paves the way for fully autonomous analog design automation.

Summary updated

BibTeX
@inproceedings{vungarala2024spicepilot,
  author = {Deepak Vungarala and Sakila Alam and Arnob Ghosh and Shaahin Angizi},
  title = {{SPICEPilot: Navigating SPICE Code Generation and Simulation with AI Guidance}},
  booktitle = {ICRC},
  year = {2024},
  doi = {10.1109/icrc64395.2024.10937006},
}
Figure