Simonssb/qwen2.5-coder-32b-pcb-grpoA LoRA adapter (r=32, alpha=64) fine-tuned on Qwen/Qwen2.5-Coder-32B-Instruct via Stage-1 QLoRA SFT + Stage-2 Online GRPO to act as an AI KiCad PCB Architectural Planner & Routing Strategist.
Given a compact netlist and footprint geometry summary (board_context.md), the model predicts:
groups (groups.json): 1-IC-per-group functional partitioning (core, power, interface), anchor selection, and near adjacency hints.routing_strategy (routing_strategy.json): Ground/split-plane pours (ground_plane_nets), EMI keep_away_rules, power_width_tiers, laminar bus_routing, placer_channel_reservation, and via_and_trace_rules.Designed to drive deterministic placement and Rust A* autorouting via drandyhaas/KiCadRoutingTools.
v7_full)Qwen/Qwen2.5-Coder-32B-Instruct254 physics-verified KiCad boards (393 raw trajectories -> 245 curated high-purity SFT examples: 214 train / 31 val; 274 GRPO prompts).2 epochs, lr=8e-5, max_seq_length=16384 -> train_loss=0.1511, eval_loss=0.1767, eval_mean_token_accuracy=94.93%.G=4) physics rollouts graded by 100% routed connectivity (blocking=0), via/copper efficiency, and a 19-point hardware quality rubric (slalom avoidance, via-in-pad, layer weaving, hot-loop length, decoupling proximity, channel symmetry, and power width compliance) -> train_loss=0.0820.10 / 10 boards):10 / 10)blocking = 0 (10 / 10) including 0.5 mm pitch LQFP-48, QFN-20 RF modules, and ESP32/USB-C boards.AI_Hydro_Controller & HydroPCB, ~84–104 movable parts):AI_Hydro_Controller: 0 KiCad DRC errors, 0 unconnected nets, 91 vias / 1741.31 mm copper (vs. 129 vias / 2378.91 mm human reference).HydroPCB: 0 blocking (vs. 2 blocking human placement ceiling), 0 unconnected nets, 77 vias (vs. 112 human reference), 0 via-in-pad.transformers + peft)import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
adapter_id = "Simonssb/qwen2.5-coder-32b-pcb-grpo"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
adapter_model.safetensors 512 MiBtraining_args.bin 5.6 KiBQwen/Qwen2.5-Coder-32B-Instruct