Manuscript Offprint

arXiv:2609.05327

LLM-Driven Algorithm Design for Quantum Circuit Synthesis based on Binary Decision Diagrams

Yoonju Sim, Federico Berto, Chuanbo Hua, Jinkyoo Park, Changhyun Kwon

Yoonju Sim¹

syj5268@kaist.ac.kr

Federico Berto²

berto.federico2@gmail.com

Chuanbo Hua¹

cbhua@kaist.ac.kr

Jinkyoo Park¹,³

jinkyoo.park@kaist.ac.kr

Changhyun Kwon¹,³,†

chkwon@kaist.ac.kr

¹ Department of Industrial and Systems Engineering, KAIST, Daejeon, 34141, Republic of Korea

² Radical Numerics, California, USA

³ Omelet, Inc., Daejeon, 34051, Republic of Korea

† Corresponding author

Abstract

Quantum circuits are central to implementing quantum algorithms on quantum devices, where quantum gates must be reversible. Many quantum algorithms rely on Boolean functions, which must therefore be implemented reversibly within quantum circuits. Reversible circuit synthesis provides a way to translate such Boolean functions into reversible circuits. Binary decision diagrams (BDDs) offer a scalable approach to this task, but the resulting BDDs and circuits depend heavily on variable ordering. Existing ordering heuristics commonly minimize BDD size because it is closely tied to the circuit size. However, BDD size is an imperfect proxy for the quantum cost of the synthesized circuit (QCC). We propose QuantumEvo, an evolutionary framework that uses an LLM as a heuristic generator for QCC-aware BDD variable ordering. Instead of predicting orderings directly, QuantumEvo searches over ordering heuristics initialized from multiple heuristic families. Candidate heuristics directly manipulate variable orderings using standard BDD operations and are selected by downstream QCC. The discovered heuristic, HGA-QE, modifies the sifting step inside a genetic algorithm so that the procedure is better aligned with QCC. Across the benchmark set, HGA-QE achieves a 70.9% tie-or-win rate against the per-function best baseline and is strictly best on 13.5% of the functions. The results demonstrate broadly competitive QCC performance, with HGA-QE showing a clearer relative advantage in strict wins on the two benchmark suites drawn from sources different from the data used for heuristic discovery.

1 Introduction

Quantum computing has attracted increasing attention with advances in both quantum algorithms and quantum hardware (Fedorov et al., 2022; Blekos et al., 2024; Bluvstein et al., 2024). To run a quantum algorithm on a quantum device, its operations must be expressed as a quantum circuit, i.e., a cascade of quantum gates. Since quantum operations are unitary, quantum circuits are reversible in nature. Many quantum algorithms contain Boolean components, such as oracle functions (Grover, 1996; Simon, 1997) and arithmetic subroutines (Vedral et al., 1996). To implement such components in a quantum circuit, a Boolean function must be embedded into a reversible transformation. Reversible circuit synthesis addresses this task by translating Boolean functions into reversible circuits that can be mapped to a target gate library (Shende et al., 2003; Wille et al., 2016). The quality of a synthesized circuit is often evaluated by its quantum cost, which reflects the cost of implementing the circuit under a quantum gate library. We refer to this metric as the quantum cost of the synthesized circuit (QCC).

Several approaches have been developed for reversible circuit synthesis, including transformation-based (Miller et al., 2003) and cycle-based (Saeedi et al., 2010). Such methods can produce high-quality circuits for small functions, but their scalability is limited as the number of inputs grows. A BDD-based synthesis aims to improve scalability by representing a Boolean function as a binary decision diagram (BDD) and translating the resulting BDD structure into a reversible circuit (Wille et al., 2009). Since variable ordering strongly affects the resulting BDD, and the BDD size provides an upper bound on the circuit size, minimizing the BDD size is a common objective for ordering methods. Previous studies on variable ordering methods, including metaheuristics (Bollig et al., 1995; Awad et al., 2022) and learning-based methods (Miao et al., 2026), have used the BDD size as an objective. However, BDD size is an imperfect proxy for QCC. A smaller BDD does not necessarily imply a lower QCC. This motivates the search for BDD variable ordering heuristics that directly reduce downstream QCC.

We formulate this as a heuristic design problem. The goal is to discover a reusable BDD variable ordering heuristic that maps each Boolean function to a variable ordering with low QCC. Recent LLM-driven algorithm design methods use LLMs to explore a broader space of heuristic programs beyond a predefined set (Novikov et al., 2025; Ye et al., 2024; Liu et al., 2026; Huang et al., 2026). Building on this idea, we propose QuantumEvo¹, an evolutionary framework that uses an LLM as a heuristic generator. It initializes the search from multiple heuristic families and evaluates executable heuristics that manipulate variable ordering using standard BDD operations.

Our main contributions are as follows: (1) We formulate QCC-aware BDD variable ordering as a heuristic design problem and introduce QuantumEvo, an LLM-driven heuristic search framework that evaluates executable ordering heuristics using downstream QCC rather than BDD size; (2) QuantumEvo discovers HGA-QE, an effective hybrid genetic algorithm that replaces standard sifting with an LLM-discovered targeted sifting procedure better aligned with downstream QCC. Across the benchmark set, HGA-QE demonstrates broadly competitive QCC performance against both classical and learning-based baselines, with a clearer relative advantage in strict wins on the two benchmark suites drawn from sources different from the data used for heuristic discovery.

References (82)

  • A genetic algorithm (GA) and swarm-based binary decision diagram (BDD) reordering optimizer reinforced with recent operators
  • A review on quantum approximate optimization algorithm and its variants
  • Nature, 626(7997):58–65, 2024
  • Improving the variable ordering of OBDDs is NP-complete
  • Simulated annealing to improve variable orderings for OBDDs
  • Exploring hyper-heuristic methodologies with genetic programming
  • Hyper-heuristics: A survey of the state of the art
  • Flowmap: An optimal technology mapping algorithm for delay optimization in lookup-table based fpga designs
  • Reversible optical computing circuits
  • HSEvo: Elevating automatic heuristic design with diversity-driven harmony search and genetic algorithm using LLMs
  • Genetic algorithm for variable ordering of OBDDs
  • Synthesis of fully testable circuits from BDDs
  • Quantum computing at the quantum advantage threshold: a down-to-business review (opens arXiv in a new tab)
  • Finding the optimal variable ordering for binary decision diagrams
  • QuanBench: Benchmarking quantum code generation with large language models
  • CALM: Co-evolution of algorithms and language model for automatic heuristic design
  • Agent-Q: fine-tuning large language models for quantum circuit generation and optimization
  • R. Landauer. Irreversibility and heat generation in the computing process. IBM Journal of Research and Development, 5(3):183–191, 1961. doi: 10.1147/rd.53.0183. (opens the publisher in a new tab)
  • A genetic programming hyper-heuristic approach for the multi-skill resource constrained project scheduling problem
  • EoH-S: Evolution of heuristic set using LLMs for automated heuristic design
  • Linear sifting of decision diagrams
  • BDD2Seq: Enabling scalable reversible-circuit synthesis via graph-to-sequence learning
  • A transformation based algorithm for reversible logic synthesis
  • AlphaEvolve: A coding agent for scientific and algorithmic discovery
  • Who are the variables in your neighbourhood
  • Symmetry detection and dynamic variable ordering of decision diagrams
  • Denis V. Popel. Synthesis of low-power digital circuits derived from binary decision diagrams, 2002. URL https://arxiv.org/abs/cs/0207012. (opens arXiv in a new tab)
  • Nature, 625:468–475, 2024
  • Synthesis and optimization of reversible circuits—a survey
  • Reversible circuit synthesis using a cycle-based approach
  • Synthesis of reversible logic circuits
  • LLM-based automatic heuristic design for vehicle-drone collaborative routing problems
  • RevKit: a toolkit for reversible circuit design
  • A fast symbolic transformation based algorithm for reversible logic synthesis
  • Low quantum cost realization of generalized peres and toffoli gates with multiple-control signals
  • Quantum networks for elementary arithmetic operations
  • Qiskit humaneval: An evaluation benchmark for quantum code generative models
  • LLM-assisted adaptive large neighborhood search for agile earth observation satellite scheduling
  • Towards a design flow for reversible logic
  • Revlib: An online resource for reversible functions and reversible circuits
  • BDD-based synthesis of reversible logic for large functions
  • From reversible logic to quantum circuits: Logic design for an emerging technology
  • Yosys – a free Verilog synthesis suite
  • QCircuitBench: A large-scale dataset for benchmarking quantum algorithm design
  • Multi-Objective evolution of heuristic using large language model
  • ReEvo: Large language models as hyper-heuristics with reflective evolution
  • Large language model-driven large neighborhood search for large-scale milp problems
  • Trajevo: Trajectory prediction heuristics design via LLM-driven evolution
  • Monte Carlo tree search for comprehensive exploration in LLM-based automatic heuristic design
  • The NOT gate flips a single bit $(x \mapsto \bar{x})$
  • This shows that variable ordering can affect both BDD size and QCC
  • The classical baselines implemented in CUDD are:
  • To increase the diversity of the search pool, we augment RevLib
  • It uses the same evolutionary procedure, fitness function, initialization scheme, and search and validation sets as QuantumEvo, differing only in heuristic generation
  • gpt-oss-120b (120B-parameter open-source MoE, Apache 2.0) and gpt-5.4-mini (OpenAI API)
  • Runs with gpt-oss-120b select SA-family individuals in 9 of 10 runs, whereas runs with gpt-5.4-mini more often converge to sifting-family individuals
  • ><tr><td rowspan=
  • For each setting, we pool all candidates evaluated across its ten runs, rank them by their logged search-set performance, and evaluate the top 5 and top 10 candidates on the validation set
  • Dashed lines separate the guidance, initialization, and fitness comparisons
  • The analysis reuses candidates and runtime logs from the completed searches and characterizes sensitivity within the observed search outcomes
  • HGA-QE ranks first in 5 of these 10 search sets, although the top-ranked candidate varies across sets
  • We repeat this selection using nine alternate 50-function validation sets and report the same-run rate in Table 8
  • Rates denote top ranking of HGA-QE among 30 candidates or reselection of the original validation finalist
  • ><tr><td>Analysis</td><td>Initialization</td><td>Fitness</td><td>Guidance</td><td>Rate</td></tr><tr><td>Search set</td><td>Multi-seed</td><td>QCC</td><td>gpt-oss-120b</td><td>5/10</td></tr><tr><td rowspan=
  • Table 10 maps each pseudocode function to its corresponding CUDD function and source file
  • $W$ = wrapped (unmodified API call), $A$ = adapted, $N$ = new
  • The goal is to understand why MINISIFT can improve downstream QCC
  • The unique fraction is the fraction of distinct candidate orderings among the final GA population
  • The Wilcoxon signed-rank test additionally uses the ranks of the absolute paired differences, and therefore accounts for both the direction and relative magnitude of the changes
  • Diversity rows use all search-set functions and three seeds; the remaining rows use cases in which both methods produce the same BDD size but MINISIFT lowers QCC. The change is relative to the standard sifting
  • Gray nodes are referenced by at least two parents and indicate candidate sites for child-node line preservation
  • Mean $\Delta$QCC measures the average size and direction of the difference, where a negative value favors HGA-QE
  • ><tr><td>Method</td><td>Stage</td><td>Success</td><td>Best</td><td>Strict</td><td>Mean Best</td><td>Mean Avg</td><td>Mean Worst</td><td>Geo-mean Runtime (s)</td></tr><tr><td rowspan=
  • For this purpose, each ordered BDD is exported as a Boolean network in which each BDD node is represented as a multiplexer
  • The result is summarized in table 14
  • The offline phase includes LLM inference, candidate generation, compilation, evaluation on the search set, reversible synthesis, and QCC evaluation
  • For every function, the evaluation invokes the reversible-synthesis pipeline twice before computing QCC. With a maximum of 200 candidate evaluations per run, this corresponds to up to approximately 40,000 synthesis calls per run
  • They are tailored to BDD variable ordering heuristic design and to the representation of individuals in C. The remaining operator prompts, including mutation, crossover, and reflection, are available in the accompanying code
  • Pass the lower adjacent level first; 'cuddSwapInPlace(table, curLevel, curLevel - 1)' is wrong
  • RevLib instances are listed in Table 16–Table 20
  • Best and average QCC compared among QuantumEvo, GA, and SA; lowest values bold
  • Best QCC compared among QuantumEvo, BDD2Seq, and deterministic CUDD baselines; lowest values bold