---
title: Variational Quantum Compilation Overview
url: https://www.emergentmind.com/topics/variational-quantum-compilation
type: topic
---

# Variational Quantum Compilation Overview

Searching arXiv for recent and foundational papers on variational quantum compilation and related compilation-for-VQAs topics.
First search: variational quantum compiling / compilation.
Variational quantum compilation denotes a family of approaches in which compilation is itself treated as an optimization problem over parameterized quantum circuits or, more broadly, over parameterized hardware-level representations of a quantum program. In the most traditional sense, the task is to approximate a target unitary \(U\) by a trainable circuit \(V(\boldsymbol{\alpha})\) so that \(V(\boldsymbol{\alpha})\) reproduces \(U\) exactly or approximately under a compilation cost such as a Hilbert–Schmidt-overlap objective [1908.04416], [2111.10227]. In a broader systems sense, the term also encompasses compilation methods tailored to variational quantum algorithms (VQAs), where the repeated execution of parameterized circuits, the interaction between logical design and hardware-aware transpilation, and the preservation of symbolic parameters become central compilation concerns [2208.07683], [2202.11142], [2210.12166], [2604.16527]. More specialized developments extend the paradigm to Hamiltonian dynamics compilation [2409.16346], [2203.15484], [2303.15667], mixed-state preparation [2209.00528], structured QAOA compilation [2112.06143], and pulse-level or hybrid gate–pulse realizations on superconducting hardware [1909.07522], [2212.00661].

## 1. Concept and scope

In its canonical formulation, variational quantum compiling seeks a parameterized circuit \(V(\boldsymbol{\alpha})\) that approximates a target unitary \(U\), with exact compilation corresponding to equality up to global phase and approximate compilation corresponding to small residual cost [1908.04416], [2103.11611]. A representative global objective is the Hilbert–Schmidt-based cost
\[
C(U,V) = 1-\frac{|\operatorname{Tr}(V^\dagger U)|^2}{d^2},
\]
where \(d=2^n\) for \(n\) qubits; \(C(U,V)=0\) iff \(U\) and \(V\) differ only by a global phase factor [1908.04416], [2103.11611]. Related formulations compile only the action of a unitary on a fixed input state, rather than the full operator, through Loschmidt-echo-style costs [1908.04416], [2203.08514].

A second, increasingly important usage concerns the compilation of VQAs themselves. Here the issue is not only whether a circuit family can express a target unitary, but how a parameterized ansatz should be represented, lowered, verified, and repeatedly executed on constrained hardware [2208.07683], [2202.11142], [2210.12166], [2212.00661]. This broader notion includes compiler support for late binding of gate parameters [2208.07683], runtime rebinding of compiled kernels [2202.11142], symbolic verification of transpiled parameterized circuits [2210.12166], and hardware-aware co-design of the compilation boundary between gate-level and pulse-level abstractions [2212.00661].

This dual usage is not merely terminological. A plausible implication is that the field has split into at least two tightly connected strands: compilation *by* variational optimization of target transformations, and compilation *for* variational workloads whose structure and repeated execution patterns create distinct systems problems [1908.04416], [2208.07683].

## 2. Core formulations and objective functions

A standard VQC setup writes the target of compilation as a unitary \(U\) and the trainable circuit as \(V(\boldsymbol{\alpha})\), often with a fixed architecture and continuous parameters [1908.04416], [2111.10227]. In full-unitary matrix compiling, the principal cost is
\[
C_{\rm HST} = 1 - F_{\rm HST}, \qquad
F_{\rm HST}=|\operatorname{Tr}(V^\dagger U)|^2/d^2,
\]
which is related to average gate fidelity [1908.04416]. Local variants such as
\[
C_{\rm LHST} = 1 - F_{\rm LHST}
\]
replace the global overlap by an average over local Hilbert–Schmidt tests and obey the faithfulness bound
\[
C_{\rm LHST} \le C_{\rm HST} \le n C_{\rm LHST},
\]
so \(C_{\rm LHST}=0\) iff \(V=U\) up to global phase [1908.04416]. For fixed-input-state compiling, the corresponding global and local Loschmidt-echo objectives are
\[
C_{\rm LET}=1-|\langle \boldsymbol{0}|V^\dagger U|\boldsymbol{0}\rangle|^2,
\qquad
C_{\rm LLET}=1-\frac{1}{n}\sum_j G_{\rm LLET}^{(j)},
\]
with an analogous faithfulness relation [1908.04416].

Policy-gradient and reinforcement-learning formulations preserve the same compilation target but alter the optimization variable. One formulation replaces direct optimization over \(\theta\) by optimization over a stochastic policy \(\pi(\theta|\mu,\Sigma)\), with expected reward
\[
J = \mathbb{E}_{\pi_\mu}[F]
\]
and score-function gradient
\[
\nabla_\mu J =
\sum^m_k p_k \sum_\theta \pi(\theta|\mu,\Sigma)\nabla_\mu \log\pi(\theta|\mu,\Sigma)
|\langle k|V(\theta)^\dagger U |k\rangle|^2
\]
for sampled training states \(|k\rangle\) [2111.10227]. Another reinforcement-learning approach treats circuit structure as a discrete variable and jointly optimizes
\[
(\vec{k}^{\star},\vec{\theta}^{\star})
= \arg \min_{\vec{k},\vec{\theta}} C(U,V_{\vec{k}}(\vec{\theta})),
\]
where \(\vec{k}\) specifies gate identities, qubit operands, and order [2103.11611].

Universal-compilation formulations specialized to state preparation and tomography optimize the Fubini–Study distance
\[
d(\upsilon(\bm\theta),\tau) = \sqrt{1-\big|\langle \tau |\upsilon(\bm\theta)\rangle\big|^2}
\]
or equivalently pure-state fidelity [2204.11635]. Mixed-state variants replace pure-state overlap by the Hilbert–Schmidt distance
\[
C(\boldsymbol{\alpha}, R)
= \left\| \rho - \sigma(\boldsymbol{\alpha}, R)\right\|_2^2
= \operatorname{Tr}[\rho^2] + \operatorname{Tr}[\sigma(\boldsymbol{\alpha}, R)^2] - 2 \operatorname{Tr}[\rho \sigma(\boldsymbol{\alpha}, R)],
\]
under a rank constraint \(R\) [2209.00528].

For dynamics compilation, the ideal objective may be unitary infidelity
\[
C(U,V)=1-\mathcal F(U,V)
=1-\frac{1}{N^2}\big|\mathrm{Tr}(U^\dagger V)\big|^2,
\qquad N=2^n,
\]
but scalable formulations instead optimize empirical risk over input–output training examples,
\[
C_{\mathcal D_{\mathcal Q}}(\theta)
=1-\frac{1}{N_s}\sum_{i=1}^{N_s} \left| \langle \psi_i|V(\theta)|\phi_i\rangle \right|^2,
\]
where \(|\psi_i\rangle = U|\phi_i\rangle\) and \(\phi_i\) are sampled product states [2409.16346].

## 3. Methodological families

Several distinct methodological families coexist within variational quantum compilation.

The first is **unitary or state compiling with fixed ansatzes**. Here one chooses a trainable circuit architecture and optimizes only its continuous parameters against overlap-based costs such as HST, LHST, LET, or Fubini–Study distance [1908.04416], [2111.10227], [2204.11635]. Examples include dressed-CNOT ansatzes for compiling Toffoli, QFT, and W-state preparation [1908.04416], nearest-neighbor \(R_Y\) and \(R_{ZZ}\) ansatzes under policy-gradient training [2111.10227], and linear or graph-based ansatzes for GHZ and W state preparation [2204.11635].

The second is **structure-learning or architecture-search VQC**. In this family, circuit structure itself is an optimization variable. One double-\(Q\)-learning formulation writes the compiled circuit as
\[
V_{\vec k}(\vec \theta)=G_{k_L}(\theta_L)\cdots G_{k_1}(\theta_1),
\]
and treats gate choice and qubit assignment as RL actions, with terminal reward
\[
r_T = 1 - C(U,V)
\]
or a CNOT-penalized variant [2103.11611]. This approach was reported to find exact or near-exact compilations with shorter circuits than fixed-template baselines on several 2- and 3-qubit targets [2103.11611].

The third is **recursive or local compilation for deep or large-scale dynamics**. Recursive variational quantum compiling (RVQC) decomposes a deep target \(U=U_N\cdots U_1\) into shorter segments and trains successive ansatzes with costs
\[
C(\boldsymbol{\theta}^{(k)}) =
1-|\langle \boldsymbol{0}| V^{\dagger}(\boldsymbol{\theta}^{(k-1)})U_k^{\dagger}V(\boldsymbol{\theta}^{(k)}) |\boldsymbol{0}\rangle|^2,
\]
thereby replacing one deep noisy optimization problem by a sequence of shallower ones [2203.08514]. Local variational quantum compilation (LVQC) instead compiles a short-time evolution on a subsystem whose size is controlled by a Lieb–Robinson bound and then transfers the learned parameters to the full system [2203.15484], [2303.15667].

The fourth is **Hamiltonian-structured or commuting-operator compilation**. A generic strategy for the UCC ansatz partitions Pauli exponentials into mutually commuting sets, diagonalizes each set with a Clifford circuit, and synthesizes the resulting diagonal block using phase polynomials [2007.10515]. For QAOA, a separate structured compiler exploits commuting two-qubit cost-layer terms to obtain provable linear-depth compilations on lattice-like architectures [2112.06143].

The fifth is **pulse-level and hardware-native compilation**. Partial compilation for variational algorithms precompiles reusable pulse blocks or tunes GRAPE hyperparameters offline so that repeated parameter updates do not incur full pulse optimization from scratch [1909.07522]. A more recent hybrid gate–pulse model preserves the problem-informed part of a VQA at gate level while implementing the problem-agnostic part directly as native trainable pulses [2212.00661].

The sixth is **compiler and runtime infrastructure for repeated parameterized execution**. OpenQL Parameterized Compilation explicitly separates static circuit structure from dynamic parameters to reduce repeated recompilation overhead in hybrid loops [2208.07683]. An LLVM-based C++ toolchain compiles a parameterized hybrid program once, packages quantum kernels in ELFQ, and rebinds dynamic parameters at runtime, reducing total latency from
\[
N_{it}(T_c + T_e)
\]
to
\[
T_c + N_{it} T_e
\]
for \(N_{it}\) optimization iterations [2202.11142].

The seventh is **verification and analysis of compiled parameterized circuits**. Symbolic equivalence checking via ZX-calculus verifies whether a parameterized ansatz remains correct after transpilation for all parameter values [2210.12166]. Hardware-aware transpilation has also been shown to reshape gradient statistics and hence trainability, implying that compilation itself modifies the optimization landscape of VQCs [2604.16527].

## 4. Hardware awareness, trainability, and noise

Hardware-awareness is a recurring theme because near-term performance is dominated by two-qubit error, depth, routing overhead, and control constraints. One line of work on superconducting hardware argues that the most effective compilation strategy for VQAs is neither purely gate-level nor purely pulse-level, but a hybrid in which “fixed” problem-informed layers remain at gate abstraction while “problem-agnostic” layers are compiled and optimized at the pulse level [2212.00661]. In a QAOA case study, the Hamiltonian layer is kept gate-level while the mixer layer is represented by a native pulse ansatz with trainable amplitude, phase, and frequency controls [2212.00661].

A closely related issue is the repeated cost of compiling parameterized circuits in VQE- or QAOA-style loops. OpenQL Parameterized Compilation introduces explicit parameter objects so that only parameterized instructions and affected instructions are reconsidered during recompilation; when no QASM output is written, repeated compilations incur almost no additional wall-clock time beyond the first compile [2208.07683]. A more aggressive systems design in an LLVM-based toolchain preserves parameterized instructions in compiled artifacts and performs runtime rebinding, so that programmers can call quantum routines “the same way as classical routines” while avoiding recompilation across iterations [2202.11142].

Trainability is not invariant under compilation. A recent study comparing logical circuits \(C_{\text{log}}(\theta)\) and their transpiled physical counterparts \(C_{\text{phys}}(\theta)\) shows that transpilation can alter gradient variance in ansatz-dependent ways [2604.16527]. The metric
\[
\Delta \mathrm{GradVar}
=
\mathrm{GradVar}_{\text{phys}}-\mathrm{GradVar}_{\text{log}}
\]
reveals that shallow circuits are the most sensitive to hardware-aware compilation, while deep circuits show little sensitivity across EfficientSU2, TTN, and RealAmplitudes families [2604.16527]. This suggests that logical-level trainability analyses may be misleading when the physically executed circuit differs structurally from the abstract ansatz.

Noise affects both optimization and correctness in distinct ways. For traditional VQC costs based on HST/LHST or LET/LLET, rigorous results establish **Optimal Parameter Resilience (OPR)** under broad classes of incoherent noise models. Strong OPR means
\[
\widetilde{\mathbb{V}_d^{opt}} = \mathbb{V}_d^{opt},
\]
while weak OPR means
\[
\widetilde{\mathbb{V}_d^{opt}} \subseteq \mathbb{V}_d^{opt},
\]
so noisy optimization preserves the ideal optimum set or a subset thereof [1908.04416]. Theorems in that work show strong OPR for HST/LHST costs under depolarizing, Pauli, Pauli-gate, measurement, and certain non-unital Pauli noise models, and weak OPR for LET/LLET [1908.04416].

At the same time, noise can render optimization practically untrainable even if the optimum is preserved. RVQC addresses this by reducing effective training depth from \(L+K\) to
\[
2K + \frac{L}{N},
\]
when a target of depth \(L\) is segmented into \(N\) parts and compiled recursively with an ansatz of depth \(K\) [2203.08514]. Under the noise-induced barren plateau analysis adopted there, the gradient suppression changes from
\[
2^{(L+K)\log_2(q)}
\]
to
\[
2^{\left(2K + \frac{L}{N}\right)\log_2(q)},
\]
providing a concrete trainability rationale for segmentation [2203.08514].

## 5. Representative applications

### 5.1 Unitary and state compiling

Variational compiling was demonstrated early on for quantum Fourier transform, Toffoli, and W-state preparation, where noisy training on IBM’s noisy simulator still learned parameters that minimized the noiseless compilation cost [1908.04416]. Policy-gradient compiling later showed competitive performance relative to COBYLA and Powell on shallow random target circuits while avoiding Hilbert–Schmidt-test overheads [2111.10227]. Universal-compilation-based state preparation was studied with linear and graph-based ansatzes for GHZ and W states, using Fubini–Study distance and optimizers including QNG [2204.11635].

### 5.2 Quantum state tomography and mixed-state compiling

Universal compilation was also specialized to tomography of unknown pure states prepared by a circuit oracle, again using overlap estimation via inversion and computational-basis measurement [2204.11635]. Mixed-state compiling generalizes the paradigm by learning either a purification-based ansatz
\[
\sigma_{\mbox{\tiny SP}}(\boldsymbol{\theta},n_A)
=
\operatorname{Tr}_A\!\left[U_{\boldsymbol{\theta}}
(|0\rangle\!\langle0|)^{\otimes(n+n_A)}
U_{\boldsymbol{\theta}}^\dagger\right]
\]
or a convex combination of pure states
\[
\sigma_{\mbox{\tiny CCPS}}(\boldsymbol{\alpha},R)
=
\sum_{i=0}^{R-1} p_{\boldsymbol{\phi}}(i)\,
U_{\boldsymbol{\theta}}|i\rangle\!\langle i|U_{\boldsymbol{\theta}}^\dagger
\]
to approximate a target density matrix [2209.00528]. The optimal rank-\(R\) approximation under the Hilbert–Schmidt distance is
\[
\sigma(\boldsymbol{\alpha}_{\rm opt}, R)
=
\tau_R + \left(\frac{1-\operatorname{Tr}[\tau_R]}{R}\right)\Pi_R,
\qquad
\tau_R = \Pi_R \rho \Pi_R,
\]
so the method also functions as a compression and principal-component-learning procedure [2209.00528].

### 5.3 Hamiltonian dynamics and many-body simulation

A major recent strand treats variational quantum compilation as dynamics compression. One approach casts compilation of \(U(t)=e^{-iHt}\) as supervised quantum machine learning and trains a brickwall ansatz \(V(\theta)\) on a small set of time-evolved product states [2409.16346]. The empirical risk
\[
C_{\mathcal D_{\mathcal Q}}(\theta)
=
1-\frac{1}{N_s}\sum_{i=1}^{N_s}
\left| \langle \psi_i|V(\theta)|\phi_i\rangle \right|^2
\]
is justified by generalization results connecting random-product-state risk to Haar-average risk and hence to unitary infidelity [2409.16346]. This method was reported to exceed prior VQC results in both system size and accuracy in 1D and to extend VQC to 2D strips via quasi-1D treatment [2409.16346].

LVQC complements this by compiling short-time evolution on smaller subsystems using local HST/LHST costs and Lieb–Robinson bounds [2203.15484]. A later application to Green’s-function estimation for the Fermi–Hubbard model uses the same idea to learn shallow local dynamics circuits on small subsystems and reuse them unchanged on lattices up to \(4\times4\) sites (32 qubits) [2303.15667]. There the retarded Green’s function
\[
G^{\rm R}_{a,b}(t) = -i\Theta(t)\bra{\psi_0}\{e^{iHt}c_{a}e^{-iHt}, c_{b}^{\dag}\}\ket{\psi_0}
\]
is computed with the compiled circuit replacing exact real-time evolution [2303.15667].

### 5.4 VQE, UCC, and Pauli-operator ansätze

For UCC-type VQE circuits, a generic compilation strategy partitions Pauli exponentials into commuting sets, diagonalizes each set with a Clifford circuit, and synthesizes the resulting phase gadgets by phase-polynomial methods [2007.10515]. Across molecules, basis sets, and encodings, this yielded average CX depth reduction of \(75.4\%\) and up to \(89.9\%\) compared with naive synthesis [2007.10515].

Tetris addresses another chemistry-oriented setting: compilation of Pauli-string exponentials with explicit emphasis on reducing two-qubit gates in VQA circuits [2309.01905]. Its Tetris-IR partitions each Pauli block into root-tree and leaf-tree qubit sets so that shared leaf-tree structure induces CNOT cancellation. It reports up to \(41.3\%\) reduction in CNOT counts, \(37.9\%\) reduction in depth, and \(42.6\%\) reduction in duration relative to state-of-the-art approaches [2309.01905].

### 5.5 QAOA and structured variational circuits

QAOA is a recurring application because its cost-layer terms commute and its ansatz structure is graph-induced. A structured compiler exploiting this commutativity obtains linear-depth compilation guarantees on multi-dimensional hardware and reports up to \(3.8\times\) depth speedup, \(17\%\) gate-count reduction, and \(18\times\) improvement in circuit ESP up to 1024 qubits [2112.06143]. Hardware-aware hybrid gate–pulse compilation for QAOA on IBM superconducting backends further demonstrates that preserving the Hamiltonian layer at gate level while optimizing the mixer layer at pulse level can improve approximation ratio and shorten pulse duration [2212.00661].

## 6. Verification, infrastructure, and open issues

Trustworthy variational compilation requires verification because a compiled parameterized ansatz is typically reused across many optimization iterations. Symbolic equivalence checking of parameterized circuits via ZX-calculus addresses this directly [2210.12166]. Two parameterized circuits are equivalent only if for every parameter assignment \(\sigma\), the instantiated circuits are equal up to global phase. Under the paper’s linear-angle assumption
\[
\alpha_k = \left(\sum_{i=0}^{p-1}c_i\theta_i\right) + d,
\]
symbolic ZX rewriting can prove equivalence without instantiating parameters, while inequivalence can be exposed by structured or random instantiations [2210.12166]. The completeness guarantee rests on the theorem
\[
\mathbb{P}\{\theta \mid G(\theta) = G'(\theta)\} = 0
\]
for genuinely non-equivalent parameterized circuits with linear parameter expressions, so a random instantiation almost surely exposes inequivalence [2210.12166].

Infrastructure papers expose another crucial systems issue: the effective compilation unit in VQAs is often not a fully instantiated circuit but a parameterized kernel. OpenQL_PC makes explicit parameter objects first-class IR entities and updates only parameterized instructions during recompilation [2208.07683]. The LLVM-based single-source toolchain goes further by introducing quantum basic blocks embedded in ELFQ binaries and rebinding parameter values dynamically at runtime [2202.11142]. This suggests that scalable variational quantum compilation depends as much on compiler/runtime co-design as on ansatz-level optimization.

Several limitations and controversies remain. Traditional VQC costs such as HST are expressive but can exhibit barren plateaus [1908.04416], [2111.10227]. State-based or local costs improve trainability but may sacrifice some global guarantees [1908.04416], [2204.11635]. Hardware-aware transpilation can reshape trainability itself, complicating any separation between “algorithm design” and “compilation” [2604.16527]. Many methods remain specialized: the hybrid gate–pulse model is clearly tuned to superconducting hardware and to ansätze with a meaningful fixed/flexible split [2212.00661]; partial pulse compilation depends on ansatz monotonicity and block structure [1909.07522]; LVQC relies on locality and Lieb–Robinson-type bounds [2203.15484], [2303.15667]. Mixed-state compiling and universal-compilation-based tomography assume access models that are stronger than generic experimental tomography settings [2209.00528], [2204.11635].

A plausible implication is that “variational quantum compilation” is best treated not as a single algorithmic primitive but as a layered field spanning operator learning, structured circuit compression, symbolic verification, hardware-native realization, and repeated parameterized execution. Across these layers, the common theme is the replacement of static one-shot compilation by compilation procedures that explicitly account for trainability, parameter reuse, hardware constraints, and the semantics of variational quantum programs [1908.04416], [2208.07683], [2212.00661], [2604.16527].

Source: https://www.emergentmind.com/topics/variational-quantum-compilation