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 files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758---base_model: openai/gpt-oss-20blibrary_name: transformersmodel_name: gpt-oss-20b-pcb-finetune-L1tags:- generated_from_trainer- sft- trllicence: license---# Model Card for gpt-oss-20b-pcb-finetune-L1This 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```pythonfrom transformers import pipelinequestion = "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"])```## Training procedureThis model was trained with SFT.### Framework versions- TRL: 0.21.0- Transformers: 4.55.4- Pytorch: 2.8.0+cu128- Datasets: 4.0.0- Tokenizers: 0.21.4## CitationsCite 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}}}```123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190---language:- enlicense: mittags:- PCB- EDA- KiCAD- Hardware-Design- Schematic-Generation- LLM- Circuit-Designlibrary_name: transformers---# SchGen[]()[]()**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---## OverviewPrinted 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.```---## 🔥 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 |---## UsageThe 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 toolsThe model is designed for integration into:- EDA automation pipelines- Hardware engineering copilots- Synthetic schematic generation systems- Research workflows for AI-assisted PCB design---## EvaluationSchGen was evaluated using several schematic-generation metrics:- **Valid Circuits**Measures whether generated code executes successfully and produces valid schematics.- **Spatial Violation**Measures overlaps among symbols, labels, and wires.- **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.---## LimitationsSchGen is an early-stage research system and currently focuses on:- small and medium-scale schematic modules- hobbyist and open-source hardware designs- English-language requestsThe model may underperform on:- RF or high-frequency circuits- industrial or enterprise hardware- large multi-board systems- safety-critical applicationsGenerated outputs should always undergo:- Electrical Rule Checking (ERC)- Design Rule Checking (DRC)- human engineering reviewSchGen is intended as an assistive tool rather than a fully autonomous hardware engineer.---## Technical RequirementsThe model generates executable Python code and requires:- Python environment- KiCad installation- Custom schematic-generation APIsInference was validated on:- NVIDIA A100 GPUs- 4-bit quantized configurations---## DatasetSchGen was trained on a custom dataset of approximately 8K pairs of:- natural-language hardware requests- Python schematic-generation codeThe dataset was synthesized through:1. GPT-generated draft schematics2. Human correction and annotation3. LLM-generated user requestsThe dataset is available at `https://huggingface.co/datasets/microsoft/SchGen_dataset`---## LicenseThis project is licensed under the MIT License.---## ContactThis project was conducted by members of Microsoft Research.For questions, feedback, or collaboration inquiries:- ruichunma@microsoft.comIf issues or problematic behavior are identified, the repository may be updated with appropriate mitigations.
README.md+171-39