Run this model with HF Jobs
Run touhid314/circuitformer 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/touhid314/circuitformer. 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/touhid314/circuitformer 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 touhid314/circuitformer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use touhid314/circuitformer with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("touhid314/circuitformer", device_map="auto") - Notebooks
- Google Colab
- Kaggle
CircuitFormer
CircuitFormer is an encoder-decoder transformer trained to generate SPICE netlists for analog circuits from a natural-language description. It uses the CKT tokenizer to tokenize circuits separately from natural language.
Paper: Md Touhidul Islam, Sujan Kumar Saha and Farimah Farahmandi. 2027. CircuitFormer: A Circuit Language Model for Analog Topology Design from Natural Language Prompt. 41st AAAI Conference on Artificial Intelligence (AAAI-27). arXiv preprint
Code: CircuitFormer on GitHub
- Input: a description, for example
common-source amplifier with resistive load - Output: a netlist, for example:
R1 1 2 1
M1 2 3 0 0 model
V1 1 0 1
V2 3 0 1
Model
| Architecture | Encoder-decoder (transformers.EncoderDecoderModel) |
| Encoder | sentence-transformers/all-mpnet-base-v2 |
| Decoder | GPT-2 style, 24 layers, 1020 hidden size, 12 heads, with cross-attention |
| Output tokenizer | CKT, a grammar-based circuit tokenizer with a 512-token vocabulary (in vocab/) |
| Parameters | 511M |
| Training data | touhid314/cktformer-dataset |
Training
Training had two phases:
- Phase 1: the decoder was pre-trained on netlists alone.
- Phase 2: the full encoder-decoder was fine-tuned on description → netlist pairs.
- 100 epochs, learning rate 2e-5, batch size 8.
- For the first 25 epochs, only cross-attention was trained.
Line-shuffle augmentation was on throughout. This upload is the final phase-2 checkpoint (checkpoint4_512/phase2_last.pt).
Results on CircuitBench-100
| Metric | Score |
|---|---|
| Functional success rate | 83% |
| Syntactic correctness | 100% |
Usage
The weights are a plain state dict for the model built in the CircuitFormer code, and decoding needs the CKT tokenizer from that code. Run the model with the repository code:
git clone https://github.com/touhid314/CircuitFormer
cd CircuitFormer
pip install -r requirements.txt
hf download touhid314/circuitformer --local-dir circuitformer
python3 -m src.inference --model_path circuitformer/model.safetensors \
--instruction "common-source amplifier with resistive load"
The script reads config_finetune.json and vocab/ from the folder that holds model.safetensors.
Files
model.safetensors: the model weights only (fp32). The LM head is tied to the token embedding.config_finetune.json: model size, encoder name and training hyperparameters.vocab/: the CKT tokenizer (vocab_ids.jsonand the merge rules inrules.txt).
Limitations
- The model predicts circuit topology. Device values and model names are placeholders, such as
1andmodel, and must be sized separately. - A netlist can be syntactically valid and still not do what the prompt asked. Check the output in a simulator.
Citation
If you use CircuitFormer in your research, please cite the paper:
@misc{islam2026circuitformer,
title = {{CircuitFormer}: A Circuit Language Model for Analog Topology Design from Natural Language Prompt},
author = {Islam, Md Touhidul and Saha, Sujan Kumar and Farahmandi, Farimah and Tehranipoor, Mark},
year = {2026},
eprint = {2605.05773},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
doi = {10.48550/arXiv.2605.05773},
url = {https://arxiv.org/abs/2605.05773}
}
Model tree for touhid314/circuitformer
Base model
sentence-transformers/all-mpnet-base-v2