Skip to content

yuxuan-hou-x/CktGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CktGen: Automated Analog Circuit Design with Generative Artificial Intelligence

Project Page Paper arXiv Hugging Face

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

πŸ“ Click to expand
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

πŸ› οΈ 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.

    ModelCommand
    All checkpointspython utils/load_pretrained.py
    CktGenpython utils/load_pretrained.py --folder cktgen
    Evaluatorpython utils/load_pretrained.py --folder evaluator
    πŸ“¦ Download individual baseline models:
    Baseline ModelCommand
    Baselines (all)python utils/load_pretrained.py --folder baselines
    LDT (Latent Diffusion Transformer)python utils/load_pretrained.py --folder baselines/ldt
    CVAEGAN (Conditional VAE-GAN)python utils/load_pretrained.py --folder baselines/cvaegan
    CktGNNpython utils/load_pretrained.py --folder baselines/cktgnn
    PACEpython utils/load_pretrained.py --folder baselines/pace

  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.

Experiment Dataset Command
Auto Design CktBench-101 bash scripts/test/cktgen/cktgen_auto_design_101.sh
CktBench-301 bash scripts/test/cktgen/cktgen_auto_design_301.sh
Conditional Generation CktBench-101 bash scripts/test/cktgen/cktgen_cond_gen_101.sh
CktBench-301 bash scripts/test/cktgen/cktgen_cond_gen_301.sh
Reconstruction
& Random Generation
CktBench-101 bash scripts/test/cktgen/cktgen_recon_101.sh
CktBench-301 bash scripts/test/cktgen/cktgen_recon_301.sh
t-SNE Visualization - bash scripts/test/cktgen/cktgen_tsne.sh
Auto Design Visualization - bash scripts/test/auto_design_visualize.sh

Evaluating Baselines

πŸ“¦ Baseline models evaluation scripts
Model Experiment Dataset Command
CktGNN Auto Design CktBench-101 bash scripts/test/baselines/cktgnn/cktgnn_auto_design_101.sh
CktBench-301 bash scripts/test/baselines/cktgnn/cktgnn_auto_design_301.sh
Conditional Generation CktBench-101 bash scripts/test/baselines/cktgnn/cktgnn_cond_gen_101.sh
CktBench-301 bash scripts/test/baselines/cktgnn/cktgnn_cond_gen_301.sh
Reconstruction CktBench-301 bash scripts/test/baselines/cktgnn/cktgnn_recon_301.sh
t-SNE - bash scripts/test/baselines/cktgnn/cktgnn_tsne.sh
LDT Auto Design CktBench-101 bash scripts/test/baselines/ldt/ldt_auto_design_101.sh
CktBench-301 bash scripts/test/baselines/ldt/ldt_auto_design_301.sh
Conditional Generation CktBench-101 bash scripts/test/baselines/ldt/ldt_cond_gen_101.sh
CktBench-301 bash scripts/test/baselines/ldt/ldt_cond_gen_301.sh
t-SNE - bash scripts/test/baselines/ldt/ldt_tsne.sh
PACE Auto Design CktBench-101 bash scripts/test/baselines/pace/pace_auto_design_101.sh
CktBench-301 bash scripts/test/baselines/pace/pace_auto_design_301.sh
Conditional Generation CktBench-101 bash scripts/test/baselines/pace/pace_cond_gen_101.sh
CktBench-301 bash scripts/test/baselines/pace/pace_cond_gen_301.sh
Reconstruction CktBench-101 bash scripts/test/baselines/pace/pace_recon_101.sh
CktBench-301 bash scripts/test/baselines/pace/pace_recon_301.sh
t-SNE - bash scripts/test/baselines/pace/pace_tsne.sh
CVAEGAN Auto Design CktBench-101 bash scripts/test/baselines/cvaegan/cvaegan_auto_design_101.sh
CktBench-301 bash scripts/test/baselines/cvaegan/cvaegan_auto_design_301.sh
Conditional Generation CktBench-101 bash scripts/test/baselines/cvaegan/cvaegan_cond_gen_101.sh
CktBench-301 bash scripts/test/baselines/cvaegan/cvaegan_cond_gen_301.sh
t-SNE - bash scripts/test/baselines/cvaegan/cvaegan_tsne.sh

πŸ‹οΈ Train from scratch

Training CktGen

Prerequisites: Training CktGen with conditional generation requires a pre-trained evaluator model for guided optimization. The evaluator must be downloaded and placed in checkpoints/ before training:

python utils/load_pretrained.py --folder evaluator

Alternatively, train your own evaluator using scripts in scripts/train/evaluator/. With the evaluator loaded, the training script will automatically evaluate performance at the end of training.

Training Task Dataset Command
Conditional Generation
(requires evaluator)
CktBench-101 bash scripts/train/cktgen/cktgen_cond_gen_101.sh
CktBench-301 bash scripts/train/cktgen/cktgen_cond_gen_301.sh
Reconstruction Only
(no evaluator needed)
CktBench-101 bash scripts/train/cktgen/cktgen_recon_101.sh
CktBench-301 bash scripts/train/cktgen/cktgen_recon_301.sh

Training Evaluator

Dataset Command
CktBench-101 bash scripts/train/evaluator/evaluator_101.sh
CktBench-301 bash scripts/train/evaluator/evaluator_301.sh

Training Baselines

πŸ“¦ Baseline models training scripts
Model Training Task Dataset Command
CktGNN Conditional Generation CktBench-101 bash scripts/train/baselines/cktgnn/cktgnn_cond_gen_101.sh
CktBench-301 bash scripts/train/baselines/cktgnn/cktgnn_cond_gen_301.sh
Reconstruction CktBench-301 bash scripts/train/baselines/cktgnn/cktgnn_recon_301.sh
LDT Conditional Generation CktBench-101 bash scripts/train/baselines/ldt/ldt_cond_gen_101.sh
CktBench-301 bash scripts/train/baselines/ldt/ldt_cond_gen_301.sh
PACE Conditional Generation CktBench-101 bash scripts/train/baselines/pace/pace_cond_gen_101.sh
CktBench-301 bash scripts/train/baselines/pace/pace_cond_gen_301.sh
Reconstruction CktBench-101 bash scripts/train/baselines/pace/pace_recon_101.sh
CktBench-301 bash scripts/train/baselines/pace/pace_recon_301.sh
CVAEGAN Conditional Generation CktBench-101 bash scripts/train/baselines/cvaegan/cvaegan_cond_gen_101.sh
CktBench-301 bash scripts/train/baselines/cvaegan/cvaegan_cond_gen_301.sh

πŸ™ Acknowledgments

  • We express our profound gratitude to Zehao Dong, Weidong Cao, Xuan Zhang, and the CktGNN team for open-sourcing the OCB dataset and their pioneering work. Our research significantly benefited from the high-quality benchmarks and insights established in their work.
  • Thanks to the authors of PACE for their foundational architectural research.

πŸ’¬ Contact

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors