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 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}0.
  • Circuit Reconstruction: Prepend and append global U/U†, then transpile for Qiskit AER backends.

This technique guarantees functional equivalence due to the invariance property 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}1, so 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}2. 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 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}3.

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 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}4 gates are masked, reconstructing unitaries requires inverting 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}5 for each gate, which is only possible if adversary guesses the randomization pattern. Partial obfuscation with 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}6 gates exponentially reduces success probability to 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}7.

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 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}8-designs are ensembles that replicate the 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}9th statistical moments of the Haar measure on GG0. The protocol of Zhu and Gross (Tan et al., 2020) constructs an approximate unitary 3-design on GG1 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 GG2 random symplectic transvections GG3 acting as GG4, implemented via Mølmer–Sørensen gates.
  2. Random Kerdock 2-design element GG5: Uniformly drawn from the Kerdock subgroup (PSLGG6), mixing within edge types.
  3. Random Pauli GG7: Ensures uniformity at the Pauli 1-moment. The resulting Clifford,

GG8

is provably an GG9-approximate unitary 3-design, where GUGUG \mapsto U^\dagger G U0 (Tan et al., 2020).

Mixing analysis shows the protocol achieves GUGUG \mapsto U^\dagger G U1-distance within GUGUG \mapsto U^\dagger G U2 to Haar measure with GUGUG \mapsto U^\dagger G U3 rounds, and the ensemble converges to an exact 3-design in the limit GUGUG \mapsto U^\dagger G U4.

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

Simulating Haar-random unitaries, such as random GUGUG \mapsto U^\dagger G U5 gates, can be performed via Clebsch–Gordan (CG) transforms, realized as a general compressed-oracle construction (Grinko et al., 30 Sep 2025). For GUGUG \mapsto U^\dagger G U6 sequential queries:

  • The system is decomposed via Schur–Weyl duality into irreducible subspaces, with memory registers recording total spin GUGUG \mapsto U^\dagger G U7 and multiplicity GUGUG \mapsto U^\dagger G U8 (cost GUGUG \mapsto U^\dagger G U9 qubits).
  • For each query, the CG process couples new qubit(s) using SU(2) CG coefficients, applies random Wigner U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)0-matrices in each irrep block according to the Haar measure (which at spin-U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)1 corresponds to U3), then undoes the coupling.
  • Controlled-rotations and lookup tables realize the CG step. Complexity per query is U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)2 gates and U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)3 depth; total ancilla requirements are U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)4 (data) plus U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)5 (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 U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)6, 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 U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)7 (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) U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)8 (per circuit, after fusion) U3, arbitrary single-qubit
3-Design Markov (Tan et al., 2020) U=U3(θ,ϕ,λ)U=U_3(\theta,\phi,\lambda)9 Two-qubit Mølmer–Sørensen
CG-based Haar (Grinko et al., 30 Sep 2025) (θ,ϕ,λ)(\theta,\phi,\lambda)0 per query Controlled single-qubit, CG

For canonical circuits, the measured semantic fidelity is (θ,ϕ,λ)(\theta,\phi,\lambda)1 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 (θ,ϕ,λ)(\theta,\phi,\lambda)2 acting on the "north pole" (θ,ϕ,λ)(\theta,\phi,\lambda)3 yields nontrivial statistics for (θ,ϕ,λ)(\theta,\phi,\lambda)4: (θ,ϕ,λ)(\theta,\phi,\lambda)5 where (θ,ϕ,λ)(\theta,\phi,\lambda)6 are independent first-coordinates of Haar vectors on (θ,ϕ,λ)(\theta,\phi,\lambda)7 (Eaton et al., 2008). The variance decays as (θ,ϕ,λ)(\theta,\phi,\lambda)8 and for large (θ,ϕ,λ)(\theta,\phi,\lambda)9, U=U3(θ,ϕ,λ)nU = U_3(\theta, \phi, \lambda)^{\otimes n}0 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.