Skip to main content
Back

Chinese Academy of Sciences Turns Buggy AI-Written Chip Code Into Training Gold

Researchers show that LLM-generated RTL code, even when functionally wrong, produces netlists with enough structural signal to train competitive chip analysis models

Pro

Paper, Full Access
  • Core finding: LLM-generated RTL code, even when functionally incorrect, produces netlists that preserve structural patterns sufficient for training circuit analysis models.
  • Framework: An end-to-end pipeline generates diverse RTL via LLMs, filters netlists by structural similarity and LLM-based architecture voting, then trains a GNN on the synthetic corpus.
  • Operator-level result: Best synthetic dataset hit 93.79% F1-Macro, beating the real-data baseline (90.15%) with no human-labeled examples.
  • IP-level result: Full framework achieved 68.35% F1 on unseen NEORV32 SoC boundary detection, vs. 58.28% for rule-based augmentation.
  • Key limitation: F1 variance across synthetic runs is high (84-94%), and a reference netlist is needed for the similarity filter.
  • No code release yet; paper available at arxiv.org/abs/2603.09161.

Training machine learning models to understand chip designs has always run into the same wall: the data is locked away. Real-world netlists are proprietary, annotated datasets are tiny, and the benchmarks everyone uses are decades old. A new paper from the Chinese Academy of Sciences proposes a way around this bottleneck by leaning into something that would normally be considered a flaw: LLMs that generate buggy hardware code.

Why Netlists Are So Hard to Learn From

A netlist is what you get after a chip design written in RTL (Register-Transfer Level, a hardware description language like Verilog) is compiled down by a synthesis tool into a graph of individual logic gates and wires. Think of it as the assembly code of chip design. The paper targets netlist representation learning, the task of training a Graph Neural Network (GNN) to embed these gate-level graphs into vectors that capture what each sub-circuit actually does.

This matters for a range of high-stakes applications:

  • IP piracy detection: identifying when a chip design has been illegally copied
  • Hardware trojan detection: spotting malicious circuits inserted into a design
  • Reverse engineering: recovering the intended function of an unknown chip
  • Sub-circuit boundary identification: partitioning a flattened netlist back into its functional blocks

These data-driven approaches are severely bottlenecked by high-quality data scarcity. Acquiring large-scale netlists with annotated boundaries is virtually infeasible due to IP protection, confining the task scope to operator-level classification. The standard benchmarks, ISCAS-85 and EPFL, are tiny and clean, nothing like the messy, million-gate SoCs found in real products.

The Counterintuitive Insight

LLMs can generate Verilog at scale, but they are notoriously unreliable at getting the logic right. A generated adder might compute the wrong sum. A generated multiplier might have off-by-one errors in its carry chain. Conventional wisdom says this makes LLM-generated RTL useless for circuit analysis training data. The authors disagree.

Their core observation: even when LLM-generated RTL is functionally wrong, the synthesized netlist still looks structurally like the intended circuit. A broken carry-lookahead adder still has the characteristic gate topology of a carry-lookahead adder. The synthesis tool, which maps RTL to gates mechanically, preserves the architectural skeleton even when the arithmetic is off. Structure, it turns out, is partially decoupled from function.

This is what the paper calls "Wrong Code, Right Structure," and it forms the entire foundation of the framework. If a GNN only needs to learn what an adder or a CPU core looks like structurally, it does not need functionally verified training data.

The Pipeline, Step by Step

The framework has three stages: data augmentation, representation learning, and downstream classification. The augmentation stage is where the novel work lives.

  1. Specification extraction. Given an existing RTL file or a user-written description, an LLM extracts a plain-language functional specification. This spec, not the original code, becomes the generation prompt.
  2. Diverse RTL generation. The LLM generates multiple synthesizable RTL implementations from the spec, using a temperature of 0.8 to encourage variation. A debug agent reads synthesis error logs and patches the code until it compiles. The key here is that regenerating from a spec, rather than mutating existing code, lets the LLM explore genuinely different architectures, like choosing between a ripple-carry and a carry-lookahead adder.
  3. Two-track filtering. Half the generated designs go through a structural similarity filter: the generated netlist is embedded alongside the reference netlist, and cosine similarity must exceed a threshold. The other half go through an architecture voting mechanism: the LLM itself scores batches of 10 designs on architectural diversity and complexity, and the top 3 are kept. This second track is specifically for designs that are supposed to look different from the reference.
  4. GNN training. The filtered netlists are converted into graphs, with each gate as a node carrying features for its logic type (AND, XOR, MUX...), connectivity, and local degree. A GNN trained with GraphSAINT subgraph sampling learns node embeddings over this synthetic corpus.
  5. Downstream tasks. The trained embeddings feed into MLP classifiers for two tasks: node-level sub-circuit boundary identification (which gate belongs to which functional block?) and graph-level component classification (what does this whole netlist do?).

The models used for RTL generation are DeepSeek-V3.2-Exp and GLM-4.6. Synthesis runs on Synopsys Design Compiler targeting a 90nm TSMC standard cell library.

What the Numbers Say

The team ran three tiers of evaluation, each more demanding than the last.

Operator-level identification. Starting from only 37 annotated netlists (the baseline from GNN-RE), the framework generated synthetic training sets of comparable size. The best synthetic set, LLM-Aug-t2, hit an F1-Macro of 93.79%, beating the baseline's 90.15% by 3.64 percentage points, using only LLM-generated data and no real labeled examples.

Generalization to unseen architectures. When tested on architectural variants not seen during training, the Architecture Voting mechanism pushed F1-Micro to 94.45% and F1-Macro to 93.79%, outperforming both the baseline and unfiltered LLM data. Raw LLM data without filtering actually hurt generalization slightly compared to the baseline, confirming that the voting mechanism is doing real work.

IP-level SoC boundary detection. This is the most ambitious test. The model was trained on augmented data derived from the PicoRV32 RISC-V CPU, then evaluated on the completely unseen NEORV32 SoC, with the goal of identifying the CPU core boundary inside a flattened, unlabeled netlist. Results:

MethodPrecision (%)Recall (%)F1 (%)
Rule-Based (logic rewriting)53.4564.0658.28
LLM-Raw (no filtering)58.9062.0660.44
LLM-Filtered (full framework)71.0265.8768.35

The structural similarity filter alone drove a 12-point jump in precision, from 58.90% to 71.02%, and an 8.31-point gain in F1 over unfiltered LLM data. The rule-based baseline, which uses logic rewriting to generate variants, came in last, confirming that gate-level topology mutations cannot substitute for architectural diversity.

What It Cannot Do Yet

The framework has real limitations worth noting. Performance across different synthetic training runs varies substantially: F1-Macro ranged from 84.62% to 93.79% across five runs at the operator level, meaning the quality of a given synthetic corpus is not fully predictable. The structural similarity filter also requires a reference golden netlist to compare against, which may not always be available. And the IP-level F1 of 68.35%, while a clear improvement, still leaves meaningful room for error in production security auditing scenarios where false negatives carry real risk.

The Bigger Picture

Electronic circuit design automation has evolved from deterministic, heuristic-driven algorithms toward stochastic, agentic AI frameworks. Early applications of ML in EDA focused on localized optimization within the physical design flow, employing GNNs for netlist representation and parasitic estimation. This paper fits squarely into a broader push to bring data-hungry deep learning methods to a domain where data is structurally scarce due to IP law, not just collection difficulty.

The real breakthrough is not the accuracy numbers. It is the demonstration that functional correctness is not a prerequisite for structural utility. This reframes how the community should think about LLM-generated hardware code: a model that writes a broken multiplier is not useless, it is a free data point for training a circuit analysis system. That is a meaningful shift in perspective for anyone working on EDA tooling, hardware security, or chip design automation.

No code or pretrained models have been released alongside the paper at this time. The work is from the Institute of Computing Technology at the Chinese Academy of Sciences and is available on arXiv.