Papers
Topics
Authors
Recent
Search
2000 character limit reached

QASM Circuits with Qiskit AER

Updated 29 December 2025
  • QASM circuits using Qiskit AER are text-based quantum circuit descriptions in OpenQASM that enable hardware-agnostic simulation and secure obfuscation.
  • The method employs advanced techniques such as U3 obfuscation, randomized basis changes, and approximate unitary 3-designs to ensure compiler resistance and performance.
  • Empirical results show over 93% semantic fidelity and sub-millisecond simulation overhead, underscoring the practical viability of these techniques on commodity hardware.

A QASM circuit is a text-based description of a quantum circuit written in the OpenQASM (Open Quantum Assembly Language) format, commonly used for representing quantum computations in a hardware-agnostic, portable manner. Qiskit AER is a high-performance quantum circuit simulator that allows for the simulation, transformation, obfuscation, and measurement of QASM circuits using advanced techniques in unitary transformation, randomized basis changes, Markov-chain mixing, and group-theoretic constructions. This article surveys the formalism, algorithmic protocols, statistical properties, hardware mappings, and security implications of QASM circuits within the Qiskit AER ecosystem, emphasizing recent research advances.

1. QASM Circuit Formalism and Representation

A QASM circuit encodes a sequence of quantum gates and measurements on an nn-qubit register, using standardized instructions and optional classical registers. Each primitive gate, such as Hadamard or CNOT, can be represented as a unitary matrix; arbitrary single-qubit unitaries are typically parameterized as U3 gates: U3(θ,ϕ,λ)=(cos(θ/2)eiλsin(θ/2) eiϕsin(θ/2)ei(ϕ+λ)cos(θ/2))\text{U3}(\theta,\phi,\lambda) = \begin{pmatrix} \cos(\theta/2) & -e^{i\lambda} \sin(\theta/2) \ e^{i\phi} \sin(\theta/2) & e^{i(\phi+\lambda)} \cos(\theta/2) \end{pmatrix} Qiskit parses QASM source code via qiskit.qasm2.loads() or qiskit.qasm3.loads(), generating a QuantumCircuit object that preserves the gate structure, barriers, measurements, and resets (Parayil et al., 22 Dec 2025).

The structural representation of QASM circuits enables downstream transformations such as obfuscation by conjugation, randomized twirling, or re-basing in alternative group-theoretic decompositions.

2. Randomization, Obfuscation, and Compiler-Resistance

Quantum circuit obfuscation aims to conceal logical structure while preserving semantics and performance. Parayil et al. (Parayil et al., 22 Dec 2025) present a method where every gate GG in the QASM circuit is conjugated by randomly-selected global or per-gate U3 rotations, effecting the transformation: GUGUG \mapsto U^\dagger G U with U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda) sampled uniformly from the Haar distribution over SU(2). This process (the obfuscation sandwich, Editor's term) is applied as a QASM-to-QASM compiler pass:

  • Input Parsing: QASM loaded, quantum/classical operations preserved.
  • Basis Generation: Uniform random (θ,ϕ,λ)(\theta,\phi,\lambda) triples, with U=U3(θ,ϕ,λ)nU = U_3(\theta, \phi, \lambda)^{\otimes n} and UU^\dagger at circuit boundaries.
  • Gate Transformation: For each GG, compute M=UMGUM' = U^\dagger M_G U, wrap into a Qiskit UnitaryGate, and replace GG.
  • Circuit Reconstruction: Prepend and append global U/U†, then transpile for Qiskit AER backends.

This technique guarantees functional equivalence due to the invariance property UU=IU U^\dagger = I, so U(UGU)U=GU\,(U^\dagger G U)\,U^\dagger = G. All original measurement and reset regions are respected; only unitary gates are obfuscated.

Empirically, the method achieves greater than 93% semantic accuracy (e.g., 93.30% for QAOA circuits) and total variation distance below 0.084 over 1024-shot simulations, with runtime overhead under 1 ms on commodity hardware (Parayil et al., 22 Dec 2025). After merging pre/post U3 layers, the net circuit depth increase is ΔD=2\Delta D = 2.

Resistance to reverse engineering is achieved via two adversary models:

  • Black-box: Continuous random basis makes extraction via I/O queries negligible-probability.
  • White-box: If all nn gates are masked, reconstructing unitaries requires inverting UU^\dagger for each gate, which is only possible if adversary guesses the randomization pattern. Partial obfuscation with x<nx < n gates exponentially reduces success probability to 1/(nx)1/\binom{n}{x}.

QASM-level compatibility is retained since the obfuscated gates appear as opaque UnitaryGate blocks, thwarting transpiler pattern-matching and optimization.

3. Markov Chain Sampling and Unitary Designs

Unitary kk-designs are ensembles that replicate the kkth statistical moments of the Haar measure on UNU_N. The protocol of Zhu and Gross (Tan et al., 2020) constructs an approximate unitary 3-design on mm qubits via a staged Markov process targeting the orbits of the m-qubit Pauli group modulo phases:

  • Pauli Graph Construction: Vertices are non-identity Paulis; edges denote commutation, classified into type-1 (intra-group), type-2 (inter-group but commutative), and non-edges (anticommuting).
  • Sampling Protocol:
  1. Random Transvections: Apply T=O(log(N5/ϵ))T = O(\log(N^5/\epsilon)) random symplectic transvections ZhZ_h acting as xx+(xh)hx \mapsto x + (x \cdot h)h, implemented via Mølmer–Sørensen gates.
  2. Random Kerdock 2-design element gg: Uniformly drawn from the Kerdock subgroup (PSL(2,2m)(2,2^m)), mixing within edge types.
  3. Random Pauli D(a,b)D(a, b): Ensures uniformity at the Pauli 1-moment. The resulting Clifford,

U=D(a,b)gi=1TZhiU = D(a, b) \, g \, \prod_{i=1}^T Z_{h_i}

is provably an ϵ\epsilon-approximate unitary 3-design, where N=2mN=2^m (Tan et al., 2020).

Mixing analysis shows the protocol achieves 1\ell_1-distance within ϵ/(N3)\epsilon/(N^3) to Haar measure with T=O(m+log(1/ϵ))T=O(m+\log(1/\epsilon)) rounds, and the ensemble converges to an exact 3-design in the limit TT\to\infty.

4. Quantum Simulation of Haar Random Unitaries and Representation-Theoretic Protocols

Simulating Haar-random unitaries, such as random U3U_3 gates, can be performed via Clebsch–Gordan (CG) transforms, realized as a general compressed-oracle construction (Grinko et al., 30 Sep 2025). For tt sequential queries:

  • The system is decomposed via Schur–Weyl duality into irreducible subspaces, with memory registers recording total spin jj and multiplicity α\alpha (cost O(logt)O(\log t) qubits).
  • For each query, the CG process couples new qubit(s) using SU(2) CG coefficients, applies random Wigner DD-matrices in each irrep block according to the Haar measure (which at spin-12\frac12 corresponds to U3), then undoes the coupling.
  • Controlled-rotations and lookup tables realize the CG step. Complexity per query is O(logt)O(\log t) gates and O(logt)O(\log t) depth; total ancilla requirements are $1$ (data) plus O(logt)O(\log t) (memory) qubits.

This formalism allows efficient simulation of forward, inverse, transpose, and conjugate queries by specifying the nature of the inserted block during the CG/dCG process. For t=1t=1, closed-form parameterizations via Euler angles suffice; nontrivial CG network depth arises only for multiple queries (Grinko et al., 30 Sep 2025).

5. Implementation in Qiskit AER: Workflow and Performance

The obfuscation, randomization, and design protocols described above are implemented natively within Qiskit AER:

  • Input: QASM circuits loaded via qiskit.qasm2.loads()/qasm3.loads().
  • Transformation: Gate matrices extracted via qiskit.quantum_info.Operator, conjugated by randomly-sampled U3 or higher-level unitaries as per protocol, then re-embedded as UnitaryGate objects.
  • Boundary Correction: Global U3 layers inserted at circuit start/end (or at partition points if handling mid-circuit measurements).
  • Simulation: The transformed circuits, once fused, are transpiled for AerSimulator. Output distributions are compared using semantic accuracy and total variation distance.
  • Hardware Mapping: For unitary 3-design protocols, native implementation leverages Mølmer–Sørensen XX-type entangling gates on trapped-ion hardware, with gate depth scaling as O(m2+log(N5/ϵ))O(m^2 + \log(N^5/\epsilon)) (Tan et al., 2020).

Table: Complexity and Overhead Summary

Protocol/Technique Overhead (Gate Depth) Native Gate Mapping
U3 Obfuscation (Parayil et al., 22 Dec 2025) ΔD=2\Delta D = 2 (per circuit, after fusion) U3, arbitrary single-qubit
3-Design Markov (Tan et al., 2020) O(m2+log(N5/ϵ))O(m^2 + \log(N^5/\epsilon)) Two-qubit Mølmer–Sørensen
CG-based Haar (Grinko et al., 30 Sep 2025) O(logt)O(\log t) per query Controlled single-qubit, CG

For canonical circuits, the measured semantic fidelity is 93%\geq 93\% and obfuscated circuits remain efficiently simulable (<1 ms additional time per 1024 shots for QAOA) (Parayil et al., 22 Dec 2025).

6. Statistical Properties and Random Matrix Connections

Randomization protocols invoked in QASM/AER workflows often reduce to classical results on the distributions of unitary and orthogonal transformations. For example, repeated Haar-random orthogonal transformations ΓO(p)\Gamma\in O(p) acting on the "north pole" x0x_0 yields nontrivial statistics for U3=x0TΓ3x0U_3 = x_0^T \Gamma^3 x_0: U3=φ13+2φ1(1φ12)φ2+(1φ12)[φ1φ22+(1φ22)φ3]U_3 = \varphi_1^3 + 2\varphi_1(1-\varphi_1^2)\varphi_2 + (1-\varphi_1^2)[-\varphi_1\varphi_2^2 + (1-\varphi_2^2)\varphi_3] where φif(p+1i)\varphi_i\sim f(\cdot|p+1-i) are independent first-coordinates of Haar vectors on SpiS^{p-i} (Eaton et al., 2008). The variance decays as $1/p$ and for large pp, U3U_3 becomes approximately Gaussian.

Such detailed statistical characterizations are essential in benchmarking pseudo-randomness, spectral concentration, and deviation from ideal Haar-random sampling in QASM circuit simulation and design protocols.

7. Security, Applications, and Limitations

Compiler-resistant obfuscation via U3 conjugation (Parayil et al., 22 Dec 2025) provides robust defense against both black-box and white-box circuit analysis, reducing the probability of reverse engineering to negligible (continuous basis) or exponentially small (combinatorial, when only a subset of gates is obfuscated). Unlike previous structure-preserving masking, randomized basis transforms render classical transpiler pattern-matching and circuit identification ineffective.

Approximate unitary 3-designs (Tan et al., 2020) facilitate randomized benchmarking, emulation of Haar-random unitaries, and secure cryptographic sampling, with strong hardware mapping to native gates on trapped-ion platforms. CG-based Haar constructions (Grinko et al., 30 Sep 2025) provide efficient algorithms for realizing multiple independent Haar-sampled unitaries, critical for oracle constructions, randomized benchmarking, and design theory.

A plausible implication is that as circuits grow and obfuscation is performed gatewise, transparency for debugging and classical post-processing may be hampered; similarly, highly randomized designs can marginally increase simulation and transpilation cost, although empirical evidence shows these overheads remain pre-asymptotic for practically sized circuits. For multi-partite operations and mid-circuit measurements, circuit partitioning may be necessary to preserve correctness of transformations.

Overall, the integration of unitary design, group-theoretic randomization, and compiler-level obfuscation within the Qiskit AER and QASM circuit paradigm underpins modern approaches to robust, secure, and hardware-aware quantum circuit simulation and deployment.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to QASM Circuits Using Qiskit AER.