BDD2Seq: Enabling Scalable Reversible-Circuit Synthesis via Graph-to-Sequence Learning
Mingkai Miao, Jianheng Tang, Guangyu Hu, Hongce Zhang
TL;DR
BDDs provide compact representations of Boolean functions, but optimal variable ordering for ROBDDs is NP-hard and critically affects Quantum Cost in reversible-circuit synthesis. BDD2Seq addresses this by learning a graph-to-sequence mapping: a Graph Neural Network encodes circuit structure (via BLIF2Graph) and a Pointer Network decodes variable orderings, guided by Diverse Beam Search to explore diverse, high-quality permutations. Trained on supervised labels from established BDD heuristics and evaluated with Revkit on multiple benchmarks, it achieves substantial reductions in Quantum Cost (about 1.4x) and faster synthesis (about 3.7x) compared with traditional heuristics, particularly for large circuits. The approach demonstrates that graph-based generative modeling, combined with diversity-aware decoding, can robustly improve BDD-based reversible-circuit synthesis with scalable performance and multiple deployment modes for cost-speed trade-offs.
Abstract
Binary Decision Diagrams (BDDs) are instrumental in many electronic design automation (EDA) tasks thanks to their compact representation of Boolean functions. In BDD-based reversible-circuit synthesis, which is critical for quantum computing, the chosen variable ordering governs the number of BDD nodes and thus the key metrics of resource consumption, such as Quantum Cost. Because finding an optimal variable ordering for BDDs is an NP-complete problem, existing heuristics often degrade as circuit complexity grows. We introduce BDD2Seq, a graph-to-sequence framework that couples a Graph Neural Network encoder with a Pointer-Network decoder and Diverse Beam Search to predict high-quality orderings. By treating the circuit netlist as a graph, BDD2Seq learns structural dependencies that conventional heuristics overlooked, yielding smaller BDDs and faster synthesis. Extensive experiments on three public benchmarks show that BDD2Seq achieves around 1.4 times lower Quantum Cost and 3.7 times faster synthesis than modern heuristic algorithms. To the best of our knowledge, this is the first work to tackle the variable-ordering problem in BDD-based reversible-circuit synthesis with a graph-based generative model and diversity-promoting decoding.
