PCBSchemaGen: Reward-Guided LLM Code Synthesis for Printed Circuit Boards (PCB) Schematic Design with Structured Verification
Abstract
Most LLM code-synthesis benchmarks rely on unit tests as the reward oracle, but PCB schematic design has none: correctness is defined by structural constraints over real IC packages and pin-level connections, per-task golden netlists are unavailable, and SPICE simulation does not check schematic-level correctness. We introduce PCBSchemaGen, a training-free inference-time framework that turns a frozen LLM into a verifiable, repairable PCB schematic generator. Its core is a domain schema induced from IC datasheets (a 32-role pin ontology and four constraint-predicate templates) that grounds decoding in real pin constraints. A deterministic layered verifier returns a graded reward with pin-level error localization, and a propose-verify-refine loop repairs candidates from that feedback, with Thompson Sampling over candidates as the default selection policy. We evaluate on two benchmarks with 227 real-IC tasks: PCBBench (62 hand-authored tasks) and Open-Schematics-Eval (165 tasks derived from public schematics). The schema, the verifier, and the PCBBench KG library are frozen before evaluation; Open-Schematics-Eval per-IC entries are populated on demand by the same frozen extraction pipeline. With an open-weight 31B model (Gemma-4-31B), the framework passes 81.3% of PCBBench tasks; removing the schema lowers this to 26.8%, and replacing pin-level feedback with a pass/fail signal lowers it to 57.7%. The same verifier code runs on both suites unchanged, and a Circuitron-style inference-time prompting baseline on the same Gemma-4-31B backbone collapses on hard system-level designs. These results support inference-time refinement under a deterministic structural verifier as a practical approach to PCB schematic design, a domain without unit-test oracles. Code: https://github.com/HZou9/PCBSchemaGen_v2; benchmarks: https://huggingface.co/datasets/Hzou9/PCBSchemaGen-Benchmarks.