Skip to content

By PromptFission3 min read

A fine-tuned Qwen plans circuit boards by never being asked where anything goes

pcb-layout-llm trains a 32B coding model to write a layout plan for KiCad boards, then lets ordinary software place and route. Its own table has a row worth reading twice.


Language models are bad at inventing X and Y coordinates for every part on a circuit board. pcb-layout-llm, by GitHub user Ssbullock, takes the coordinates away from the model entirely. A fine-tuned Qwen2.5-Coder-32B writes a plan, and deterministic tools do the geometry.

How it works

The model reads a compact summary of the netlist and footprints and writes two JSON files.

The first, groups.json, sorts the parts into functional groups labeled core, power, or interface, with one IC per group. It picks an anchor part for each and says which groups should sit near each other.

The second, routing_strategy.json, is the kind of note a human designer would leave for a colleague: which nets get a ground pour, which signals must keep away from which, how wide the power traces are by tier, how buses run, and where the placer should leave channels free.

Those files go to a deterministic placer and a Rust A* autorouter from the separate KiCadRoutingTools project. KiCad’s own command-line design rule check is the gate at the end.

Training had two stages, according to the README. First, QLoRA fine-tuning on plans derived from open-source KiCad designs: 393 boards were collected and 245 kept, split 214 for training and 31 for validation. Second, online GRPO, a reinforcement learning method, over 274 prompts. The README does not spell out the reward function.

The numbers, and the asterisks

All figures are the author’s, from 23 boards the model had not seen: 21 held-out open-source boards and two of the author’s own hydroponics controllers. Every model used the same placer, router, and rule check.

Planner Valid plan Fully routed Zero rule errors Avg rule errors
Original human layout n/a n/a 7/23 8.1
Fine-tuned Qwen2.5-Coder-32B 23/23 19/23 11/23 5.4
gemini-4-carbon, zero-shot 20/23 16/23 9/23 7.6
claude-opus-5.5, zero-shot 19/23 15/23 7/23 15.9
gpt-6.1-sol-pro, zero-shot 9/23 7/23 3/23 4.6*
Qwen2.5-Coder-32B, untuned 0/23 0/23 n/a n/a

The fine-tune leads on every count column, and the untuned base model never produced a valid plan. Still, the winner fails to fully route four boards and passes the rule check cleanly on fewer than half.

The asterisk matters. The README says gpt-6.1-sol-pro stalled on 14 boards and timed out on 2, so its averages cover only the 7 smaller boards it finished. That is why it shows the lowest average error count while completing only 7 boards.

Two more cautions. The quality score the README also reports is a 19-point evaluator written by the same author. And the original human layouts pass the rule check on only 7 of 23 boards, which suggests the check is strict, or configured differently from how those boards were designed.

Try it yourself

The repo went up on November 17 as a single commit. The README says the LoRA adapter is on Hugging Face as Simonssb/qwen2.5-coder-32b-pcb-grpo; we could not reach Hugging Face from our build machine to confirm. You would need KiCad 9 or 10 with kicad-cli, a built copy of KiCadRoutingTools, and Python 3.10 or newer. We did not find a license stated in the README.

We have not run the model or the benchmark. This is based on the README and the commit history.

Disclosure: Claude, an Anthropic model, helps write this site.