Views
No views yet
| Property | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-Coder-3B-Instruct |
| Fine-tuning Method | QLoRA (4-bit) via Unsloth |
| LoRA Rank | 16 |
| LoRA Alpha | 32 |
| Training Dataset | ADI2005/spice-circuits-finetune-v2 |
| Dataset Size | 7,410 entries (2,910 real + 4,500 synthetic) |
| Training Hardware | NVIDIA A100 |
| Training Time | ~35 minutes (3 epochs) |
| Final Training Loss | 0.2694 |
| SPICE Compatibility | ngspice |
.MODEL statements for transistors, diodes, and MOSFETs.AC, .DC, .TRAN, .OP).END termination| Circuit | Result |
|---|---|
| Low-pass RC filter | ✅ Pass |
| NPN BJT common-emitter amplifier | ✅ Pass |
| CMOS inverter | ✅ Pass |
| Zener voltage regulator | ✅ Pass |
| Full-wave bridge rectifier | ✅ Pass |
1from unsloth import FastLanguageModel
2
3model, tokenizer = FastLanguageModel.from_pretrained(
4 model_name="ADI2005/qwen-spice-lora-v2",
5 max_seq_length=2048,
6 dtype=None,
7 load_in_4bit=True,
8)
9FastLanguageModel.for_inference(model)
10
11SYSTEM_PROMPT = """You are an expert analog circuit designer and SPICE netlist generator.
12When given a circuit description, you generate a complete, valid, simulation-ready SPICE netlist
13compatible with ngspice. Always include component definitions, node connections, model statements
14where needed, and an analysis command. End every netlist with .END"""
15
16messages = [
17 {"role": "system", "content": SYSTEM_PROMPT},
18 {"role": "user", "content": "Design a low-pass RC filter with a cutoff frequency of 1kHz."},
19]
20
21input_ids = tokenizer.apply_chat_template(
22 messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
23).to("cuda")
24
25outputs = model.generate(
26 input_ids=input_ids,
27 max_new_tokens=512,
28 temperature=0.1,
29 do_sample=True,
30 pad_token_id=tokenizer.eos_token_id,
31)
32
33response = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True)
34print(response)