In the world of Electronic Design Automation (EDA), understanding a circuit is a dual challenge. Engineers and automated tools must comprehend both the structure (how the gates are physically wired together) and the function (what the circuit actually computes). While Graph Neural Networks (GNNs) have become the go-to tool for modeling these structures, they often struggle to grasp the high-level "logic" of a design.
A new paper, "Circuit Representation Learning with Masked Gate Modeling and Verilog-AIG Alignment," introduces a framework called MGVGA that aims to solve this identity crisis for AI in hardware design.
TL;DR
MGVGA is a self-supervised learning framework that teaches Graph Neural Networks to understand both the physical connectivity and the abstract logic of digital circuits. By masking circuit data in the "latent space" and aligning graph representations with Verilog code via Large Language Models (LLMs), it achieves state-of-the-art performance in logic synthesis tasks and speeds up SAT solving by over 50%.
What Problem Does This Paper Address?
To train a model to understand circuits without needing millions of expensive manual labels, researchers usually rely on "masked modeling"—the same foundational technique used to train large language models like ChatGPT. You hide (mask) part of the data and ask the model to predict what’s missing.
However, circuits are highly "brittle." If you mask a single gate in a circuit graph (specifically an And-Inverter Graph or AIG), you destroy its logical equivalence.
As shown above, there might be a thousand ways to fill a masked hole that are "mathematically" valid graph completions but "logically" wrong for that specific hardware design. Furthermore, while GNNs are great at seeing "wires," they are often blind to the high-level intent of the code (e.g., recognizing that a specific group of gates forms an 8-bit adder).
Methods: The MGVGA Framework
The authors propose a two-pronged strategy called MGVGA (Masked Gate Modeling and Verilog-AIG Alignment) to overcome these limitations.
- Masked Gate Modeling (MGM): Instead of masking gates in the input graph—which breaks the logic—the framework masks the latent representations after the encoder has already processed the whole circuit. This allows the model to use the surrounding context to reconstruct the attributes (gate type and degree) of the masked sections without losing the overall structural integrity of the input.
- Verilog-AIG Alignment (VGA): This is the framework's "secret sauce." LLMs are surprisingly adept at understanding hardware description languages like Verilog. The researchers use an LLM to generate an embedding of the circuit's Verilog code. They then force the GNN to reconstruct a masked version of the circuit graph while being "constrained" by the LLM’s functional understanding. Essentially, the LLM acts as a teacher, telling the GNN: "I know this code describes a multiplier; make sure your graph representation reflects that."
The backbone of the system uses a DeepGCN architecture, chosen specifically for its ability to scale to large circuits where Transformers often fail due to massive memory constraints.
Datasets and Evaluation
The authors compiled a massive dataset to train and test MGVGA:
- AIG Collection: 810,000 AIGs derived from standard benchmarks like MIT LL Labs CEP, ITC’99, and EPFL.
- Verilog-AIG Pairs: 64,826 pairs of source Verilog code and their corresponding synthesized AIGs.
- Evaluation: They tested on 10 external circuit designs (like OpenRISC and Rocket) that the model had never seen during training to ensure true generalization.
Key Insights and Ideas
- Latent Space is Safer: Masking in the latent space preserves "logical equivalence." It prevents the model from learning "shortcuts" based on broken connectivity and forces it to learn the deep relational patterns of the gates.
- LLMs as Functional Translators: The paper highlights that while GNNs see topology, LLMs see semantics. Aligning the two allows the model to bridge the gap between "how it's built" and "what it does."
- The "Shortcut" Problem: The authors noticed that models often cheat by looking at the number of inputs (in-degree) to guess a gate type (e.g., a NOT gate always has exactly one input). To stop this, they introduced "single-input AND gates" during training as a trick to force the model to learn harder, more useful features.
Key Results
MGVGA consistently outperformed the previous state-of-the-art (SOTA), DeepGate2, across multiple EDA tasks:
- Quality of Result (QoR) Prediction: In predicting how well a circuit can be optimized, MGVGA achieved an average NDCG@3 of 0.540, a massive jump from DeepGate2’s 0.334.
- Logic Equivalence: It was significantly better at identifying if two different-looking circuits actually performed the same function (F1-score of 0.470 vs 0.424).
- SAT Solving Acceleration: Perhaps the most practical result—using MGVGA to guide a Boolean Satisfiability (SAT) solver reduced the total runtime by 53.09% on average.
Limitations and Future Work
While powerful, the authors note a few areas for future growth:
- LLM Dependency: The VGA phase relies on an LLM (gte-Qwen2-7B). While this is only needed during training, it adds a layer of complexity to the pipeline.
- Scalability vs. Complexity: They chose GCNs over Transformers to handle millions of gates, but as circuit sizes continue to explode, even more efficient graph architectures may be needed.
- Downstream Integration: The current work focuses on logic synthesis. Future work could extend this to "physical design" tasks like placement and routing, where structural understanding is even more critical.
Check out the code: https://github.com/wuhy68/MGVGA
Summary updated