Transformers
Safetensors
English
schgen
PCB
EDA
KiCAD
Hardware-Design
Schematic-Generation
LLM
Circuit-Design
Run this model with HF Jobs
Run microsoft/SchGen on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/microsoft/SchGen. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/microsoft/SchGen on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use microsoft/SchGen with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/SchGen with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import SchGen model = SchGen.from_pretrained("microsoft/SchGen", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files12342345676789891011121314151617181219201415212223172425262728293031323334351920363722232425383940414243444546474849502851525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103301041051061071083310911011135112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181373839404118218343184185186187188189474849505152535455565758190---base_model: openai/gpt-oss-20blibrary_name: transformersmodel_name: gpt-oss-20b-pcb-finetune-L1language:- en
license: mit
tags:- generated_from_trainer- sft- trllicence: license- PCB- EDA- KiCAD- Hardware-Design- Schematic-Generation- LLM- Circuit-Design
library_name: transformers---
# Model Card for gpt-oss-20b-pcb-finetune-L1# SchGen
This model is a fine-tuned version of [openai/gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b).It has been trained using [TRL](https://github.com/huggingface/trl).[]()[]()
## Quick start**SchGen** is a large language model for **PCB schematic generation from natural-language requests**.
The model is supervised fine-tuned from **GPT-OSS-20B** using a custom dataset of approximately **8K paired user requests and schematic-generation code samples**. SchGen generates executable Python code that can be rendered into **KiCad schematic designs** using customized schematic APIs.
➡️ **Base Model:** GPT-OSS-20B ➡️ **License:** MIT ➡️ **Framework:** Transformers ➡️ **Context Length:** 13,312 tokens
---
```pythonfrom transformers import pipeline## Overview
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"generator = pipeline("text-generation", model="None", device="cuda")output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]print(output["generated_text"])Printed circuit board (PCB) design is a critical but expertise-intensive process in embedded systems, IoT, robotics, and AI hardware.
SchGen explores whether large language models can assist hardware design by generating schematic construction code directly from natural-language descriptions.
The input is a user request describing a circuit design requirement, and the output is executable Python code that can generate a KiCad schematic using custom APIs.
Example input:
```textI want a 1.8V regulated supply from VIN using an AP2112K LDO,with a test point on the 1.8V rail and a solder-jumper-selectable LED indicator.```
## Training procedure---
## 🔥 Key Features
- 🔌 **Natural Language to Schematic Code** Generates executable Python schematic-generation code directly from user requests.
- 🧠 **KiCad-Oriented Design Flow** Designed around custom Code-to-Schematic APIs for KiCad schematic construction.
- 📐 **Structured Hardware Generation** Produces editable and programmatic schematic representations instead of images.
- 🛠️ **Research-Focused PCB Generation** Intended for experimentation, benchmarking, and AI-assisted hardware prototyping.
---
## Model Details
| Item | Value ||---|---|| Base Model | GPT-OSS-20B || Parameters | 20B || Architecture | Supervised Fine-Tuned LLM || Input | Natural-language design requests || Output | Python schematic-generation code || Context Length | 13,312 || Training Hardware | 1× NVIDIA A100 || Training Time | ~21 hours |
---
## Usage
The recommended workflow is:
1. Provide a natural-language circuit request2. Generate Python schematic-construction code3. Execute the code to render a KiCad schematic4. Verify outputs using ERC/DRC tools
The model is designed for integration into:
- EDA automation pipelines- Hardware engineering copilots- Synthetic schematic generation systems- Research workflows for AI-assisted PCB design
---
## Evaluation
SchGen was evaluated using several schematic-generation metrics:
- **Valid Circuits** Measures whether generated code executes successfully and produces valid schematics.
This model was trained with SFT.- **Spatial Violation** Measures overlaps among symbols, labels, and wires.
### Framework versions- **Netlist Accuracy** Measures connectivity correctness against ground-truth netlists.
SchGen outperforms several frontier LLM baselines on schematic generation tasks when all models are provided with the same schematic-generation APIs.
---
## Limitations
SchGen is an early-stage research system and currently focuses on:
- small and medium-scale schematic modules- hobbyist and open-source hardware designs- English-language requests
The model may underperform on:
- RF or high-frequency circuits- industrial or enterprise hardware- large multi-board systems- safety-critical applications
Generated outputs should always undergo:
- Electrical Rule Checking (ERC)- Design Rule Checking (DRC)- human engineering review
SchGen is intended as an assistive tool rather than a fully autonomous hardware engineer.
---
## Technical Requirements
The model generates executable Python code and requires:
- Python environment- KiCad installation- Custom schematic-generation APIs
Inference was validated on:
- NVIDIA A100 GPUs- 4-bit quantized configurations
---
## Dataset
SchGen was trained on a custom dataset of approximately 8K pairs of:
- natural-language hardware requests- Python schematic-generation code
The dataset was synthesized through:
1. GPT-generated draft schematics2. Human correction and annotation3. LLM-generated user requests
The dataset is available at `https://huggingface.co/datasets/microsoft/SchGen_dataset`
---
## License
This project is licensed under the MIT License.
---
- TRL: 0.21.0- Transformers: 4.55.4- Pytorch: 2.8.0+cu128- Datasets: 4.0.0- Tokenizers: 0.21.4## Contact
## CitationsThis project was conducted by members of Microsoft Research.
For questions, feedback, or collaboration inquiries:
- ruichunma@microsoft.com
Cite TRL as: ```bibtex@misc{vonwerra2022trl, title = {{TRL: Transformer Reinforcement Learning}}, author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec}, year = 2020, journal = {GitHub repository}, publisher = {GitHub}, howpublished = {\url{https://github.com/huggingface/trl}}}```If issues or problematic behavior are identified, the repository may be updated with appropriate mitigations.README.md+171-39