SkillAgentSearch skills...

CktGen

Code of "CktGen: Automated Analog Circuit Design with Generative Artificial Intelligence"

Install / Use

/learn @yuxuan-hou-x/CktGen

README

<div align="center">

CktGen: Automated Analog Circuit Design with Generative Artificial Intelligence

Project Page Paper arXiv Hugging Face

</div> <p align="center"> <img src="assets/intro.gif" width="700"> </p>

Every time the target Spec changes, most methods start over. CktGen doesn't — it generates circuits directly from the new requirements, then optimizes without retraining.

We are the first to formulate analog circuit synthesis as Spec-conditioned generation (Spec2Ckt): given a target Spec, directly generate the corresponding circuit. Three key contributions:

  • New problem formulation. The first to cast analog circuit synthesis as Spec-conditioned generation, moving beyond repeated fixed-target optimization.
  • One-to-many mapping via joint alignment. Triple alignment (contrastive learning + classifier guidance + feature alignment) maps Specs and circuits into a shared latent space, preserving the one-to-many diversity of valid designs.
  • Test-time optimization without retraining. A multi-armed bandit algorithm searches the learned latent space for designs satisfying new target Specs — no retraining required.

CktGen achieves 47.57% Spec-Acc on Ckt-Bench-101 where all baselines stay below 3%, and reaches up to 87.09% Spec-Acc in automated design.

If you find this work useful, please cite our paper:

@article{hou2025cktgen,
  title = {CktGen: Automated Analog Circuit Design with Generative Artificial Intelligence},
  journal = {Engineering},
  year = {2025},
  issn = {2095-8099},
  doi = {https://doi.org/10.1016/j.eng.2025.12.025},
  url = {https://www.sciencedirect.com/science/article/pii/S2095809925008148},
  author = {Yuxuan Hou and Hehe Fan and Jianrong Zhang and Yue Zhang and Hua Chen and Min Zhou and Faxin Yu and Roger Zimmermann and Yi Yang},
}

📋 Table of Contents

🏗️ Project Structure

<details> <summary><b>📁 Click to expand</b></summary>
CktGen/
├── checkpoints/              # Pre-trained models (download from HuggingFace)
│   ├── cktgen/               # CktGen models
│   ├── evaluator/            # Performance evaluators
│   └── baselines/            # Baseline models (CktGNN, LDT, PACE, CVAEGAN)
├── dataset/OCB/              # Open Circuit Benchmark datasets
│   ├── CktBench101/          # 10k circuit samples
│   └── CktBench301/          # 50k circuit samples
├── models/                   # Model implementations
│   ├── architectures/        # Encoders & decoders
│   └── modeltype/            # VAE, CktGen, LDT, CVAEGAN
├── scripts/                  # Experiment scripts
│   ├── train/                # Training scripts
│   └── test/                 # Evaluation scripts
├── train/                    # Training source code
├── test/                     # Testing source code
├── evaluation/               # Evaluation metrics
├── utils/                    # Utility functions (including model download)
└── options/                  # CLI argument definitions
</details>

🛠️ Installation

Prerequisites

  • Hardware: NVIDIA GPU with 24GB+ VRAM recommended (tested on RTX 4090)
  • Software: Conda or Miniconda

Install environment

The environment.yml file contains all required dependencies (Python 3.9, PyTorch 1.13.1, CUDA 11.7, etc.) and has been tested to work out-of-the-box.

# Step 1: Clone the repository
git clone https://github.com/hhyxx/CktGen.git
cd CktGen

# Step 2: Create and activate environment (all dependencies included)
conda env create -f environment.yml
conda activate cktgen

📊 Datasets

All experiments in this work are conducted on the Open Circuit Benchmark (OCB) dataset. To facilitate easy reproducibility and provide a seamless "ready-to-run" experience, we have included the complete OCB datasets directly within this repository.

🔗 Dataset Credits & Citation

  • The OCB dataset was originally introduced as a foundational benchmark by the authors of CktGNN (Dong et al., 2023). We are deeply grateful for their pioneering contribution to the analog circuit design community, which established essential standards for benchmarking in this field.

  • When using this dataset, please cite the original CktGNN paper to properly acknowledge the foundational work of its authors. The data is redistributed here under the MIT License for research convenience.

📂 Dataset Structure

dataset/OCB/
├── CktBench101/                   # Ckt-Bench-101 analog circuits
│   ├── ckt_bench_101_igraph.pkl   # Circuit graphs (10k samples)
│   └── perform101.csv             # Performance specifications
└── CktBench301/                   # Ckt-Bench-301 analog circuits
    ├── ckt_bench_301_igraph.pkl   # Circuit graphs (50k samples)
    └── perform301.csv             # Performance specifications

📈 Evaluate with Pre-Trained models

Download Pre-trained Models

To run the evaluation tests, you need to download the pre-trained models:

  1. Download from Hugging Face (No authentication required):

    💡 Tip: Run python utils/load_pretrained.py --list to see all available files.

    <table> <tr><th>Model</th><th>Command</th></tr> <tr><td><b>All checkpoints</b></td><td><code>python utils/load_pretrained.py</code></td></tr> <tr><td>CktGen</td><td><code>python utils/load_pretrained.py --folder cktgen</code></td></tr> <tr><td>Evaluator</td><td><code>python utils/load_pretrained.py --folder evaluator</code></td></tr> </table> <details> <summary>📦 <b>Download individual baseline models:</b></summary> <br> <table> <tr><th>Baseline Model</th><th>Command</th></tr> <tr><td>Baselines (all)</td><td><code>python utils/load_pretrained.py --folder baselines</code></td></tr> <tr><td>LDT (Latent Diffusion Transformer)</td><td><code>python utils/load_pretrained.py --folder baselines/ldt</code></td></tr> <tr><td>CVAEGAN (Conditional VAE-GAN)</td><td><code>python utils/load_pretrained.py --folder baselines/cvaegan</code></td></tr> <tr><td>CktGNN</td><td><code>python utils/load_pretrained.py --folder baselines/cktgnn</code></td></tr> <tr><td>PACE</td><td><code>python utils/load_pretrained.py --folder baselines/pace</code></td></tr> </table> </details> <br>
  2. Download from Baidu Netdisk:

    Download and extract the folders into checkpoints/ to use with the provided scripts:

    checkpoints/
    ├── cktgen/
    ├── evaluator/
    └── baselines/
        ├── ldt/
        └── ...
    

Evaluating CktGen

After downloading the pretrained models into checkpoints folder, run these test scripts to reproduce the experimental results of CktGen in our paper:

⚠️ Note: Our experiments were conducted on NVIDIA RTX 4090. Due to differences in GPU architecture and floating-point precision, results on other hardware may vary slightly.

<table> <tr> <th>Experiment</th> <th>Dataset</th> <th>Command</th> </tr> <tr> <td rowspan="2"><b>Auto Design</b></td> <td>CktBench-101</td> <td><code>bash scripts/test/cktgen/cktgen_auto_design_101.sh</code></td> </tr> <tr> <td>CktBench-301</td> <td><code>bash scripts/test/cktgen/cktgen_auto_design_301.sh</code></td> </tr> <tr> <td rowspan="2"><b>Conditional Generation</b></td> <td>CktBench-101</td> <td><code>bash scripts/test/cktgen/cktgen_cond_gen_101.sh</code></td> </tr> <tr> <td>CktBench-301</td> <td><code>bash scripts/test/cktgen/cktgen_cond_gen_301.sh</code></td> </tr> <tr> <td rowspan="2"><b>Reconstruction<br>& Random Generation</b></td> <td>CktBench-101</td> <td><code>bash scripts/test/cktgen/cktgen_recon_101.sh</code></td> </tr> <tr> <td>CktBench-301</td> <td><code>bash scripts/test/cktgen/cktgen_recon_301.sh</code></td> </tr> <tr> <td><b>t-SNE Visualization</b></td> <td>-</td> <td><code>bash scripts/test/cktgen/cktgen_tsne.sh</code></td> </tr> <tr> <td><b>Auto Design Visualization</b></td> <td>-</td> <td><code>bash scripts/test/auto_design_visualize.sh</code></td> </tr> </table>

Evaluating Baselines

<details> <summary>📦 <b>Baseline models evaluation scripts</b></summary> <br> <table> <tr> <th>Model</th> <th>Experiment</th> <th>Dataset</th> <th>Command</th> </tr> <tr> <td rowspan="6"><b>CktGNN</b></td> <td rowspan="2">Auto Design</td> <td>CktBench-101</td> <td><code>bash scripts/test/baselines/cktgnn/cktgnn_auto_design_101.sh</code></td> </tr> <tr> <td>CktBench-301</td> <td><code>bash scripts/test/baselines/cktgnn/cktgnn_auto_design_301.sh</code></td> </tr> <tr> <td rowspan="2">Conditional Generation</td> <td>CktBench-101</td> <td><code>bash scripts/test/baselines/cktgnn/cktgnn_cond_gen_101.sh</code></td> </tr> <tr> <td>CktBench-301</td> <td><code>bash scripts/test/baselines/cktgnn/cktgnn_cond_gen_301.sh</code></td> </tr> <tr> <td>Reconstruction</td> <td>CktBench-301</td> <td><code>bash scripts/test/baselines/cktgnn/cktgnn_recon_301.sh</code></td> </tr> <tr> <td>t-SNE</td> <td>-</td> <td><code>bash sc

Related Skills

View on GitHub
GitHub Stars4
CategoryDesign
Updated1d ago
Forks4

Languages

Python

Security Score

90/100

Audited on Apr 7, 2026

No findings