Local LLM-Assisted PCB Review with EMI Ray Tracing Validation
This article explains how to use a locally deployed large language model to review DRC (Design Rule Check) results for PCB design, and how to validate high-risk recommendations through EMI ray tracing simulation. It covers a five-layer architecture built around data contracts, two common pitfalls (feeding raw JSON directly to the model and output drift under long contexts), a practical simulation verification workflow, and engineering metrics for production deployment. The core message: a local model becomes a trustworthy review assistant only when normalized JSON, constrained structured output, and physics-based simulation form a closed loop.
Background: Why Let a Local Model “Read the Board”
In the late stages of PCB design, Design Rule Check (DRC) produces large volumes of structured output: rule IDs, severity levels, coordinates, net names, layer names, object types, constraint thresholds, actual values, units, and version information. Traditional manual review relies on engineers going through results one by one, using experience to decide which items are false positives, which are high risk, and which require layout or stackup changes. As board complexity grows, so does the volume of DRC results, and manual sorting and classification alone becomes inefficient.
The goal of introducing a local LLM is not benchmark scores. It is to have the model read the DRC-exported JSON and accomplish three things: first, consolidate scattered rule violations into readable problem clusters; second, combine net, coordinate, and layer information with design intent to propose candidate causes and fixes; third, attach evidence references to every suggestion so engineers can review them and verify them through simulation. Local deployment is chosen because PCB design data is sensitive and inference must run inside the private network. A mid-sized model runs on a single 32 GB GPU—in our tests the model itself occupied about 23 GB of VRAM—leaving limited headroom for context caching, concurrency control, and simulation pre/post-processing. Context length and concurrency must therefore be carefully managed.
The overall pipeline can be abstracted as: DRC result collection → JSON normalization → hierarchical chunking → local model review → structured output validation → evidence filtering and dedup/ranking → EMI ray tracing validation → rule/prompt template write-back. This article focuses on the most error-prone part—getting the model to read JSON correctly—and on how ray tracing simulation provides physical evidence for model recommendations.
Overall Architecture: Data Contracts First, Model Does Controlled Inference Only
A reusable board-review assistant should never paste raw DRC JSON directly into a prompt. A data contract must come first. We recommend five layers.
Collection layer: Export DRC results from the design tool, preserving rule IDs, object IDs, net names, layers, coordinates, units, severity, thresholds, actual values, creation time, and tool version. Preserve parent-child relationships between objects where possible, e.g., “via – owning net – adjacent layers – reference plane.”
Normalization layer: Unify the schema version, apply field whitelists, normalize units, transform coordinates, map severity levels, standardize net names, and aggregate duplicate violations. DRC results often contain the same physical issue hit by multiple rules; without aggregation, the model drowns in redundant information.
Inference layer: The local inference service hosts a mid-sized model and chunks input by token budget. Each chunk contains one object or a group of highly related objects, plus a global summary (layer count, critical nets, rule distribution, severity statistics). Model output must follow a fixed JSON schema containing issue type, affected objects, evidence IDs, suggested action, confidence, and a verifiability flag.
Validation layer: Validate model output against the schema, check that evidence IDs exist, verify net/layer name legality, and enforce an action whitelist. Any suggestion referencing a nonexistent rule or object is down-weighted or discarded outright.
Verification layer: Convert high-risk suggestions into geometric or net changes and feed them into EMI ray tracing simulation. Compare near-field peaks, coupling coefficients, shielding effectiveness, surface current distribution, and far-field patterns before and after the change. Simulation-confirmed patterns are written back as rules or prompt templates; unconfirmed suggestions are down-weighted and routed to manual review.
Pitfall 1: Feeding DRC JSON to the Model as Plain Text
The first classic mistake is “JSON looks like text, so just stuff it into the model.” DRC JSON is often deeply nested, field-heavy, and version-inconsistent. Direct input causes four categories of problems.
- Structural loss: The model may misassign a parent object’s layer information to a child object, mistake a warning for an error, or mix up coordinates across different nets.
- Version drift: Different design tool versions or rule set versions use different field names. Without a schema description, the model guesses based on common fields and misreads the data.
- Unit and coordinate misjudgment: mil vs. mm, absolute vs. relative coordinates, layer-local vs. board-level coordinates get mixed, making the model’s “position suggestions” unexecutable.
- Untraceable evidence: The model generates plausible-looking suggestions that cannot be mapped back to specific rule IDs and object IDs, increasing rather than reducing manual review cost.
The solution is “normalize first, chunk second, enforce structured output last.” In the normalization stage, convert DRC records into a stable internal structure, for example:
{"schema_version": "drc-audit/v1","board": {"layers": 8, "units": "mm"},"records": [{"evidence_id": "R-001","rule_id": "CLR-001","severity": "high","object_type": "trace","net": "NET_A","layer": "L2","location": {"x": 12.3, "y": 45.6},"actual": 0.15,"limit": 0.20,"message": "Clearance violation"}]}
The prompt only allows the model to reference evidence_id, and the output schema is fixed:
{"issues": [{"type": "clearance|return_path|via_stub|shielding|other","evidence_ids": ["R-001"],"affected_nets": ["NET_A"],"risk": "high|medium|low","action": "move_trace|add_via|change_layer|adjust_plane|manual_review","confidence": 0.0,"verifiable_by_simulation": true}]}
Post-processing does three things: verify that evidence_ids exist in the current chunk; verify that affected_nets are in the legal net list; verify that action is whitelisted. Even if the model hallucinates, the data contract blocks it.
Pitfall 2: Output Drift and Over-Generalized Suggestions Under Long Contexts
The second classic mistake is “once results pile up, the model starts generalizing.” DRC results easily reach thousands of entries, and VRAM and context budgets prevent feeding everything at once. After chunking, if there is no global summary, the model fixates on local details and produces correct-but-unexecutable generic advice like “widen the trace” or “add ground vias.” If chunks overlap too much, you get duplicate suggestions and mutually contradictory rankings.
The engineering recommendation is a “hierarchical summary + local chunks + aggregation dedup” strategy. The global summary contains only statistics and an index of high-risk objects; local chunks contain the concrete records. After model output, aggregate with rules: merge suggestions within the same net, same layer, and same coordinate neighborhood; when the same evidence ID is cited multiple times, keep the entry with the highest confidence and the most specific action; down-weight entries whose actions are too generic and lack geometric parameters.
Inference parameters also need control. Review tasks do not need high randomness: keep temperature low, limit output length, and require JSON-only output. For entries the model cannot judge, allow it to output manual_review instead of forcing a suggestion. For a roughly 14B-parameter local model on a single 32 GB GPU, reserve space for context caching: cap records per chunk, limit concurrency, and set timeouts and retries. Failed chunks fall back to a rules engine so the batch review is never blocked.
Pseudocode:
def audit(drc_records, model_service):norm = normalize(drc_records)chunks = split_by_hierarchy(norm, token_budget)candidates = []for chunk in chunks:prompt = build_prompt(global_summary(norm), chunk, AUDIT_SCHEMA)raw = model_service.complete(prompt, temperature=0.1, max_tokens=LIMIT)parsed = parse_and_validate(raw, AUDIT_SCHEMA)candidates.extend(filter_evidence(parsed, chunk))merged = dedup_and_rank(candidates)return merged
How EMI Ray Tracing Simulation Provides Validation
Model review produces “candidate risks,” not final conclusions. The value of EMI ray tracing simulation is physical verification: does the proposed change actually improve electromagnetic behavior? The recommended workflow:
Filter verifiable suggestions: Only simulate suggestions that can be converted into geometric, stackup, net, or shielding-structure changes. Pure text descriptions or suggestions lacking coordinates go to manual review.
Build a baseline model: Import the stackup, material parameters, simplified models of traces/vias/components, excitation sources, boundary conditions, and frequency sweep settings. Run the baseline first and record near-field peaks, coupling coefficients of critical nets, shielding effectiveness, surface current density, and far-field patterns.
Apply candidate changes: Modify trace spacing, reference plane integrity, via placement, shielding can openings, or stackup structure according to the model’s suggestion. Change only one variable at a time to avoid attribution difficulty from multi-factor coupling.
Ray tracing comparison: Run ray tracing under identical excitation and boundary conditions, and compare metrics before and after. Check whether reflection, diffraction, and transmission paths are reduced, whether return paths are shorter, and whether coupling peaks have dropped.
Statistics and write-back: Pair “model suggestion – simulation result,” and compute hit rate, false positive rate, and risk-ranking consistency. Simulation-confirmed patterns are codified as rules or prompt templates; unconfirmed suggestions are down-weighted, with failure reasons recorded—e.g., oversimplified simulation models, uncertain material parameters, or mismatched frequency ranges.
Pseudocode:
def verify(candidate, pcb, sim_config):if not candidate.action_is_geometric():return "not_verifiable"baseline = run_ray_tracing(pcb, sim_config)modified = apply_change(pcb, candidate.change)after = run_ray_tracing(modified, sim_config)return compare_metrics(baseline, after, candidate.risk_type)
Engineering Recommendations and Evaluation Metrics
For production deployment, version the “model version, prompt template version, DRC schema version, and simulation configuration version” together. On the inference service side, watch VRAM budget, context length, concurrency, timeouts, and retries. On the data side, focus on data masking, access control, and audit logging. On the results side, track structured-output validity rate, evidence citation accuracy, suggestion executability rate, simulation hit rate, false positive rate, and manual review time.
In summary, the key to local mid-sized model-assisted PCB review is not model benchmark scores, but three things: building a data contract with normalized JSON, constraining model behavior with chunking and structured output, and providing physical evidence for high-risk suggestions through EMI ray tracing simulation. Only when these three form a closed loop does the model evolve from “can read text” into “a reviewable board-review assistant.”
