Masala CHAI: Generative Models for Analog Circuit Design in SPICE

Siddharth Garg

Feb 3, 2025

Feb 3, 2025

From amplifiers that boost tiny voltages picked up by wireless receivers to analog-to-digital and digital-to-analog converters that make it possible for digital electronics to interface with an inherently physical world, analog circuit are everywhere. Analog circuits are typically represented in one of two forms: schematic diagrams that are commonly found in textbooks and papers, and in text format in a programming language called SPICE. Analog circuit design has always been thought of as more of an art than a science—analog designers take design specifications and, perhaps sometimes by magic, convert them to highly optimized schematics or SPICE netlist that meet specification. Can analog circuit design be partly automated?

In Masala CHAI we try to take a first step in this direction. Building on our experience in training custom large language models (LLMs) for automated Verilog code generation, a language of choice for describing digital circuits, we sought to train custom LLMs to generate SPICE netlists from natural language prompts (for example, “I want to design a common source amplifier”). But, SPICE netlists are extremely hard to find on the internet, even more so than Verilog, presenting a huge impediment for LLM training. 

Masala CHAI addresses this challenge by mining analog circuit textbooks for data. But here we run into another challenge: textbooks are replete with analog circuits, but as images not as netlists. Unfortunately, even powerful vision-language models cannot convert these images to SPICE. We build a custom ML pipeline, sometimes even leveraging old-school edge and object detectors to automatically and reliably extract SPICE netlists from textbooks and papers, and associated figure captions that act as labels. 

Armed with this dataset, we then finetune state-of-art LLMs to auto-generate SPICE netlists, one of the earliest such attempts in literature. The results are promising, successfully generating SPICE netlists for relatively complex circuits, (for example, a  “2-stage amplifier with miller compensation”). Yet, a lot remains to be done—the designs arent optimized to meet specifications, a challenge that will benefit from powerful ML-driven search and optimization methods. And of course, Masala CHAI fails sometimes too, for instance, across several trials we were not able to generate a “Bandgap reference amplifier.”  But challenges, of course, are also opportunities for doing great research and building great products!    

Siddharth Garg is a Distinguished AI Researcher at Arena and the Institute Associate Professor of ECE at NYU Tandon, where he leads the EnSuRe Research group. Siddharth received his PhD in Electrical and Computer Engineering from Carnegie Mellon University, Masters from Stanford University, and Bachelors from the Indian Institute of Technology Madras.

You can access the full Masala CHAI paper here and the GitHub repo here.