TL;DR
Standard Graph Neural Networks fail at modeling computational graphs because permutation-invariant aggregation cannot handle ordered operations (like multiplexers), while vanilla Graph Transformers flatten away critical hierarchical traces. TRACE resolves this by pairing a prefix-notation-inspired Hierarchical Transformer that evaluates nodes level-by-level with Function Shift Learning, a decoupled objective predicting only the discrepancy caused by topological reconvergence. The result is state-of-the-art performance across RTL, AIG, and post-mapping netlist circuit benchmarks.
What Problem Does This Paper Address?
Computational graphs represent variables as data-flow edges and operations as nodes. They are ubiquitous in software compilation (CDFGs) and electronic design automation (EDA). However, mainstream graph models fundamentally clash with the physics of computation:
- Order Matters: Message Passing Neural Networks (MPNNs) rely on permutation-invariant aggregation (sum, mean, max). For an operator like a multiplexer ($\text{MUX}(S, A, B) \neq \text{MUX}(A, S, B)$), input ordering dictates behavior. MPNNs treat inputs symmetrically and model them in isolation.
- Hierarchy Matters: Fully connected Graph Transformers flatten graphs into token sequences, obliterating intermediate computation steps. Conversely, edge-masked transformers often degrade into weighted averages (GATs) that fail to express non-linear logical interactions.
- Reconvergence Distorts Logic: Shared upstream inputs create subtle correlations downstream (e.g., reconvergent fanout). Predicting global functionality directly forces models to entangle local gate logic with complex, non-local topological correlations.
Methods
TRACE (Transformer for Reasoning about Algebraic and Computational Expressions) introduces two core innovations:
-
Hierarchical Transformer Backbone: Following topological levels from primary inputs to outputs, TRACE models each local computation step as a prefix-notation sequence: $$\mathbf{v}_i^k = [\text{operator}, \text{input}_1, \text{input}_2, \dots]$$ Augmented with positional encodings, this sequence enters a Transformer encoder. Positional encodings capture input order, while self-attention captures rich, non-linear gate interactions. The transformed operator token becomes the output representation for that step.
-
Function Shift Learning (FSL): Instead of directly regressing global output probabilities—which requires an exponential $O(2^k)$ enumeration across correlated inputs—TRACE decomposes global function into two terms: $$y^{\text{global}} = y^{\text{local}} + y^{\text{FSL}}$$ Here, $y^{\text{local}}$ is an $O(1)$ analytical approximation assuming inputs are strictly independent. The model only learns $y^{\text{FSL}}$, the residual "shift" caused by reconvergence. At inference time, global states are reconstructed iteratively, level by level.
-
Dual Task Training: The backbone is trained using contrastive learning (InfoNCE loss over functionally equivalent transformed circuits) and predictive regression for node-level logical properties.
Prefix Sequence: [Op, In1, In2] ──► Positional Encoding + Transformer ──► Step Output
Prediction Target: Global Function = Local Approx (Independence) + Learned Shift
Datasets
The authors evaluated TRACE across three circuit representations:
- Register-Transfer Level (RTL): Sourced from the ITC'99 and OpenCores benchmarks.
- And-Inverter Graphs (AIGs): Combinational AIGs from ForgeEDA; Sequential AIGs from DeepSeq2 (incorporating ITC, OpenCores, and ISCAS'89).
- Post-Mapping (PM) Netlists: Extracted from ForgeEDA and DeepCircuitX.
- Citation Graphs (Analysis only): Cora, CiteSeer, and PubMed DAGs were analyzed to contrast their degree distributions against circuit graphs.
Key Insights and Ideas
- Computational graphs have low degree variance: In social or citation DAGs, long-tailed in-degrees cause massive padding redundancy (~96–97%). Because circuit gates have small, strictly bounded in-degrees (often 1–4 inputs), TRACE incurs only 16–42% padding overhead, making local sequence modeling remarkably practical.
- Residual modeling tames reconvergence: Reconvergent fanout is the bane of boolean modeling. By framing global prediction as a residual correction over an independent local baseline, the network does not waste capacity re-learning basic boolean logic from scratch.
Key Results
- Functional Retrieval (Contrastive Tasks):
- RTL: Recall@1 reached 94.45% (vs. 88.28% for DIFFormer/CircuitEncoder).
- AIGs: Recall@1 reached 92.68% (vs. 88.73% for FGNN2). Fully connected transformers (SGFormer, DIFFormer) collapsed to 15–37%, while GraphGPS ran out of memory (OOM).
- PM Netlists: Recall@1 reached 90.81% (vs. 86.12% for GraphSAGE and 80.99% for DeepCell).
- Property Prediction:
- Combinational AIGs: Reached $R^2 = 0.989$ on Logic-1 probability and jumped from $R^2 = 0.502$ (prior best, DeepGate2) to $0.633$ on functional similarity prediction.
- Sequential AIGs: Transition probability prediction achieved $R^2 = \mathbf{0.976}$ (vs. 0.908 for DeepSeq2).
- PM Netlists: Logic-1 prediction reached $R^2 = \mathbf{0.994}$ with a minimal MAE of 0.013.
- Ablation: Removing FSL dropped netlist prediction $R^2$ from 0.994 to 0.985 and nearly tripled the MAE (0.013 to 0.036).
Limitations and Future Work
- Handling Cyclic Logic: Cyclic graphs (sequential logic with feedback loops) are handled by severing feedback edges and treating memory elements (registers/flip-flops) as pseudo-primary inputs. End-to-end recurrent or unrolled cyclic execution was not implemented natively.
- Sequential Layer Dependencies: Inference requires an iterative level-by-level forward pass along the topological depth, which restricts full graph-wide parallel execution during the reconstruction step.
- Domain Breadth: Validation was restricted to digital circuits. While the prefix formulation naturally maps to software control-data flow graphs (CDFGs) and SMT/Btor2 hardware verification formulas, empirical evaluation on non-EDA computational graphs remains future work.
Summary updated