Introduction
In Electronic Design Automation (EDA), accurately modeling the functional behavior of circuits is essential for tasks ranging from logic verification to power prediction. While Message Passing Neural Networks (MPNNs) and Graph Transformers have become popular tools for graph-based learning, they often struggle with the specific requirements of logic circuits. This paper introduces TRACE (Transformer for Reasoning about Algebraic and Computational Expressions), a framework designed to bridge the architectural gap between standard graph neural networks and the structured, sequential nature of digital computation.
The Architectural Mismatch
The authors identify three fundamental reasons why traditional graph models fail to capture circuit functionality effectively:
- Permutation Invariance: Standard MPNNs treat inputs as unordered sets. However, in logic gates like Multiplexers (MUX), the specific position of an input (e.g., the select signal vs. data inputs) is critical to the output.
- Lack of Hierarchy: Computation in a circuit follows a strict topological order. Vanilla Transformers that flatten graphs into sequences often lose this explicit hierarchy.
- Reconvergence Complexity: Signals in real-world circuits frequently split and merge (reconvergence), creating intricate global dependencies that are difficult for local message-passing schemes to resolve.
The TRACE Framework
TRACE addresses these challenges through two primary innovations: a Hierarchical Transformer architecture and a Function Shift Learning objective.
Hierarchical Transformer
Instead of processing the entire graph at once, TRACE operates level-by-level in topological order. Each computation step is represented as an ordered sequence: [Operator, Input_1, Input_2, ...]. By applying a Transformer encoder with positional encodings to these sequences, the model becomes position-aware, allowing it to distinguish between different input roles for the same gate. This self-attention mechanism captures complex, operator-specific interactions among multiple inputs simultaneously.
Function Shift Learning (FSL)
Directly predicting the "Global Function" (the true logic-1 probability) of a node is computationally taxing due to reconvergence. TRACE simplifies this by decomposing the problem into two parts:
- Local Function: A simple, fast approximation that assumes input independence.
- Function Shift: The discrepancy between the local approximation and the true global function caused by the circuit's specific topology.
By training the model to predict only this "shift," TRACE avoids relearning basic logic for every new circuit and focuses on how wiring distortions affect local logic. During inference, the global function is reconstructed iteratively.
Experimental Results
TRACE was evaluated across multiple circuit modalities, including Register Transfer Level (RTL), And-Inverter Graphs (AIG), and Post-Mapping (PM) Netlists.
Predictive Accuracy and Stability
In logic-1 probability prediction, TRACE achieved a remarkably low Mean Absolute Error (MAE) of 0.015 on AIGs and 0.013 on PM Netlists. A key finding was the model's resilience to error accumulation. Unlike many iterative models where errors compound as logic depth increases, TRACE maintains stable performance even at high logic levels.
Functional Equivalence
In contrastive learning tasks aimed at identifying functionally equivalent circuits, TRACE significantly outperformed baselines. It achieved a 94.45% Recall@1 on RTL benchmarks, compared to approximately 88% for the best previous models. On PM Netlists, TRACE reached 90.81%, while some competing Graph Transformers saw performance drop as low as 15%.
Conclusion
TRACE demonstrates that by aligning model architecture with the inherent structure of the problem—specifically through position-awareness and hierarchical processing—it is possible to "learn to compute" with high precision. While the iterative nature of the level-by-level inference presents a potential bottleneck for extremely deep designs, the significant gains in accuracy and stability make it a powerful new paradigm for EDA and computational reasoning.
Summary updated